<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Only Four Left... &#187; EBS</title>
	<atom:link href="http://only4left.jpiwowar.com/category/ebs/feed/" rel="self" type="application/rss+xml" />
	<link>http://only4left.jpiwowar.com</link>
	<description>Oracle stuff.  Some Linux and Mac stuff.  ALTER TABLE blog DISABLE UNIQUE (content_type);</description>
	<lastBuildDate>Wed, 14 Sep 2011 12:00:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Oracle Apps 11i: Back to the future</title>
		<link>http://only4left.jpiwowar.com/2011/09/11i-back-to-the-future/</link>
		<comments>http://only4left.jpiwowar.com/2011/09/11i-back-to-the-future/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 12:00:39 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[references]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/09/11i-back-to-the-future/</guid>
		<description><![CDATA[Should you be unlucky enough to have to install an 11i Vision instance in these more advanced days, here's a roadmap to updating the database and tech stack afterward.]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/09/11i-back-to-the-future/" size="small" count="true"></div></div><p>A while ago, I posted a few <a href="http://only4left.jpiwowar.com/2011/03/vision-11-5-10-2-notes/" title="Gratuitous self-linkage, woo!">references</a> for installing an 11i Vision instance, noting that it was "something you'll hopefully only need to do once." The fun doesn't stop with installing the software, though. Once you're done with the easy part you're left with:</p>
<ol>
<li>A desupported version of the database</li>
<li>A desupported version of the Developer 6i tools (yes, even <i>more</i> obsolete than 6i's inherent obsolescence)</li>
<li>JInitiator, which is also, you guessed it, desupported in favor of the standard Sun JDK.</li>
</ol>
<p>What's the big deal? After all, 11i is in Extended Support mode, so why should it matter if an installed Vision instance has technical components that are a bit long in the tooth?  Extended Support or not, there are probably one or two (hah) 11i instances still stubbornly kicking around out there. Presumably those instances have been patched up at least a little bit. If you're installing an 11i Vision instance for educational purposes, it might help to have something that (hopefully) more closely matches the modern state of affairs.</p>
<p>Below are some of my notes from when I dragged my 11i Vision instance forward from 2005 to 2011.  Well, sort of.  It <i>is</i> still on 32-bit Linux (OEL 5.5 in this case) <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .  But the latest Developer 6i patch set has been applied, the database is at 11.2.0.2, Jinitiator's been replaced by JDK 6, and the AD tools are a bit more up-to-date. If you decide to use these notes, please understand that I intend them to be a rough guide, to save you some research time. I can't commit to detailed support of your effort.  This is a reference, not a cookbook.</p>
<h3 id="ref">Reference Notes</h3>
<p>Not surprisingly, upgrading 11i components to this decade requires a lot of preparatory reading. Even if you're really familiar with the contents, it's worth revisiting these docs; some of them were changed as recently as July 2011. Here's a list that should cover everything for 32-bit OEL:</p>
<h4 id="dbnotes">Database</h4>
<ul>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=216550.1" title = "Oracle Applications Release 11i with Oracle9i Release 2 (9.2.0)  ">Note 216550.1: Oracle Applications Release 11i with Oracle9i Release 2 (9.2.0) </a></li>
<li><a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e17222/upgrade.htm" title="11gR2 database upgrade guide">11gR2 database upgrade guide</a></li>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=881505.1" title = "	Interoperability Notes Oracle EBS 11i with Oracle Database 11gR2 (11.2.0.2)  ">Note 881505.1: 	Interoperability Notes Oracle EBS 11i with Oracle Database 11gR2 (11.2.0.2) </a></li>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=216205.1" title = "Database Initialization Parameters for Oracle Applications Release 11i  ">Note 216205.1: Database Initialization Parameters for Oracle Applications Release 11i </a></li>
</ul>
<h4 id="appnotes">Apps</h4>
<ul>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=233044.1" title = "About Oracle Applications DBA Minipack 11i.AD.I  ">Note 233044.1: About Oracle Applications DBA Minipack 11i.AD.I </a></li>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=783600.1" title = "About Oracle Applications Technology 11i.ATG_PF.H.delta.7 (RUP 7)  ">Note 783600.1: About Oracle Applications Technology 11i.ATG_PF.H.delta.7 (RUP 7) </a></li>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=858801.1" title = "Known Issues On Top of 11i.ATG_PF.H.delta.7 (RUP7) - 6241631  ">Note 858801.1: Known Issues On Top of 11i.ATG_PF.H.delta.7 (RUP7) - 6241631 </a></li>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=165195.1" title = "Using AutoConfig to Manage System Configurations with Oracle Applications 11i  ">Note 165195.1: Using AutoConfig to Manage System Configurations with Oracle Applications 11i </a></li>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=316806.1" title = "Oracle Applications Installation Update Notes, Release 11i (11.5.10.2)  ">Note 316806.1: Oracle Applications Installation Update Notes, Release 11i (11.5.10.2) </a> -- pay particular attention to the post-installation steps for relinking ASCP modules if you're using OEL/Redhat 5.4 and above. You may have already done this when installing Vision, but it's likely that a patch will overwrite adrelinknew.sh.</li>
</ul>
<h4 id="806notes">Forms, Java, and friends</h4>
<ul>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=125767.1" title = "Upgrading Developer 6i with Oracle Applications 11i  ">Note 125767.1: Upgrading Developer 6i with Oracle Applications 11i </a></li>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=401561.1" title = "Using J2SE Version 6 with Oracle E-Business Suite 11i  ">Note 401561.1: Using J2SE Version 6 with Oracle E-Business Suite 11i </a></li>
<li><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=290807.1" title = "Deploying Sun JRE (Native Plug-in) for Windows Clients in Oracle E-Business Suite 11i  ">Note 290807.1: Deploying Sun JRE (Native Plug-in) for Windows Clients in Oracle E-Business Suite 11i </a></li>
</ul>
<h3>Patches</h3>
<p>While you're reading, if you want to get a jump on downloading the patches listed in these documents, I've listed them below. Please validate that the patch numbers still match the documents; the Developer 6i patch document in particular are subject to relatively frequent updates.  </p>
<h4 id="dbpatch">Database</h4>
<ul>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=4547809" title="Patch 4547809 (via Metalink)">4547809</a> (9.2.0.8)</li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6880880">6880880</a> (9.2.0.8)</li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5495695">5495695</a> (9.2.0.8)</li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5391326">5391326</a> (9.2.0.8)</li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=10098816">10098816</a> (11.2.0.2 RDBMS, parts 1, 2 and 6 only)</li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=10149223">10149223</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=10229719">10229719</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=10165223">10165223</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=9776940">9776940</a></li>
</ul>
<h4 id="apppatch">Apps</h4>
<ul>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=3218526" title="Patch 3218526 (via Metalink)">3218526 </a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=4206794" title="Patch 4206794 (via Metalink)">4206794</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5622511" title="Patch 5622511 (via Metalink)">5622511</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5644137" title="Patch 5644137 (via Metalink)">5644137</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5977502" title="Patch 5977502 (via Metalink)">5977502</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6241631" title="Patch 6241631 (via Metalink)">6241631</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6400762" title="Patch 6400762 (via Metalink)">6400762</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6863618" title="Patch 6863618 (via Metalink)">6863618</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=7429271" title="Patch 7429271 (via Metalink)">7429271</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=7456837" title="Patch 7456837 (via Metalink)">7456837</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=7721754" title="Patch 7721754 (via Metalink)">7721754</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=8815204" title="Patch 8815204 (via Metalink)">8815204</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=9094950" title="Patch 9094950 (via Metalink)">9094950</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=9535311" title="Patch 9535311 (via Metalink)">9535311</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=9835302" title="Patch 9835302 (via Metalink)">9835302</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=9935935" title="Patch 9935935 (via Metalink)">9935935</a></li>
<h4 id="806patch">Forms, Java, and friends</h4>
</ul>
<ul>
<li>JDK 6 and JRE:  <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Download from OTN</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=2832275" title="Patch 2832275 (via Metalink)">2832275 </a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=3830807" title="Patch 3830807 (via Metalink)">3830807</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5232832" title="Patch 5232832 (via Metalink)">5232832</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=5571663" title="Patch 5571663 (via Metalink)">5571663</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6125732" title="Patch 6125732 (via Metalink)">6125732</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6747939" title="Patch 6747939 (via Metalink)">6747939</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6857221" title="Patch 6857221 (via Metalink)">6857221</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=7329300" title="Patch 7329300 (via Metalink)">7329300</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=7552880" title="Patch 7552880 (via Metalink)">7552880</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=8888184" title="Patch 8888184 (via Metalink)">8888184</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=9876919" title="Patch 9876919 (via Metalink)">9876919</a></li>
<li><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=12667746" title="Patch 12667746 (via Metalink)">12667746</a></li>
</ul>
<h3>Order of operations</h3>
<p>Tying all those notes and patches together looks daunting, but it's not actually that bad. Here's a quick summary of what needs to happen. Make sure to reference the relevant notes for detail. Please recall that we're working on a Vision "playground" here; some of my suggestions for speeding things up may not be comfortable in production.</p>
<ol>
<li>Start downloading all those fun patches! Here's a <a href="https://gist.github.com/1210438#file_gp_11_ff.sh">script</a> to get you started, though you might need to make adjustments if patch requirements have changed.</li>
<li>Upgrade the database from version 9.2.0.6 to 9.2.0.8, per note <a href="#dbnotes">216550.1</a> to make the 11gR2 upgrade smoother.  Doesn't take long, and while the scripts are running, you can work on the next five steps.  Just do the database pieces (Section 2, steps 3-9 &#038; 12  should be sufficient) for now.</li>
<li>Set <code>s_discostatus=disabled</code> in the context file to be picked up by the next Autoconfig run; this is 2011 for heaven's sake.</li>
<li>Install the JDK version 6 rpm as root.</li>
<li>Install 11.2.0.2 software and examples, per Note 881505.1</li>
<li>Create NLS data directory per note 881505.1</li>
<li>Apply database patches (9776940,10149223, 10165223, and 10229719) to the 11gR2 ORACLE_HOME.</li>
<li>Bring the newly-patched 9.2.0.8 database up and apply the AD.I.7 patch set. Use the nocompileb option; you have a utlrp step coming later.</li>
<li>Adjust adrelinknew.sh script, per Note 316806.1.</li>
<li>To avoid an error during the next round of patches, make an adjustment to the <code>IGW.IGW_AWARD_BUDGET_S</code> sequence.  This can also be fixed with a <a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=1271973.1">patch</a>, but why go through the trouble of getting a password-protected patch for this exercise?
<pre class="brush: sql; title: ; notranslate">
SQL&gt; alter sequence IGW.IGW_AWARD_BUDGET_S increment by 10000;
SQL&gt; select  IGW.IGW_AWARD_BUDGET_S.nextval from dual;
SQL&gt; alter sequence IGW.IGW_AWARD_BUDGET_S minvalue 10000;
</pre>
</li>
<li>Apply the rest of the Apps patches (Merge them all. Yes, seriously). Again, use the nocompiledb option, and noautoconfig as well; the JDK step below will take care of that for you.</li>
<li>Apply Forms 19 patchset and the small pile of related Forms and 8.0.6 ORACLE_HOME patches as documented in Doc ID 125767.1  -- don't forget the relink steps afterward</li>
<li>Run txkrun.pl per section 5.1 of note 401561.1 (use jdk_top=/usr/java/latest)</li>
<li>Regenerate jar files for jdk6 (use force option)</li>
<li>Deploy the JRE to the apps tier per note 290807.1</li>
<li>Perform the database upgrade per note 881505.1.  There's a lot to do there; follow the note closely.</li>
<li>Find something else to do with your day; recompiling 140K invalid objects might take a while.</li>
</ol>
<h3>Next steps ("Exercise for the Reader")</h3>
<p>What, you thought you were done? Now that all of the technical bits are more-or-less up-to-date, you can turn your attention to security patches and applications updates.  That may seem like a lot for a playground Vision instance, and maybe it is.  It's also too much to cover in this blog post, but check the following notes if you're an overachiever:</p>
<ul>
<li>Database CPU/PSU patching and Oracle Applications CPU patches. As an example of what you're looking for is <a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=1315202.1" title = "Oracle E-Business Suite Releases 11i and 12 Critical Patch Update Knowledge Document (July 2011)  ">Note 1315202.1: Oracle E-Business Suite Releases 11i and 12 Critical Patch Update Knowledge Document (July 2011).</a>  This is a quarterly "moving target," so that link will eventually be stale; check My Oracle Support for updates. </li>
<li>Oracle Applications Extended Support Baseline patches. If you want to be really, <i>really</i> up-to-date, visit <a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=883202.1" title = "	Patch Requirements for Extended Support of Oracle E-Business Suite Release 11.5.10  ">Note 883202.1: 	Patch Requirements for Extended Support of Oracle E-Business Suite Release 11.5.10 </a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/09/11i-back-to-the-future/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with EBS APIs, part II: Users and responsbilities (FND_USER_PKG)</title>
		<link>http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-ii/</link>
		<comments>http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-ii/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 23:00:51 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[R12]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-ii/</guid>
		<description><![CDATA[A quick look at some of the things you can do with the API provided by the FND_USER_PKG package in E-Business Suite.]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-ii/" size="small" count="true"></div></div><p>In <a href="http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-i/" title="Ah, the memories. Seems like only yesterday. Oh, wait.">my previous post</a>, I demo'ed some simple scripts to make changes to E-Business Suite profile options, using the API provided by the FND_PROFILE package.  This post will look at the FND_USER_PKG package (no relation to the "ABS brake system").  While my examples only reference user creation and responsibility assignment, it's really worth reviewing the contents of the rest of the package; there's lots of useful stuff in there.</p>
<h3 id="dis">First things first</h3>
<p>Disclaimer time!  Are you surprised? I hope you're not surprised.  Am I really copying this section from the previous post?  Yup, I am!</p>
<ol>
<li>The example code presented in this series of blog posts uses APIs written by Oracle to manipulate data in the E-Business Suite database. This does <b>NOT</b> imply that the code in these posts is endorsed or supported by Oracle.</li>
<li>The examples in this series of blog posts are presented as demonstration code only, and are neither guaranteed to work in your environment, nor in all cases.  Since my environments are not the same as yours, I cannot offer support in the event that this code does not work for you. You are encouraged to make whatever modifications are necessary to make these examples work for you.</li>
<li>The scripts used in these examples were developed and implemented in test and development environments, where change management rules are often more lax. Be sure to test thoroughly, and to consult your organization's change management procedures, before attempting to use this code in production.</li>
</ol>
<p>Short form: There's data-changing code in these posts.  Oracle won't support you if you use the code; I can't support you either.  Before running this code in production without testing and approval, you should probably prepare a resumé and, optionally, schedule an appointment with a psychiatrist. </p>
<h3 id="ex1">Example 1: Duplicating a user's responsibilities</h3>
<p>This is probably most relevant in test/dev/CRP environments, where it's not uncommon to be asked, "Can you please set up Fred to have the same responsibilities as Jane in the UAT environment?" or "Can you please set up 12 users in the Training environment, all with the same responsibilities?"  I've written a script called ebs_dupresp that will duplicate all of a user's directly-assigned responsibilities to a target user, optionally creating the user record:</p>
<div id="gist-1172122" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*</span></div><div class='line' id='LC2'><span class="cm">   ebs_dupresp.sql</span></div><div class='line' id='LC3'><span class="cm">   Contact: John Piwowar</span></div><div class='line' id='LC4'><span class="cm">   Purpose: Grant one user&#39;s responsbilities to another, optionally </span></div><div class='line' id='LC5'><span class="cm">            creating the target user</span></div><div class='line' id='LC6'><span class="cm">   Notes: ...</span></div><div class='line' id='LC7'><span class="cm">*/</span></div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'><span class="k">SET</span> <span class="n">serveroutput</span> <span class="k">on</span> <span class="k">size</span> <span class="mi">1000000</span> <span class="n">format</span> <span class="n">word_wrapped</span></div><div class='line' id='LC10'><span class="k">SET</span> <span class="n">verify</span> <span class="k">off</span> <span class="n">feedback</span> <span class="k">off</span> </div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'><span class="c1">--Readability improvements.  First time for everything.</span></div><div class='line' id='LC13'><span class="n">DEFINE</span> <span class="n">src</span><span class="o">=&amp;</span><span class="mi">1</span></div><div class='line' id='LC14'><span class="n">DEFINE</span> <span class="n">targ</span><span class="o">=&amp;</span><span class="mi">2</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'><span class="n">PROMPT</span> <span class="k">Source</span> <span class="k">user</span><span class="p">:</span> <span class="o">&amp;&amp;</span><span class="n">src</span></div><div class='line' id='LC17'><span class="n">PROMPT</span> <span class="n">Target</span> <span class="k">user</span><span class="p">:</span> <span class="o">&amp;&amp;</span><span class="n">targ</span></div><div class='line' id='LC18'><span class="n">PROMPT</span> <span class="n">CTRL</span><span class="o">-</span><span class="k">C</span> <span class="n">might</span> <span class="n">be</span> <span class="n">a</span> <span class="n">good</span> <span class="n">idea</span> <span class="n">if</span> <span class="n">these</span> <span class="k">are</span> <span class="n">incorrect</span><span class="o">/</span><span class="n">reversed</span><span class="p">.</span></div><div class='line' id='LC19'><span class="n">ACCEPT</span> <span class="n">create_user_pref</span> <span class="n">prompt</span> <span class="s1">&#39;Create &amp;&amp;targ if non-existent? (y/N) &#39;</span></div><div class='line' id='LC20'><br/></div><div class='line' id='LC21'><span class="k">DECLARE</span></div><div class='line' id='LC22'>&nbsp;&nbsp;&nbsp;<span class="n">src_user</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_USER</span><span class="p">.</span><span class="n">USER_NAME</span><span class="o">%</span><span class="k">TYPE</span> <span class="p">:</span><span class="o">=</span> <span class="k">upper</span><span class="p">(</span><span class="s1">&#39;&amp;&amp;src&#39;</span><span class="p">);</span></div><div class='line' id='LC23'>&nbsp;&nbsp;&nbsp;<span class="n">targ_user</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_USER</span><span class="p">.</span><span class="n">USER_NAME</span><span class="o">%</span><span class="k">TYPE</span> <span class="p">:</span><span class="o">=</span> <span class="k">upper</span><span class="p">(</span><span class="s1">&#39;&amp;&amp;targ&#39;</span><span class="p">);</span></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;<span class="n">create_flag</span> <span class="nb">BOOLEAN</span> <span class="p">:</span><span class="o">=</span> <span class="k">FALSE</span><span class="p">;</span></div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;<span class="n">targ_userid</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_USER</span><span class="p">.</span><span class="n">USER_ID</span><span class="o">%</span><span class="k">TYPE</span> <span class="p">:</span><span class="o">=</span> <span class="k">NULL</span><span class="p">;</span></div><div class='line' id='LC26'><br/></div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;<span class="c1">--Cursor to pull source user&#39;s responsbilities</span></div><div class='line' id='LC28'>&nbsp;&nbsp;&nbsp;<span class="c1">--Note: does not pull end-dated responsibilities, since they were </span></div><div class='line' id='LC29'>&nbsp;&nbsp;&nbsp;<span class="c1">--      presumably end-dated for a reason.  Also retains forward-looking</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;<span class="c1">--      end dates</span></div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;<span class="k">CURSOR</span> <span class="n">cGetResps</span> <span class="p">(</span><span class="n">user_in</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_USER</span><span class="p">.</span><span class="n">USER_NAME</span><span class="o">%</span><span class="k">TYPE</span><span class="p">)</span></div><div class='line' id='LC32'>&nbsp;&nbsp;&nbsp;<span class="k">IS</span></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">SELECT</span> <span class="n">a</span><span class="p">.</span><span class="n">application_short_name</span> <span class="n">app</span></div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">r</span><span class="p">.</span><span class="n">responsibility_key</span> <span class="k">key</span></div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">t</span><span class="p">.</span><span class="n">responsibility_name</span> <span class="n">respname</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">s</span><span class="p">.</span><span class="n">security_group_key</span> <span class="n">secgrp</span></div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="k">g</span><span class="p">.</span><span class="n">end_date</span></div><div class='line' id='LC38'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">apps</span><span class="p">.</span><span class="n">fnd_user_resp_groups_direct</span> <span class="k">g</span></div><div class='line' id='LC39'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_responsibility</span> <span class="n">r</span></div><div class='line' id='LC40'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_user</span> <span class="n">u</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_application</span> <span class="n">a</span></div><div class='line' id='LC42'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_security_groups</span> <span class="n">s</span></div><div class='line' id='LC43'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_responsibility_tl</span> <span class="n">t</span></div><div class='line' id='LC44'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHERE</span> <span class="k">g</span><span class="p">.</span><span class="n">responsibility_id</span> <span class="o">=</span> <span class="n">r</span><span class="p">.</span><span class="n">responsibility_id</span></div><div class='line' id='LC45'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="k">g</span><span class="p">.</span><span class="n">security_group_id</span> <span class="o">=</span> <span class="n">s</span><span class="p">.</span><span class="n">security_group_id</span></div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="k">g</span><span class="p">.</span><span class="n">responsibility_application_id</span> <span class="o">=</span> <span class="n">r</span><span class="p">.</span><span class="n">application_id</span></div><div class='line' id='LC47'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="k">g</span><span class="p">.</span><span class="n">responsibility_application_id</span><span class="o">=</span><span class="n">t</span><span class="p">.</span><span class="n">application_id</span></div><div class='line' id='LC48'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="k">g</span><span class="p">.</span><span class="n">responsibility_id</span><span class="o">=</span><span class="n">t</span><span class="p">.</span><span class="n">responsibility_id</span></div><div class='line' id='LC49'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="n">r</span><span class="p">.</span><span class="n">application_id</span> <span class="o">=</span> <span class="n">a</span><span class="p">.</span><span class="n">application_id</span></div><div class='line' id='LC50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="n">u</span><span class="p">.</span><span class="n">user_name</span> <span class="o">=</span> <span class="n">user_in</span></div><div class='line' id='LC51'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="k">g</span><span class="p">.</span><span class="n">user_id</span> <span class="o">=</span> <span class="n">u</span><span class="p">.</span><span class="n">user_id</span></div><div class='line' id='LC52'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="p">(</span><span class="k">g</span><span class="p">.</span><span class="n">end_date</span> <span class="o">&gt;</span> <span class="n">SYSDATE</span> <span class="k">or</span> <span class="k">g</span><span class="p">.</span><span class="n">end_date</span> <span class="k">is</span> <span class="k">null</span><span class="p">);</span></div><div class='line' id='LC53'><span class="k">BEGIN</span></div><div class='line' id='LC54'>&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="k">upper</span><span class="p">(</span><span class="n">substr</span><span class="p">(</span><span class="s1">&#39;&amp;&amp;create_user_pref&#39;</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span> <span class="o">=</span> <span class="s1">&#39;Y&#39;</span> <span class="k">THEN</span></div><div class='line' id='LC55'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">create_flag</span> <span class="p">:</span><span class="o">=</span> <span class="k">TRUE</span><span class="p">;</span></div><div class='line' id='LC56'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--create_user_pref=Y</span></div><div class='line' id='LC57'>&nbsp;&nbsp;</div><div class='line' id='LC58'>&nbsp;&nbsp;&nbsp;<span class="c1">--Create user if needed </span></div><div class='line' id='LC59'>&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="n">create_flag</span> <span class="k">AND</span> <span class="k">NOT</span> <span class="p">(</span><span class="n">apps</span><span class="p">.</span><span class="n">fnd_user_pkg</span><span class="p">.</span><span class="n">userExists</span><span class="p">(</span><span class="n">targ_user</span><span class="p">))</span></div><div class='line' id='LC60'>&nbsp;&nbsp;&nbsp;<span class="k">THEN</span></div><div class='line' id='LC61'><br/></div><div class='line' id='LC62'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">targ_userid</span> <span class="p">:</span><span class="o">=</span> <span class="n">apps</span><span class="p">.</span><span class="n">fnd_user_pkg</span><span class="p">.</span><span class="n">createuserid</span> <span class="p">(</span></div><div class='line' id='LC63'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">x_user_name</span> <span class="o">=&gt;</span> <span class="n">targ_user</span></div><div class='line' id='LC64'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x_owner</span> <span class="o">=&gt;</span> <span class="s1">&#39;CUST&#39;</span></div><div class='line' id='LC65'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x_unencrypted_password</span> <span class="o">=&gt;</span> <span class="s1">&#39;chang3m3&#39;</span></div><div class='line' id='LC66'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x_description</span> <span class="o">=&gt;</span> <span class="s1">&#39;Autocreated by ebs_dupresps.sql&#39;</span></div><div class='line' id='LC67'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC68'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">--Probably won&#39;t ever get to this point, but just to be safe...</span></div><div class='line' id='LC69'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="n">targ_userid</span> <span class="k">IS</span> <span class="k">NULL</span> <span class="k">THEN</span></div><div class='line' id='LC70'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Failed to create &#39;</span> <span class="o">||</span> <span class="n">targ_user</span> <span class="o">||</span> </div><div class='line' id='LC71'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;, cannot continue&#39;</span></div><div class='line' id='LC72'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC73'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">RETURN</span><span class="p">;</span></div><div class='line' id='LC74'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">ELSE</span> </div><div class='line' id='LC75'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;User &#39;</span> <span class="o">||</span> <span class="n">targ_user</span> <span class="o">||</span> <span class="s1">&#39; created with id &#39;</span> <span class="o">||</span></div><div class='line' id='LC76'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">targ_userid</span><span class="p">);</span></div><div class='line' id='LC77'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--targ_userid</span></div><div class='line' id='LC78'>&nbsp;&nbsp;&nbsp;<span class="n">ELSIF</span> <span class="n">create_flag</span> <span class="k">AND</span> <span class="p">(</span><span class="n">apps</span><span class="p">.</span><span class="n">fnd_user_pkg</span><span class="p">.</span><span class="n">userExists</span><span class="p">(</span><span class="n">targ_user</span><span class="p">))</span></div><div class='line' id='LC79'>&nbsp;&nbsp;&nbsp;<span class="k">THEN</span></div><div class='line' id='LC80'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;User &#39;</span> <span class="o">||</span> <span class="n">targ_user</span> <span class="o">||</span> <span class="s1">&#39; already exists.&#39;</span><span class="p">);</span></div><div class='line' id='LC81'>&nbsp;&nbsp;&nbsp;<span class="n">ELSIF</span> <span class="k">NOT</span> <span class="n">create_flag</span> <span class="k">AND</span> <span class="k">NOT</span> <span class="p">(</span><span class="n">apps</span><span class="p">.</span><span class="n">fnd_user_pkg</span><span class="p">.</span><span class="n">userExists</span><span class="p">(</span><span class="n">targ_user</span><span class="p">))</span></div><div class='line' id='LC82'>&nbsp;&nbsp;&nbsp;<span class="k">THEN</span></div><div class='line' id='LC83'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;User &#39;</span> <span class="o">||</span> <span class="n">targ_user</span>  <span class="o">||</span> </div><div class='line' id='LC84'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39; does not exist and create flag not specified.&#39;</span><span class="p">);</span></div><div class='line' id='LC85'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">RETURN</span><span class="p">;</span></div><div class='line' id='LC86'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--create_flag</span></div><div class='line' id='LC87'><br/></div><div class='line' id='LC88'>&nbsp;&nbsp;&nbsp;<span class="c1">--Add responsibilities</span></div><div class='line' id='LC89'>&nbsp;&nbsp;</div><div class='line' id='LC90'>&nbsp;&nbsp;&nbsp;<span class="k">FOR</span> <span class="n">new_resp</span> <span class="k">IN</span> <span class="n">cGetResps</span><span class="p">(</span><span class="n">src_user</span><span class="p">)</span></div><div class='line' id='LC91'>&nbsp;&nbsp;&nbsp;<span class="n">LOOP</span></div><div class='line' id='LC92'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Adding responsibility &#39;</span> <span class="o">||</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">respname</span><span class="p">);</span></div><div class='line' id='LC93'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">apps</span><span class="p">.</span><span class="n">fnd_user_pkg</span><span class="p">.</span><span class="n">AddResp</span><span class="p">(</span> <span class="n">username</span> <span class="o">=&gt;</span> <span class="n">targ_user</span></div><div class='line' id='LC94'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">resp_app</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">app</span></div><div class='line' id='LC95'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">resp_key</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="k">key</span></div><div class='line' id='LC96'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">security_group</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">secgrp</span></div><div class='line' id='LC97'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">description</span> <span class="o">=&gt;</span> <span class="s1">&#39;Added by ebs_dupresps.sql&#39;</span></div><div class='line' id='LC98'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">start_date</span> <span class="o">=&gt;</span> <span class="n">SYSDATE</span></div><div class='line' id='LC99'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">end_date</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">end_date</span></div><div class='line' id='LC100'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span>  </div><div class='line' id='LC101'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">LOOP</span><span class="p">;</span> <span class="c1">--new_resp</span></div><div class='line' id='LC102'><span class="k">END</span><span class="p">;</span> <span class="c1">--ebs_dupresps</span></div><div class='line' id='LC103'><span class="o">/</span></div><div class='line' id='LC104'><br/></div><div class='line' id='LC105'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1172122/29a41b202f85cdb3c34119afa7fe3b788eca24fa/ebs_dupresp.sql" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1172122#file_ebs_dupresp.sql" style="float:right;margin-right:10px;color:#666">ebs_dupresp.sql</a>
            <a href="https://gist.github.com/1172122">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Here's a two-part demo.  For the first part, I've assumed that I just got the following email from my boss:</p>
<blockquote><p>John, Please create an EBS account in the test environment for the new DBA, Devnul Larson.  Just give him the same responsibilities that you have, for now.</p></blockquote>
<pre class="brush: sql; title: ; notranslate">
APPS@R12VIS(11.1.0.7)&gt;@ebs_dupresp johnp devnull
Source user: johnp
Target user: devnull
CTRL-C might be a good idea if these are incorrect/reversed.
Create devnull if non-existent? (y/N) y
User DEVNULL created with id 1013423
Adding responsibility System Administrator
Adding responsibility Oracle Diagnostics Tool
APPS@R12VIS(11.1.0.7)&gt;@lresp johnp
Currently active responsibilities for user johnp

APP		     RESPNAME				      END_DATE
-------------------- ---------------------------------------- ---------------
FND		     Application Diagnostics		      NONE
FND		     Application Diagnostics		      NONE
JTF		     Oracle Diagnostics Tool		      NONE
SYSADMIN	     System Administrator		      NONE
APPS@R12VIS(11.1.0.7)&gt;@lresp devnull
Currently active responsibilities for user devnull

APP		     RESPNAME				      END_DATE
-------------------- ---------------------------------------- ---------------
FND		     Application Diagnostics		      NONE
FND		     Application Diagnostics		      NONE
JTF		     Oracle Diagnostics Tool		      NONE
SYSADMIN	     System Administrator		      NONE
</pre>
<p>Later that day, another email arrives:</p>
<blockquote><p>On second thought, just assign all of SYSADMIN's responsibilities to the new guy.  BTW, why are you assigning all the new tickets to DEVNULL?</p></blockquote>
<pre class="brush: sql; title: ; notranslate">
APPS@R12VIS(11.1.0.7)&gt;@ebs_dupresp sysadmin devnull
Source user: sysadmin
Target user: devnull
CTRL-C might be a good idea if these are incorrect/reversed.
Create devnull if non-existent? (y/N) y
User DEVNULL already exists.
Adding responsibility Application Developer
Adding responsibility System Administrator
Adding responsibility Application Developer Common Modules
Adding responsibility System Administration
Adding responsibility Preferences SSWA
Adding responsibility Workflow
(I'll spare you the full list)
</pre>
<p>It's worth noting that this is a fairly primitive approach, particularly when it comes to the user creation piece (no LDAP integration, no association of user record with an HR person/party record, etc). The ebs_dupresp script also doesn't touch things like profile options, so it shouldn't be considered a "user clone" script.  You could probably accomplish this work with FNDLOAD or a third-party tool like DataLoader, but I'd rather write SQL. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h3 id="ex1">Example 2: Adding a list of responsibilities to a user</h3>
<p>Another common need is adding responsibilities to multiple users.  Maybe you want to add the Application Developer responsibility to a handful of new consultants, or grant the Oracle Diagnostics responsibility to some freshly trained business analysts and power users.  With a little bit of setup, it's pretty easy to do bulk responsibility assignments in a way that's easily repeated across multiple instances. Here's an example script, ebs_bulkresp, that does the job:</p>
<div id="gist-1172122" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*</span></div><div class='line' id='LC2'><span class="cm">   ebs_bulkresp.sql</span></div><div class='line' id='LC3'><span class="cm">   Contact: John Piwowar</span></div><div class='line' id='LC4'><span class="cm">   Purpose: Add 1+ responsibilities to 1+ users</span></div><div class='line' id='LC5'><span class="cm">   Requires: desired action (validate or apply) as script argument</span></div><div class='line' id='LC6'><span class="cm">             Table xxrespload, of the format:</span></div><div class='line' id='LC7'><span class="cm">             Name			   Type</span></div><div class='line' id='LC8'><span class="cm">             ----------------------------- --------------------</span></div><div class='line' id='LC9'><span class="cm">             USER_NAME			   VARCHAR2(100)</span></div><div class='line' id='LC10'><span class="cm">             APP_SHORTNAME		   VARCHAR2(50)</span></div><div class='line' id='LC11'><span class="cm">             RESP_NAME			   VARCHAR2(100)</span></div><div class='line' id='LC12'><span class="cm">             END_DATE			   DATE</span></div><div class='line' id='LC13'><span class="cm">   Notes:  Actually, validation happens no matter what, but it never hurts to be explicit</span></div><div class='line' id='LC14'><span class="cm">*/</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'><span class="k">SET</span> <span class="n">serveroutput</span> <span class="k">on</span> <span class="k">size</span> <span class="mi">1000000</span> <span class="n">format</span> <span class="n">word_wrapped</span></div><div class='line' id='LC17'><span class="k">SET</span> <span class="n">verify</span> <span class="k">off</span> <span class="n">feedback</span> <span class="k">off</span></div><div class='line' id='LC18'><span class="n">col</span> <span class="n">user_name</span> <span class="k">for</span> <span class="n">a20</span></div><div class='line' id='LC19'><span class="n">col</span> <span class="n">app</span> <span class="k">for</span> <span class="n">a10</span></div><div class='line' id='LC20'><span class="n">col</span> <span class="n">end_date</span> <span class="k">for</span> <span class="n">a15</span></div><div class='line' id='LC21'><span class="n">col</span> <span class="n">resp_name</span> <span class="k">for</span> <span class="n">a35</span></div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'><span class="n">PROMPT</span> <span class="n">Working</span> <span class="k">with</span> <span class="n">following</span> <span class="n">records</span> <span class="k">in</span> <span class="k">table</span> <span class="n">xxrespload</span><span class="p">:</span></div><div class='line' id='LC24'><span class="k">SELECT</span> <span class="n">user_name</span></div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">app_shortname</span> <span class="n">app</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">resp_name</span></div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">nvl</span><span class="p">(</span><span class="n">to_char</span><span class="p">(</span><span class="n">end_date</span><span class="p">,</span><span class="s1">&#39;DD-MON-YYYY&#39;</span><span class="p">),</span><span class="s1">&#39;NONE&#39;</span><span class="p">)</span> <span class="n">end_date</span></div><div class='line' id='LC28'>&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">xxrespload</span></div><div class='line' id='LC29'>&nbsp;<span class="k">ORDER</span> <span class="k">BY</span> <span class="n">user_name</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">resp_name</span></div><div class='line' id='LC31'><span class="o">/</span></div><div class='line' id='LC32'><br/></div><div class='line' id='LC33'><span class="k">DECLARE</span></div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;<span class="n">action</span> <span class="n">VARCHAR2</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span> <span class="p">:</span><span class="o">=</span> <span class="k">upper</span><span class="p">(</span><span class="s1">&#39;&amp;1&#39;</span><span class="p">);</span></div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;<span class="k">TYPE</span> <span class="n">RespPair</span> <span class="k">IS</span> <span class="n">RECORD</span> <span class="p">(</span> <span class="n">app</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_APPLICATION</span><span class="p">.</span><span class="n">APPLICATION_SHORT_NAME</span><span class="o">%</span><span class="k">TYPE</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">resp</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_RESPONSIBILITY_TL</span><span class="p">.</span><span class="n">RESPONSIBILITY_NAME</span> <span class="o">%</span><span class="k">TYPE</span></div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC38'>&nbsp;&nbsp;&nbsp;<span class="k">TYPE</span> <span class="n">UserList</span> <span class="k">IS</span> <span class="k">TABLE</span> <span class="k">OF</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_USER</span><span class="p">.</span><span class="n">USER_NAME</span><span class="o">%</span><span class="k">TYPE</span><span class="p">;</span></div><div class='line' id='LC39'>&nbsp;&nbsp;&nbsp;<span class="k">TYPE</span> <span class="n">RespList</span> <span class="k">IS</span> <span class="k">TABLE</span> <span class="k">OF</span> <span class="n">RespPair</span><span class="p">;</span></div><div class='line' id='LC40'>&nbsp;&nbsp;&nbsp;<span class="n">BadUsers</span> <span class="n">UserList</span><span class="p">;</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;<span class="n">BadResps</span> <span class="n">RespList</span><span class="p">;</span></div><div class='line' id='LC42'>&nbsp;&nbsp;&nbsp;<span class="c1">--N.B. Annoying security_group_id kludge. NULL=STANDARD, woohoo!</span></div><div class='line' id='LC43'>&nbsp;&nbsp;&nbsp;<span class="k">CURSOR</span> <span class="n">cGetBulkResps</span> <span class="k">IS</span></div><div class='line' id='LC44'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">SELECT</span> <span class="n">x</span><span class="p">.</span><span class="n">user_name</span></div><div class='line' id='LC45'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x</span><span class="p">.</span><span class="n">app_shortname</span></div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x</span><span class="p">.</span><span class="n">resp_name</span></div><div class='line' id='LC47'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">r</span><span class="p">.</span><span class="n">responsibility_key</span> <span class="n">resp_key</span></div><div class='line' id='LC48'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">s</span><span class="p">.</span><span class="n">security_group_key</span> <span class="n">secgrp</span> </div><div class='line' id='LC49'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x</span><span class="p">.</span><span class="n">end_date</span></div><div class='line' id='LC50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">xxrespload</span> <span class="n">x</span></div><div class='line' id='LC51'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">JOIN</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_application</span> <span class="n">a</span> <span class="k">on</span> <span class="p">(</span><span class="n">a</span><span class="p">.</span><span class="n">application_short_name</span><span class="o">=</span><span class="n">x</span><span class="p">.</span><span class="n">app_shortname</span><span class="p">)</span></div><div class='line' id='LC52'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">JOIN</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_responsibility_tl</span> <span class="n">t</span> <span class="k">on</span> <span class="p">(</span>    <span class="n">a</span><span class="p">.</span><span class="n">application_id</span><span class="o">=</span><span class="n">t</span><span class="p">.</span><span class="n">application_id</span></div><div class='line' id='LC53'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">and</span> <span class="n">x</span><span class="p">.</span><span class="n">resp_name</span><span class="o">=</span><span class="n">t</span><span class="p">.</span><span class="n">responsibility_name</span><span class="p">)</span></div><div class='line' id='LC54'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">JOIN</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_responsibility</span> <span class="n">r</span> <span class="k">on</span>  <span class="p">(</span>    <span class="n">t</span><span class="p">.</span><span class="n">application_id</span><span class="o">=</span><span class="n">r</span><span class="p">.</span><span class="n">application_id</span></div><div class='line' id='LC55'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">and</span> <span class="n">t</span><span class="p">.</span><span class="n">responsibility_id</span><span class="o">=</span><span class="n">r</span><span class="p">.</span><span class="n">responsibility_id</span><span class="p">)</span></div><div class='line' id='LC56'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">JOIN</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_security_groups</span> <span class="n">s</span> <span class="k">on</span> <span class="p">(</span><span class="n">nvl</span><span class="p">(</span><span class="n">r</span><span class="p">.</span><span class="n">security_group_id</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span><span class="o">=</span><span class="n">s</span><span class="p">.</span><span class="n">security_group_id</span><span class="p">)</span></div><div class='line' id='LC57'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHERE</span> <span class="n">x</span><span class="p">.</span><span class="n">user_name</span> <span class="k">is</span> <span class="k">not</span> <span class="k">null</span><span class="p">;</span></div><div class='line' id='LC58'><span class="k">BEGIN</span></div><div class='line' id='LC59'>&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC60'>&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Starting validation...&#39;</span><span class="p">);</span></div><div class='line' id='LC61'><br/></div><div class='line' id='LC62'>&nbsp;&nbsp;&nbsp;<span class="c1">--Validate supplied users</span></div><div class='line' id='LC63'><br/></div><div class='line' id='LC64'>&nbsp;&nbsp;&nbsp;<span class="k">SELECT</span> <span class="k">DISTINCT</span> <span class="n">user_name</span></div><div class='line' id='LC65'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">BULK</span> <span class="n">COLLECT</span> <span class="k">INTO</span> <span class="n">BadUsers</span></div><div class='line' id='LC66'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">xxrespload</span> <span class="n">x</span></div><div class='line' id='LC67'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHERE</span> <span class="k">NOT</span> <span class="k">EXISTS</span> <span class="p">(</span><span class="k">SELECT</span> <span class="n">user_name</span> </div><div class='line' id='LC68'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">fnd_user</span> <span class="n">u</span></div><div class='line' id='LC69'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHERE</span> <span class="n">u</span><span class="p">.</span><span class="n">user_name</span> <span class="o">=</span> <span class="n">x</span><span class="p">.</span><span class="n">user_name</span></div><div class='line' id='LC70'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="p">(</span><span class="n">u</span><span class="p">.</span><span class="n">end_date</span> <span class="k">is</span> <span class="k">null</span> <span class="k">OR</span> <span class="n">u</span><span class="p">.</span><span class="n">end_date</span> <span class="o">&gt;</span> <span class="n">SYSDATE</span><span class="p">)</span></div><div class='line' id='LC71'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC72'><br/></div><div class='line' id='LC73'>&nbsp;&nbsp;&nbsp;<span class="c1">--Validate app-resp pairs</span></div><div class='line' id='LC74'><br/></div><div class='line' id='LC75'>&nbsp;&nbsp;&nbsp;<span class="k">SELECT</span> <span class="k">DISTINCT</span> <span class="n">app_shortname</span></div><div class='line' id='LC76'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">resp_name</span></div><div class='line' id='LC77'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">BULK</span> <span class="n">COLLECT</span> <span class="k">INTO</span> <span class="n">BadResps</span></div><div class='line' id='LC78'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">xxrespload</span> <span class="n">x</span></div><div class='line' id='LC79'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHERE</span> <span class="k">NOT</span> <span class="k">EXISTS</span> <span class="p">(</span> <span class="k">SELECT</span> <span class="n">a</span><span class="p">.</span><span class="n">application_short_name</span></div><div class='line' id='LC80'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">r</span><span class="p">.</span><span class="n">responsibility_name</span></div><div class='line' id='LC81'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_responsibility_tl</span> <span class="n">r</span></div><div class='line' id='LC82'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">JOIN</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_application</span> <span class="n">a</span> <span class="k">using</span> <span class="p">(</span><span class="n">application_id</span><span class="p">)</span></div><div class='line' id='LC83'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHERE</span> <span class="n">a</span><span class="p">.</span><span class="n">application_short_name</span> <span class="o">=</span> <span class="n">x</span><span class="p">.</span><span class="n">app_shortname</span></div><div class='line' id='LC84'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">AND</span> <span class="n">r</span><span class="p">.</span><span class="n">responsibility_name</span> <span class="o">=</span> <span class="n">x</span><span class="p">.</span><span class="n">resp_name</span></div><div class='line' id='LC85'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC86'><br/></div><div class='line' id='LC87'>&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="n">BadUsers</span><span class="p">.</span><span class="k">COUNT</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">THEN</span></div><div class='line' id='LC88'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Found &#39;</span> <span class="o">||</span> <span class="n">BadUsers</span><span class="p">.</span><span class="k">COUNT</span> <span class="o">||</span> <span class="s1">&#39; invalid user names.&#39;</span><span class="p">);</span></div><div class='line' id='LC89'>&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC90'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FOR</span> <span class="n">i</span> <span class="k">IN</span> <span class="n">BadUsers</span><span class="p">.</span><span class="k">FIRST</span> <span class="p">..</span> <span class="n">BadUsers</span><span class="p">.</span><span class="k">LAST</span></div><div class='line' id='LC91'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LOOP</span> </div><div class='line' id='LC92'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;User &#39;</span> <span class="o">||</span> <span class="n">nvl</span><span class="p">(</span><span class="n">BadUsers</span><span class="p">(</span><span class="n">i</span><span class="p">),</span><span class="s1">&#39;&lt;NULL&gt;&#39;</span><span class="p">)</span> <span class="o">||</span> </div><div class='line' id='LC93'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39; does not exist or is end-dated.&#39;</span></div><div class='line' id='LC94'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC95'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">LOOP</span><span class="p">;</span> <span class="c1">--BadUsers;</span></div><div class='line' id='LC96'>&nbsp;&nbsp;&nbsp;<span class="k">ELSE</span></div><div class='line' id='LC97'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;All users valid.&#39;</span><span class="p">);</span></div><div class='line' id='LC98'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--BadUsers.COUNT</span></div><div class='line' id='LC99'><br/></div><div class='line' id='LC100'>&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="n">BadResps</span><span class="p">.</span><span class="k">COUNT</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">THEN</span></div><div class='line' id='LC101'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Found &#39;</span> <span class="o">||</span> <span class="n">BadResps</span><span class="p">.</span><span class="k">COUNT</span> <span class="o">||</span> <span class="s1">&#39; invalid app-responsibility pairs.&#39;</span><span class="p">);</span></div><div class='line' id='LC102'><br/></div><div class='line' id='LC103'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FOR</span> <span class="n">i</span> <span class="k">IN</span> <span class="n">BadResps</span><span class="p">.</span><span class="k">FIRST</span> <span class="p">..</span> <span class="n">BadResps</span><span class="p">.</span><span class="k">LAST</span></div><div class='line' id='LC104'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LOOP</span></div><div class='line' id='LC105'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Responsibility &#39;</span> <span class="o">||</span> <span class="n">nvl</span><span class="p">(</span><span class="n">BadResps</span><span class="p">(</span><span class="n">i</span><span class="p">).</span><span class="n">resp</span><span class="p">,</span><span class="s1">&#39;&lt;NULL&gt;&#39;</span><span class="p">)</span> <span class="o">||</span> </div><div class='line' id='LC106'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39; invalid for app &#39;</span> <span class="o">||</span></div><div class='line' id='LC107'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">nvl</span><span class="p">(</span><span class="n">BadResps</span><span class="p">(</span><span class="n">i</span><span class="p">).</span><span class="n">app</span><span class="p">,</span><span class="s1">&#39;&lt;NULL&gt;&#39;</span><span class="p">)</span> <span class="o">||</span></div><div class='line' id='LC108'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;, or vice versa.&#39;</span></div><div class='line' id='LC109'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span> </div><div class='line' id='LC110'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">LOOP</span><span class="p">;</span> <span class="c1">--BadResps</span></div><div class='line' id='LC111'>&nbsp;&nbsp;&nbsp;<span class="k">ELSE</span></div><div class='line' id='LC112'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;All app-responsibility pairs valid&#39;</span><span class="p">);</span></div><div class='line' id='LC113'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--BadResps.COUNT</span></div><div class='line' id='LC114'><br/></div><div class='line' id='LC115'>&nbsp;&nbsp;&nbsp;<span class="c1">--Okay, now let&#39;s actually do stuff</span></div><div class='line' id='LC116'>&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="n">action</span> <span class="o">=</span> <span class="s1">&#39;APPLY&#39;</span> <span class="k">THEN</span></div><div class='line' id='LC117'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Adding responsibilities...&#39;</span><span class="p">);</span></div><div class='line' id='LC118'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FOR</span> <span class="n">new_resp</span> <span class="k">IN</span> <span class="n">cGetBulkResps</span></div><div class='line' id='LC119'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LOOP</span></div><div class='line' id='LC120'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;User: &#39;</span> <span class="o">||</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">user_name</span> <span class="o">||</span></div><div class='line' id='LC121'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39; App: &#39;</span> <span class="o">||</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">app_shortname</span> <span class="o">||</span></div><div class='line' id='LC122'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39; Resp: &#39;</span> <span class="o">||</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">resp_name</span></div><div class='line' id='LC123'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC124'><br/></div><div class='line' id='LC125'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">apps</span><span class="p">.</span><span class="n">fnd_user_pkg</span><span class="p">.</span><span class="n">AddResp</span><span class="p">(</span> <span class="n">username</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">user_name</span></div><div class='line' id='LC126'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">resp_app</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">app_shortname</span></div><div class='line' id='LC127'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">resp_key</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">resp_key</span></div><div class='line' id='LC128'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">security_group</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">secgrp</span></div><div class='line' id='LC129'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">description</span> <span class="o">=&gt;</span> <span class="s1">&#39;Added by ebs_bulkresps.sql&#39;</span></div><div class='line' id='LC130'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">start_date</span> <span class="o">=&gt;</span> <span class="n">SYSDATE</span></div><div class='line' id='LC131'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">end_date</span> <span class="o">=&gt;</span> <span class="n">new_resp</span><span class="p">.</span><span class="n">end_date</span></div><div class='line' id='LC132'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC133'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">LOOP</span><span class="p">;</span> <span class="c1">--cGetBulkResps</span></div><div class='line' id='LC134'>&nbsp;&nbsp;&nbsp;<span class="k">ELSE</span> </div><div class='line' id='LC135'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Invoke script with APPLY to add responsibilities&#39;</span><span class="p">);</span></div><div class='line' id='LC136'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--action=&#39;APPLY&#39;;</span></div><div class='line' id='LC137'><span class="k">END</span><span class="p">;</span> <span class="c1">--ebs_bulkresp</span></div><div class='line' id='LC138'><span class="o">/</span></div><div class='line' id='LC139'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1172122/442cc08ea6155b2057dc34fbbc1d744ed1259a6b/ebs_bulkresp.sql" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1172122#file_ebs_bulkresp.sql" style="float:right;margin-right:10px;color:#666">ebs_bulkresp.sql</a>
            <a href="https://gist.github.com/1172122">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>As a demo, here's another theoretical work request:</p>
<blockquote><p>Please assign Application Developer and Oracle Diagnostics responsibilities to users SBERG, YWATSON, and WPARKER. SBERG will also need Functional Administrator. WPARKER will be rolling off the project at the end of the year, so please end-date his responsibilities accordingly. These changes are approved for both development environments and all three CRP instances.</p></blockquote>
<p>After loading the necessary information into a "staging table" (actually a <a href="https://gist.github.com/1172122#file_ebs_resp_crext.sql" title="external table definition">simply-formatted external table</a>), away we go:</p>
<pre class="brush: sql; title: ; notranslate">
APPS@R12VIS(11.1.0.7)&gt;@ebs_bulkresp validate
Working with following records in table xxrespload:

USER_NAME	     APP	RESP_NAME			    END_DATE
-------------------- ---------- ----------------------------------- ---------------
SBERG		     FND	Application Developer		    NONE
SBERG		     FND	Functional Administrator	    NONE
SBERG		     JTF	Oracle Diagnostics Tool 	    NONE
WPARKER 	     FND	Application Developer		    31-DEC-2011
WPARKER 	     JTF	Oracle Diagnostics Tool 	    31-DEC-2011
YWATSON 	     FND	Application Developer		    NONE
YWATSON 	     JTF	Oracle Diagnostics Tool 	    NONE
Starting validation...
All users valid.
All app-responsibility pairs valid
Invoke script with APPLY to add responsibilities
APPS@R12VIS(11.1.0.7)&gt;@ebs_bulkresp apply
Working with following records in table xxrespload:

USER_NAME	     APP	RESP_NAME			    END_DATE
-------------------- ---------- ----------------------------------- ---------------
SBERG		     FND	Application Developer		    NONE
SBERG		     FND	Functional Administrator	    NONE
SBERG		     JTF	Oracle Diagnostics Tool 	    NONE
WPARKER 	     FND	Application Developer		    31-DEC-2011
WPARKER 	     JTF	Oracle Diagnostics Tool 	    31-DEC-2011
YWATSON 	     FND	Application Developer		    NONE
YWATSON 	     JTF	Oracle Diagnostics Tool 	    NONE
Starting validation...
All users valid.
All app-responsibility pairs valid
Adding responsibilities...
User: YWATSON App: FND Resp: Application Developer
User: WPARKER App: FND Resp: Application Developer
User: SBERG App: FND Resp: Application Developer
User: SBERG App: FND Resp: Functional Administrator
User: YWATSON App: JTF Resp: Oracle Diagnostics Tool
User: WPARKER App: JTF Resp: Oracle Diagnostics Tool
User: SBERG App: JTF Resp: Oracle Diagnostics Tool
APPS@R12VIS(11.1.0.7)&gt;@lresp ywatson
Currently active responsibilities for user ywatson

APP		     RESPNAME				      END_DATE
-------------------- ---------------------------------------- ---------------
FND		     Application Developer		      NONE
FND		     Application Diagnostics		      NONE
PSB		     Budget User - Accounting Dept, Progress  NONE
SQLGL		     General Ledger Super User, Progress S&amp;L  NONE
ICX		     Internet Procurement, Progress S&amp;L       NONE
JTF		     Oracle Diagnostics Tool		      NONE
SQLAP		     Payables Manager, Progress S&amp;L	      NONE
ICX		     Preferences SSWA			      NONE
FND		     Workflow User, Progress S&amp;L	      NONE
APPS@R12VIS(11.1.0.7)&gt;@lresp sberg
Currently active responsibilities for user sberg

APP		     RESPNAME				      END_DATE
-------------------- ---------------------------------------- ---------------
FND		     Application Developer		      NONE
FND		     Application Diagnostics		      NONE
FND		     Functional Administrator		      NONE
IBE		     IBE_CUSTOMER			      NONE
JTF		     Oracle Diagnostics Tool		      NONE
ICX		     Preferences SSWA			      NONE
APPS@R12VIS(11.1.0.7)&gt;@lresp wparker
Currently active responsibilities for user wparker

APP		     RESPNAME				      END_DATE
-------------------- ---------------------------------------- ---------------
FND		     Application Developer		      31-DEC-2011
FND		     Application Diagnostics		      31-DEC-2011
JTF		     Oracle Diagnostics Tool		      31-DEC-2011
ICX		     Preferences SSWA			      NONE
WMS		     Whse Mgmt Mobile User, Vision Operations NONE
		      (USA)
</pre>
<p>It's rare that you'll get a request that also includes the name of the application to which a responsibility belongs.  If you don't keep a mental inventory of valid pairs of application and responsibility names (or maybe that's just me?), here's a quick way to look up that sort of info:</p>
<div id="gist-1172122" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*</span></div><div class='line' id='LC2'><span class="cm">  iresp.sql</span></div><div class='line' id='LC3'><span class="cm">  Contact: John Piwowar</span></div><div class='line' id='LC4'><span class="cm">  Purpose: List useful identifier for EBS responsibilities</span></div><div class='line' id='LC5'><span class="cm">  Notes: Provide fragment of responsbility name</span></div><div class='line' id='LC6'><span class="cm">*/</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><span class="n">col</span> <span class="n">responsibility_name</span> <span class="k">for</span> <span class="n">a50</span></div><div class='line' id='LC9'><span class="n">col</span> <span class="n">app_name</span> <span class="k">for</span> <span class="n">a10</span></div><div class='line' id='LC10'><span class="n">col</span> <span class="n">app_id</span> <span class="k">for</span> <span class="mi">999999</span></div><div class='line' id='LC11'><span class="n">col</span> <span class="n">resp_id</span> <span class="k">for</span> <span class="mi">999999</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="k">set</span> <span class="n">pagesize</span> <span class="mi">9999</span> <span class="n">verify</span> <span class="k">off</span></div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'><span class="k">select</span> <span class="n">application_id</span> <span class="n">app_id</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">a</span><span class="p">.</span><span class="n">application_short_name</span> <span class="n">app_name</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">r</span><span class="p">.</span><span class="n">responsibility_id</span> <span class="n">resp_id</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">r</span><span class="p">.</span><span class="n">responsibility_name</span></div><div class='line' id='LC19'>&nbsp;&nbsp;<span class="k">from</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_responsibility_tl</span> <span class="n">r</span></div><div class='line' id='LC20'>&nbsp;&nbsp;<span class="k">join</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_application</span> <span class="n">a</span> <span class="k">using</span> <span class="p">(</span><span class="n">application_id</span><span class="p">)</span></div><div class='line' id='LC21'>&nbsp;<span class="k">where</span> <span class="k">upper</span><span class="p">(</span><span class="n">r</span><span class="p">.</span><span class="n">responsibility_name</span><span class="p">)</span> <span class="k">like</span> <span class="k">upper</span><span class="p">(</span><span class="s1">&#39;%&amp;1%&#39;</span><span class="p">)</span></div><div class='line' id='LC22'>&nbsp;<span class="k">order</span> <span class="k">by</span> <span class="n">responsibility_name</span></div><div class='line' id='LC23'><span class="o">/</span></div><div class='line' id='LC24'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1172122/68e0a28929ca51fff0f165e1d7e678628f87e159/iresp.sql" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1172122#file_iresp.sql" style="float:right;margin-right:10px;color:#666">iresp.sql</a>
            <a href="https://gist.github.com/1172122">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with EBS APIs, part I: Profile options (FND_PROFILE)</title>
		<link>http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-i/</link>
		<comments>http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-i/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 22:30:36 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[R12]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-i/</guid>
		<description><![CDATA[A short demonstration of the use of the FND_PROFILE API in Oracle E-Business Suite.]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-i/" size="small" count="true"></div></div><p>The E-Business Suite APIs are not just the realm of developers and data migration specialists. There are a number of APIs, particularly in the FND module, that can make life a lot easier for Apps DBAs.  In my next two (maybe three, if I'm feeling ambitious) posts, I'll provide some examples of how to use PL/SQL to perform tasks that normally require slogging around in the EBS Forms interface.</p>
<h3 id="dis">First things first</h3>
<p>Disclaimer time!  Are you surprised? I hope you're not surprised.</p>
<ol>
<li>The example code presented in this series of blog posts uses APIs written by Oracle to manipulate data in the E-Business Suite database. This does <b>NOT</b> imply that the code in these posts is endorsed or supported by Oracle.</li>
<li>The examples in this series of blog posts are presented as demonstration code only, and are neither guaranteed to work in your environment, nor in all cases.  Since my environments are not the same as yours, I cannot offer support in the event that this code does not work for you. You are encouraged to make whatever modifications are necessary to make these examples work for you.</li>
<li>The scripts used in these examples were developed and implemented in test and development environments, where change management rules are often more lax. Be sure to test thoroughly, and to consult your organization's change management procedures, before attempting to use this code in production.</li>
</ol>
<p>Short form: There's data-changing code in these posts.  Oracle won't support you if you use the code; I can't support you either.  Before running this code in production without testing and approval, you should probably prepare a resumé and, optionally, schedule an appointment with a psychiatrist. </p>
<h3 id="righto">Okay, moving on…</h3>
<p>Now that I have all that out of the way, here are two basic examples demonstrating the use of FND_PROFILE.  As with most PL/SQL code in the E-Business Suite database, FND_PROFILE is owned by the APPS schema. Browse through it, there's interesting stuff in there. Please note that the <code>set_ebs_profile</code> function referenced in these examples is my hackwork (defined in <a href="https://gist.github.com/1169354#file_ebs_def_setprof.sql">ebs_def_setprof.sql</a>), not part of the Oracle-supplied API.</p>
<h3 id="ex1">Example 1: Setting profile options after cloning</h3>
<p>Autoconfig takes care of setting a lot of site-level profile options after cloning, but there may be a few instances when you need to change settings manually before releasing the instance to users.  The following script is a template that I use, adding calls to <code>set_ebs_profile</code> as needed.<br />
<div id="gist-1169354" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/* </span></div><div class='line' id='LC2'><span class="cm">   ebs_postclone_prof.sql</span></div><div class='line' id='LC3'><span class="cm">   Contact/blame: John Piwowar</span></div><div class='line' id='LC4'><span class="cm">   Purpose: Set Site-level profile options after an EBS clone</span></div><div class='line' id='LC5'><span class="cm">   Requires: ebs_def_setprof.sql</span></div><div class='line' id='LC6'><span class="cm">   Notes: * Uses internal name for profile option, rather than user-readable </span></div><div class='line' id='LC7'><span class="cm">            value (e.g. &quot;SITENAME&quot;, not &quot;Site Name&quot;). Consult </span></div><div class='line' id='LC8'><span class="cm">            fnd_profile_options_tl for appropriate values.</span></div><div class='line' id='LC9'><span class="cm">          * Site name and color scheme are the obvious ones; add others as </span></div><div class='line' id='LC10'><span class="cm">            needed</span></div><div class='line' id='LC11'><span class="cm">*/</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="n">ACCEPT</span> <span class="n">new_SID</span> <span class="n">PROMPT</span> <span class="ss">&quot;New SID (e.g. MYCLONE,NEWVIS, etc): &quot;</span></div><div class='line' id='LC14'><span class="n">ACCEPT</span> <span class="n">new_color</span> <span class="n">PROMPT</span> <span class="ss">&quot;New Color Scheme (TEAL, RED, KHAKI, OLIVE, PURPLE, TITANIUM): &quot;</span></div><div class='line' id='LC15'><span class="n">ACCEPT</span> <span class="n">env_type</span> <span class="n">PROMPT</span> <span class="ss">&quot;Instance type (e.g. Test, Dev, Sandbox): &quot;</span></div><div class='line' id='LC16'><span class="n">ACCEPT</span> <span class="n">data_src</span> <span class="n">PROMPT</span> <span class="ss">&quot;Data source note (e.g. &#39;Prod clone, data as of DD-MON-YYYY&#39;): &quot;</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><span class="k">set</span> <span class="n">serveroutput</span> <span class="k">on</span> <span class="k">size</span> <span class="mi">1000000</span> <span class="n">format</span> <span class="n">word_wrapped</span><span class="p">;</span></div><div class='line' id='LC19'><span class="k">set</span> <span class="n">verify</span> <span class="k">off</span> <span class="n">feedback</span> <span class="k">off</span> </div><div class='line' id='LC20'>&nbsp;</div><div class='line' id='LC21'><span class="n">spool</span> <span class="n">ebs_postclone_prof_</span><span class="o">&amp;&amp;</span><span class="n">new_SID</span><span class="p">..</span><span class="n">log</span></div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'><span class="k">DECLARE</span></div><div class='line' id='LC24'><span class="o">@</span><span class="n">ebs_def_setprof</span></div><div class='line' id='LC25'><span class="k">BEGIN</span></div><div class='line' id='LC26'><span class="n">set_ebs_profile</span><span class="p">(</span><span class="s1">&#39;FND_COLOR_SCHEME&#39;</span><span class="p">,</span><span class="s1">&#39;&amp;&amp;new_color&#39;</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span></div><div class='line' id='LC27'><span class="n">set_ebs_profile</span><span class="p">(</span><span class="s1">&#39;SITENAME&#39;</span><span class="p">,</span><span class="s1">&#39;&amp;&amp;env_type (&amp;&amp;new_SID.) - &amp;&amp;data_src&#39;</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span></div><div class='line' id='LC28'><span class="k">END</span><span class="p">;</span></div><div class='line' id='LC29'><span class="o">/</span></div><div class='line' id='LC30'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1169354/4851a3ff3dd991c1700d3519efda745f53eb31f7/ebs_postclone_prof.sql" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1169354#file_ebs_postclone_prof.sql" style="float:right;margin-right:10px;color:#666">ebs_postclone_prof.sql</a>
            <a href="https://gist.github.com/1169354">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
<br />
Example run:</p>
<pre class="brush: sql; title: ; notranslate">
APPS@R12VIS(11.1.0.7)&gt;@ebs_postclone_prof
New SID (e.g. MYCLONE,NEWVIS, etc): JPR12VIS
New Color Scheme (TEAL, RED, KHAKI, OLIVE, PURPLE, TITANIUM): PURPLE
Instance type (e.g. Test, Dev, Sandbox): Visionary
Data source note (e.g. 'Prod clone, data as of DD-MON-YYYY'): Timeless data
Previous value of FND_COLOR_SCHEME: KHAKI
SUCCESS: Set FND_COLOR_SCHEME to PURPLE
Previous value of SITENAME: Vision Applications
SUCCESS: Set SITENAME to Visionary (JPR12VIS) - Timeless data
</pre>
<h3 id="ex2">Example 2: Setting multiple profile options for a user</h3>
<p>In a development environment, you may be asked to set debug profile options for particular modules.  It can be handy to have a script that does this for a particular user, ensure that no one "accidentally" sets debug options at the site level (oh, I know, it's <i>rare</i>, but still…).  It's ridiculously easy to put together a quick script to take care of this:<br />
<div id="gist-1169354" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*</span></div><div class='line' id='LC2'><span class="cm">   om_debug.sql</span></div><div class='line' id='LC3'><span class="cm">   Contact/blame: John Piwowar</span></div><div class='line' id='LC4'><span class="cm">   Purpose: Set Order Management debug values for a given user</span></div><div class='line' id='LC5'><span class="cm">   Usage: @om_debug &lt;username&gt; &lt;debug level&gt;</span></div><div class='line' id='LC6'><span class="cm">   Requires: ebs_def_setprof.sql</span></div><div class='line' id='LC7'><span class="cm">   Notes: I&#39;m sure I&#39;ll think of something...</span></div><div class='line' id='LC8'><span class="cm">*/</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'><span class="k">SET</span> <span class="n">serveroutput</span> <span class="k">on</span> <span class="k">size</span> <span class="mi">1000000</span> <span class="n">format</span> <span class="n">word_wrapped</span></div><div class='line' id='LC11'><span class="k">SET</span> <span class="n">verify</span> <span class="k">off</span> <span class="n">feedback</span> <span class="k">off</span> </div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="k">DECLARE</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;<span class="n">outdir</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_PROFILE_OPTION_VALUES</span><span class="p">.</span><span class="n">PROFILE_OPTION_VALUE</span><span class="o">%</span><span class="k">TYPE</span><span class="p">;</span></div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;<span class="n">uname</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_USER</span><span class="p">.</span><span class="n">USER_NAME</span><span class="o">%</span><span class="k">TYPE</span> <span class="p">:</span><span class="o">=</span> <span class="s1">&#39;&amp;1&#39;</span><span class="p">;</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;<span class="n">dlvl</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_PROFILE_OPTION_VALUES</span><span class="p">.</span><span class="n">PROFILE_OPTION_VALUE</span><span class="o">%</span><span class="k">TYPE</span> <span class="p">:</span><span class="o">=</span> <span class="s1">&#39;&amp;2&#39;</span><span class="p">;</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;<span class="o">@</span><span class="n">ebs_def_setprof</span></div><div class='line' id='LC18'><span class="k">BEGIN</span></div><div class='line' id='LC19'>&nbsp;&nbsp;&nbsp;<span class="c1">--find a writable directory the lazy way, same way FND_FILE does it. ;-)</span></div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;<span class="k">SELECT</span> <span class="n">substr</span><span class="p">(</span><span class="n">value</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">instr</span><span class="p">(</span><span class="n">value</span><span class="p">,</span><span class="s1">&#39;,&#39;</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span></div><div class='line' id='LC21'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">INTO</span> <span class="n">outdir</span></div><div class='line' id='LC22'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">v</span><span class="err">$</span><span class="k">parameter</span></div><div class='line' id='LC23'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHERE</span> <span class="n">name</span> <span class="o">=</span> <span class="s1">&#39;utl_file_dir&#39;</span><span class="p">;</span></div><div class='line' id='LC24'><br/></div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Setting OM debug for &#39;</span> <span class="o">||</span> <span class="n">uname</span><span class="p">);</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;<span class="n">set_ebs_profile</span><span class="p">(</span><span class="s1">&#39;OE_DEBUG_LOG_DIRECTORY&#39;</span><span class="p">,</span> <span class="n">outdir</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span></div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;<span class="n">set_ebs_profile</span><span class="p">(</span><span class="s1">&#39;ONT_DEBUG_LEVEL&#39;</span><span class="p">,</span> <span class="n">dlvl</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">,</span> <span class="n">uname</span><span class="p">);</span></div><div class='line' id='LC28'><span class="k">END</span><span class="p">;</span></div><div class='line' id='LC29'><span class="o">/</span></div><div class='line' id='LC30'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1169354/ea2277daafb41b9cd845e450dd587d45bc0659c6/om_debug.sql" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1169354#file_om_debug.sql" style="float:right;margin-right:10px;color:#666">om_debug.sql</a>
            <a href="https://gist.github.com/1169354">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</p>
<p>Example run:</p>
<pre class="brush: sql; title: ; notranslate">
APPS@R12VIS(11.1.0.7)&gt;@om_debug jpiwowar 5
Setting OM debug for jpiwowar
Previous value of OE_DEBUG_LOG_DIRECTORY: /usr/tmp
Skipping OE_DEBUG_LOG_DIRECTORY, no change
Target user: jpiwowar
Previous value of ONT_DEBUG_LEVEL: 0
SUCCESS: Set ONT_DEBUG_LEVEL to 5
</pre>
<h3 id="code">The interesting bits</h3>
<p>The code that defines the procedure <code>set_ebs_profile</code> can be found below.  I've purposely written the script to be plugged into anonymous PL/SQL blocks instead of creating a procedure, because deployment of custom code is not always permitted.<br />
<div id="gist-1169354" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/* </span></div><div class='line' id='LC2'><span class="cm">   ebs_def_setprof.sql</span></div><div class='line' id='LC3'><span class="cm">   Contact/blame: John Piwowar</span></div><div class='line' id='LC4'><span class="cm">   Purpose: Braindead wrapper for setting site and user-level profile options </span></div><div class='line' id='LC5'><span class="cm">            with fnd_profile.save. </span></div><div class='line' id='LC6'><span class="cm">   Notes: * Call as part of the declare section of an anon PL/SQL block.</span></div><div class='line' id='LC7'><span class="cm">            That&#39;s my sad attempt at reusability without creating stored procs</span></div><div class='line' id='LC8'><span class="cm">          * Assumes a great many things, including that you&#39;re running as </span></div><div class='line' id='LC9'><span class="cm">            a user with exec privileges on FND_PROFILE, and that you don&#39;t </span></div><div class='line' id='LC10'><span class="cm">            need fancy error reporting if things go wrong. ;-)</span></div><div class='line' id='LC11'><span class="cm">          * Only handles site/user-level settings, per protocol El-Ay-Zed-Why</span></div><div class='line' id='LC12'><span class="cm">          * Still somewhat primitive, could probably use more of API for </span></div><div class='line' id='LC13'><span class="cm">            success/failure messages, etc.</span></div><div class='line' id='LC14'><span class="cm">*/</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'><span class="k">PROCEDURE</span> <span class="n">set_ebs_profile</span> <span class="p">(</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">prof_option</span> <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_PROFILE_OPTIONS</span><span class="p">.</span><span class="n">PROFILE_OPTION_NAME</span><span class="o">%</span><span class="k">TYPE</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">prof_value</span>  <span class="n">APPLSYS</span><span class="p">.</span><span class="n">FND_PROFILE_OPTION_VALUES</span><span class="p">.</span><span class="n">PROFILE_OPTION_VALUE</span><span class="o">%</span><span class="k">TYPE</span> </div><div class='line' id='LC19'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">override</span> <span class="nb">BOOLEAN</span> <span class="k">DEFAULT</span> <span class="k">FALSE</span> <span class="c1">-- controls behavior when already set</span></div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">uname</span> <span class="n">FND_USER</span><span class="p">.</span><span class="n">USER_NAME</span><span class="o">%</span><span class="k">TYPE</span> <span class="k">DEFAULT</span> <span class="k">NULL</span> <span class="c1">-- if no username passed, set at site level</span></div><div class='line' id='LC21'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">)</span></div><div class='line' id='LC22'><span class="k">IS</span></div><div class='line' id='LC23'>&nbsp;&nbsp;&nbsp;<span class="n">uid</span> <span class="n">FND_USER</span><span class="p">.</span><span class="n">USER_ID</span><span class="o">%</span><span class="k">TYPE</span> <span class="p">:</span><span class="o">=</span> <span class="k">NULL</span><span class="p">;</span></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;<span class="n">prof_level</span> <span class="n">VARCHAR2</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span> <span class="p">:</span><span class="o">=</span> <span class="s1">&#39;SITE&#39;</span><span class="p">;</span> <span class="c1">--Current longest val is &#39;SERVRESP&#39;</span></div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;<span class="n">set_result</span> <span class="nb">BOOLEAN</span> <span class="p">:</span><span class="o">=</span> <span class="k">FALSE</span><span class="p">;</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;<span class="n">prev_val_defined</span> <span class="nb">BOOLEAN</span> <span class="p">:</span><span class="o">=</span> <span class="k">TRUE</span><span class="p">;</span> <span class="c1">--assume yes until we learn otherwise</span></div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;<span class="n">prev_val</span> <span class="n">FND_PROFILE_OPTION_VALUES</span><span class="p">.</span><span class="n">PROFILE_OPTION_VALUE</span><span class="o">%</span><span class="k">TYPE</span><span class="p">;</span></div><div class='line' id='LC28'><span class="k">BEGIN</span></div><div class='line' id='LC29'>&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="n">uname</span> <span class="k">IS</span> <span class="k">NOT</span> <span class="k">NULL</span> <span class="k">THEN</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Target user: &#39;</span> <span class="o">||</span> <span class="n">uname</span><span class="p">);</span></div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">prof_level</span> <span class="p">:</span><span class="o">=</span> <span class="s1">&#39;USER&#39;</span><span class="p">;</span></div><div class='line' id='LC32'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">BEGIN</span> <span class="c1">--validate username</span></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">SELECT</span> <span class="n">user_id</span></div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">INTO</span> <span class="n">uid</span></div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">FROM</span> <span class="n">applsys</span><span class="p">.</span><span class="n">fnd_user</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHERE</span> <span class="n">user_name</span> <span class="o">=</span> <span class="k">upper</span><span class="p">(</span><span class="n">uname</span><span class="p">);</span> <span class="c1">--do as I think, not as I type</span></div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">EXCEPTION</span></div><div class='line' id='LC38'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">WHEN</span> <span class="n">NO_DATA_FOUND</span> <span class="k">THEN</span></div><div class='line' id='LC39'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;ERROR: No userid found for &#39;</span> <span class="o">||</span> <span class="n">uname</span> <span class="o">||</span> <span class="s1">&#39;.&#39;</span><span class="p">);</span></div><div class='line' id='LC40'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">RETURN</span><span class="p">;</span> <span class="c1">--Whoops. Here&#39;s your bucket, bail away.</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">END</span><span class="p">;</span> <span class="c1">--validate username</span></div><div class='line' id='LC42'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span></div><div class='line' id='LC43'><br/></div><div class='line' id='LC44'>&nbsp;&nbsp;&nbsp;<span class="c1">--check for previously-set value</span></div><div class='line' id='LC45'>&nbsp;</div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;<span class="n">fnd_profile</span><span class="p">.</span><span class="n">get_specific</span><span class="p">(</span> <span class="n">name_z</span> <span class="o">=&gt;</span> <span class="n">prof_option</span></div><div class='line' id='LC47'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">user_id_z</span> <span class="o">=&gt;</span> <span class="n">uid</span></div><div class='line' id='LC48'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">val_z</span> <span class="o">=&gt;</span> <span class="n">prev_val</span></div><div class='line' id='LC49'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">defined_z</span> <span class="o">=&gt;</span> <span class="n">prev_val_defined</span></div><div class='line' id='LC50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span> </div><div class='line' id='LC51'>&nbsp;&nbsp;<span class="n">IF</span> <span class="k">NOT</span> <span class="n">prev_val_defined</span>  <span class="k">THEN</span> </div><div class='line' id='LC52'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="n">prof_option</span> <span class="o">||</span> <span class="s1">&#39; not previously defined&#39;</span><span class="p">);</span></div><div class='line' id='LC53'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--NOT prev_val</span></div><div class='line' id='LC54'><br/></div><div class='line' id='LC55'>&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="n">prev_val_defined</span> <span class="k">THEN</span></div><div class='line' id='LC56'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Previous value of &#39;</span> <span class="o">||</span> <span class="n">prof_option</span> <span class="o">||</span> <span class="s1">&#39;: &#39;</span> <span class="o">||</span> </div><div class='line' id='LC57'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">prev_val</span></div><div class='line' id='LC58'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC59'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--prev_val_defined</span></div><div class='line' id='LC60'><br/></div><div class='line' id='LC61'>&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="p">(</span><span class="k">NOT</span> <span class="n">override</span><span class="p">)</span> <span class="k">AND</span> <span class="n">prev_val_defined</span> <span class="k">THEN</span> <span class="c1">--do nothing</span></div><div class='line' id='LC62'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Skipping &#39;</span> <span class="o">||</span> <span class="n">prof_option</span> <span class="o">||</span> <span class="s1">&#39;, OVERRIDE=FALSE&#39;</span><span class="p">);</span></div><div class='line' id='LC63'>&nbsp;&nbsp;&nbsp;<span class="n">ELSIF</span> <span class="n">override</span> <span class="k">AND</span> <span class="p">(</span><span class="n">prev_val</span> <span class="o">=</span> <span class="n">prof_value</span><span class="p">)</span> <span class="k">THEN</span> <span class="c1">--do nothing</span></div><div class='line' id='LC64'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span> <span class="p">(</span><span class="s1">&#39;Skipping &#39;</span> <span class="o">||</span> <span class="n">prof_option</span> <span class="o">||</span> <span class="s1">&#39;, no change&#39;</span><span class="p">);</span></div><div class='line' id='LC65'>&nbsp;&nbsp;&nbsp;<span class="k">ELSE</span> <span class="c1">--try to set new profile</span></div><div class='line' id='LC66'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">set_result</span> <span class="p">:</span><span class="o">=</span> <span class="n">fnd_profile</span><span class="p">.</span><span class="n">save</span><span class="p">(</span> <span class="n">x_name</span> <span class="o">=&gt;</span> <span class="n">prof_option</span></div><div class='line' id='LC67'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x_value</span> <span class="o">=&gt;</span> <span class="n">prof_value</span></div><div class='line' id='LC68'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x_level_name</span> <span class="o">=&gt;</span> <span class="n">prof_level</span></div><div class='line' id='LC69'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">x_level_value</span> <span class="o">=&gt;</span> <span class="n">uid</span></div><div class='line' id='LC70'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC71'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">IF</span> <span class="n">set_result</span> <span class="k">THEN</span></div><div class='line' id='LC72'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span> <span class="s1">&#39;SUCCESS: Set &#39;</span> <span class="o">||</span> <span class="n">prof_option</span> <span class="o">||</span> <span class="s1">&#39; to &#39;</span> <span class="o">||</span> </div><div class='line' id='LC73'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">prof_value</span> </div><div class='line' id='LC74'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC75'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">COMMIT</span><span class="p">;</span> <span class="c1">--may want to move outside function for large batch updates</span></div><div class='line' id='LC76'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">ELSE</span></div><div class='line' id='LC77'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span> <span class="s1">&#39;FAILED to set &#39;</span> <span class="o">||</span> <span class="n">prof_option</span> <span class="o">||</span> <span class="s1">&#39; to &#39;</span> <span class="o">||</span> </div><div class='line' id='LC78'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">prof_value</span> </div><div class='line' id='LC79'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC80'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">dbms_output</span><span class="p">.</span><span class="n">put_line</span><span class="p">(</span><span class="s1">&#39;Check option name and value and try again&#39;</span><span class="p">);</span></div><div class='line' id='LC81'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">ROLLBACK</span><span class="p">;</span> <span class="c1">--For safety only; current implementation of</span></div><div class='line' id='LC82'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">--fnd_profile.save does not attempt a write before</span></div><div class='line' id='LC83'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">--returning false</span></div><div class='line' id='LC84'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--set_result</span></div><div class='line' id='LC85'>&nbsp;&nbsp;&nbsp;<span class="k">END</span> <span class="n">IF</span><span class="p">;</span> <span class="c1">--NOT override AND prev_val_defined </span></div><div class='line' id='LC86'><span class="k">END</span> <span class="n">set_ebs_profile</span><span class="p">;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1169354/2a04b582f051ee07026bf9a20df42676364c1eae/ebs_def_setprof.sql" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1169354#file_ebs_def_setprof.sql" style="float:right;margin-right:10px;color:#666">ebs_def_setprof.sql</a>
            <a href="https://gist.github.com/1169354">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

</p>
<p>Note that <code>set_ebs_profile</code> expects the internal name for a profile option, instead of the "user-readable" name you'd normally see in the Forms interface.  It's useful to become familiar with a query similar to the following.  Pay attention to the user_enabled_flag, or you might spend time wondering why your changes aren't sticking.</p>
<div id="gist-1169354" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*</span></div><div class='line' id='LC2'><span class="cm">  iprof.sql</span></div><div class='line' id='LC3'><span class="cm">  Contact: John Piwowar</span></div><div class='line' id='LC4'><span class="cm">  Purpose: List useful identifiers for EBS profile options</span></div><div class='line' id='LC5'><span class="cm">  Notes:  Prompts for fragment of responsibility name</span></div><div class='line' id='LC6'><span class="cm">*/</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><span class="n">col</span> <span class="n">prof_name</span> <span class="k">for</span> <span class="n">a40</span></div><div class='line' id='LC9'><span class="n">col</span> <span class="n">prof_code</span> <span class="k">for</span> <span class="n">a25</span></div><div class='line' id='LC10'><span class="n">col</span> <span class="n">user_enabled</span> <span class="k">for</span> <span class="n">a7</span></div><div class='line' id='LC11'><span class="n">col</span> <span class="n">resp_id</span> <span class="k">for</span> <span class="mi">999999</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="k">set</span> <span class="n">pagesize</span> <span class="mi">9999</span> <span class="n">verify</span> <span class="k">off</span></div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'><span class="k">select</span> <span class="n">profile_option_name</span> <span class="n">prof_code</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">t</span><span class="p">.</span><span class="n">user_profile_option_name</span> <span class="n">prof_name</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">,</span> <span class="n">o</span><span class="p">.</span><span class="n">user_enabled_flag</span> <span class="n">user_enabled</span></div><div class='line' id='LC18'>&nbsp;&nbsp;<span class="k">from</span> <span class="n">fnd_profile_options</span> <span class="n">o</span></div><div class='line' id='LC19'>&nbsp;&nbsp;<span class="k">join</span> <span class="n">fnd_profile_options_tl</span> <span class="n">t</span> <span class="k">using</span> <span class="p">(</span><span class="n">profile_option_name</span><span class="p">)</span></div><div class='line' id='LC20'>&nbsp;<span class="k">where</span> <span class="k">upper</span><span class="p">(</span><span class="n">t</span><span class="p">.</span><span class="n">user_profile_option_name</span><span class="p">)</span> <span class="k">like</span> <span class="k">upper</span><span class="p">(</span><span class="s1">&#39;%&amp;1%&#39;</span><span class="p">)</span></div><div class='line' id='LC21'>&nbsp;<span class="k">order</span> <span class="k">by</span> <span class="n">user_profile_option_name</span></div><div class='line' id='LC22'><span class="o">/</span></div><div class='line' id='LC23'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1169354/240c4babae47f2743da868a6e34ec1ee3342b3c3/iprof.sql" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1169354#file_iprof.sql" style="float:right;margin-right:10px;color:#666">iprof.sql</a>
            <a href="https://gist.github.com/1169354">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<pre class="brush: sql; title: ; notranslate">
APPS@R12VIS(11.1.0.7)&gt;@iprof &quot;OM: Debug&quot;

PROF_CODE	              PROF_NAME                                USER_EN
------------------------- ---------------------------------------- -------
ONT_DEBUG_LEVEL           OM: Debug Level                          Y
OE_DEBUG_LOG_DIRECTORY    OM: Debug Log Directory                  N
</pre>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/08/fun-with-ebs-api-i/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NOW they&#8217;re fixed&#8230;</title>
		<link>http://only4left.jpiwowar.com/2011/06/now-theyre-fixed/</link>
		<comments>http://only4left.jpiwowar.com/2011/06/now-theyre-fixed/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 07:00:55 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[Oracle RDBMS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[stats]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/06/now-theyre-fixed/</guid>
		<description><![CDATA[A short demonstration of how incorrect fixed object stats can really bog down an E-Business Suite instance startup.]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/06/now-theyre-fixed/" size="small" count="true"></div></div><p>A few of our test EBS instances had developed a well-deserved reputation of taking a long time to start up. Here’s what we saw:</p>
<ol>
<li>Database ground to a near-halt shortly after running adstrtal.sh</li>
<li>Most concurrent manager processes were being marked as “dead” in the internal manager log not long after startup, and the internal manager attempted to restart them.</li>
<li>Consequence of #2: Three to four times as many FNDLIBR processes running on the app tier server as expected.</li>
<li>Consequence of #2 and #3: The “Active sessions” graph in Grid Control resembled Mt. Kilimanjaro, and all three database server load average numbers (1, 5, and 15-minute) on were over 100.</li>
</ol>
<p>Needless to say, neither users (who could not connect to the test instance), developers (who could not connect to the Apps database), nor DBAs (who had to answer endless “when will the instance be up?” emails) were very happy.</p>
<p>The culprit? This little query, executed for each FNDLIBR process as it started up, generating a ridiculous number of “control file sequential read” waits along the way:</p>
<pre class="brush: sql; title: ; notranslate">
SELECT count(*)
  FROM v$thread;
</pre>
<p>When I took a closer look at the query, this is what I found:</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; select /*+ gather_plan_statistics */ count(*)
  2  from v$thread;

  COUNT(*)
----------
         2                                                                                                              

Elapsed: 00:00:11.17
SQL&gt;  select *
  2  from table(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST'));

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
SQL_ID  057v054v2svhp, child number 0
-------------------------------------
select /*+ gather_plan_statistics */ count(*) from v$thread                                                             

Plan hash value: 3150894624                                                                                             

------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                 | Name            | Starts | E-Rows | A-Rows |   A-Time   |  OMem |  1Mem | Used-Mem |
------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT          |                 |      1 |        |      1 |00:00:11.16 |       |       |          |
|   1 |  SORT AGGREGATE           |                 |      1 |      1 |      1 |00:00:11.16 |       |       |          |
|   2 |   NESTED LOOPS            |                 |      1 |      1 |      2 |00:00:00.37 |       |       |          |
|   3 |    MERGE JOIN CARTESIAN   |                 |      1 |      1 |   3969 |00:00:00.17 |       |       |          |
|*  4 |     FIXED TABLE FULL      | X$KCCTIR        |      1 |      1 |     63 |00:00:00.09 |       |       |          |
|   5 |     BUFFER SORT           |                 |     63 |      1 |   3969 |00:00:00.08 | 73728 | 73728 |          |
|   6 |      FIXED TABLE FULL     | X$KCCCP         |      1 |      1 |     63 |00:00:00.05 |       |       |          |
|*  7 |    FIXED TABLE FIXED INDEX| X$KCCRT (ind:1) |   3969 |      1 |      2 |00:00:11.00 |       |       |          |
------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------                                                                     

   4 - filter(&quot;TR&quot;.&quot;INST_ID&quot;=USERENV('INSTANCE'))
   7 - filter((&quot;RT&quot;.&quot;INST_ID&quot;=USERENV('INSTANCE') AND &quot;RTNLF&quot;&lt;&gt;0 AND &quot;TIRNUM&quot;=&quot;RTNUM&quot; AND &quot;CPTNO&quot;=&quot;RTNUM&quot;))
</pre>
<p>That’s a lot of work to do for 2 rows.  Clearly the internal manager was expecting a faster start time from its children, which explains why it kept attempting to start new ones. Repeatedly. Until we had over 200 FNDLIBR processes running instead of our expected 80-ish.</p>
<p>After gathering fixed object statistics, the query behaved a bit better, and we therefore expect that our “slow to awaken” instance should be a bit more speedy:</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; exec dbms_stats.gather_fixed_objects_stats

PL/SQL procedure successfully completed.

Elapsed: 00:03:11.45
SQL&gt; select /*+ gather_plan_statistics */ count(*) from v$thread
  2  ;

  COUNT(*)
----------
         2                                                                                                              

Elapsed: 00:00:00.03
SQL&gt;  select *
  2  from table(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST'));

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------
SQL_ID  f1pmbmcstp1rj, child number 0
-------------------------------------
select /*+ gather_plan_statistics */ count(*) from v$thread                                                             

Plan hash value: 93051267                                                                                               

-----------------------------------------------------------------------------------------------
| Id  | Operation                  | Name             | Starts | E-Rows | A-Rows |   A-Time   |
-----------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT           |                  |      1 |        |      1 |00:00:00.02 |
|   1 |  SORT AGGREGATE            |                  |      1 |      1 |      1 |00:00:00.02 |
|   2 |   NESTED LOOPS             |                  |      1 |      2 |      2 |00:00:00.02 |
|   3 |    NESTED LOOPS            |                  |      1 |      2 |      2 |00:00:00.01 |
|   4 |     FIXED TABLE FULL       | X$KCCRT          |      1 |      2 |      2 |00:00:00.01 |
|   5 |     FIXED TABLE FIXED INDEX| X$KCCCP (ind:1)  |      2 |      1 |      2 |00:00:00.01 |
|   6 |    FIXED TABLE FIXED INDEX | X$KCCTIR (ind:1) |      2 |      1 |      2 |00:00:00.02 |
-----------------------------------------------------------------------------------------------
</pre>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/06/now-theyre-fixed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LISP</title>
		<link>http://only4left.jpiwowar.com/2011/06/oracle-ebs-diagnostics-quirks-11i/</link>
		<comments>http://only4left.jpiwowar.com/2011/06/oracle-ebs-diagnostics-quirks-11i/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 07:00:17 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[esoterica]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/06/oracle-ebs-diagnostics-quirks-11i/</guid>
		<description><![CDATA[<p>After my recent public demo of the Oracle E-Business Suite Diagnostics, people at my current employer are more interested in using the tool. In the course of applying the most recent patches to the IZU product, I came across a few quirks that I thought I'd share. These are 11i-related issues, so the relevance half-life is short.</p>]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/06/oracle-ebs-diagnostics-quirks-11i/" size="small" count="true"></div></div><p>After my <a href="http://only4left.jpiwowar.com/2011/05/presentation-slides-using-oracle-ebs-diagnostics/" title="Oracle EBS Diagnostics talk">recent public demo</a> of Oracle E-Business Suite Diagnostics, people at my current employer are more interested in using the tool. In the course of applying the most recent patches to the IZU product, I came across a few quirks that I thought I'd share. Please note that these are 11i-related issues, so the relevance half-life is short.</p>
<p>First, if you have the right combination of patches, you may find that wildcard searches for input fields no longer work. We first noticed this behavior last fall, after applying the July 2010 CPU patch. The workaround is to search without wildcards (just leave the field blank), though that can get unwieldy for large result sets. This issue was recently added to Note <a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=235307.1#2_94">235307.1</a>, which states that there is no known solution at this time, but if you're running 11i, patch <a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=1004979">1004979</a> resolves the problem. Note that this is an AD patch, not an IZU patch, but the payload is pretty light.</p>
<p>I also discovered, after applying all of the latest patches for 11i Diagnostics, that some test submissions were failing with "Page not found" errors. The corresponding errors in the Apache logs looked like:</p>
<pre class="brush: plain; title: ; notranslate">
[Fri Feb 31 16:12:74 1942] [error] [client xx.xx.xx.x] mod_security: Access denied with code 400.
Pattern match &quot;!^([-_@|#!=A-Za-z0-9/ :.$]){0,255}([-_@|#!=A-Za-z0-9/ :.$]){0,255}$&quot; at ARGS_NAMES.
[hostname &quot;fakehost.goofynet.org&quot;] [uri &quot;/OA_HTML/jtfqaadv.jsp&quot;] [unique_id TfKkxAoAZtUQAHE3Eeg]
</pre>
<p>The ARGS_NAMES filter in IAS_ORACLE_HOME/Apache/Apache/conf/security.conf, intended to filter out potentially-nasty values in URLs, looks like this:</p>
<pre class="brush: plain; title: ; notranslate">
SecFilterSelective ARGS_NAMES &quot;!^([-_@|#!=A-Za-z0-9/ :.$]){0,255}([-_@|#!=A-Za-z0-9/ :.$]){0,255}$&quot;
</pre>
<p>That looks like a reasonably permissive list, but there are (two) ((very)) (((important))) ((((characters)))) (((((missing))))). Any test with parentheses in the input field names (yes, the names of the fields, not the values) will fail this filter, leading to the errors described about. In my case, I was looking at AOL setup tests, and a few of them have "Timeout (seconds)" fields.</p>
<p>A My Oracle Support search turns up a patch that is supposed to fix this problem (<a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=10324904">10324904</a>), but the tests I was running did not receive updates in that patch; the parentheses were still in the field names. During a short consultation with support, I was reminded of the chances (low) that a minor bug logged against 11i Diagnostics would get very much attention at this point in the product lifecycle. Instead, I deployed the workaround described in Note <a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=1313128.1">1313128.1</a>. While the note states that changes to the ARGS_NAMES filter will not survive AutoConfig runs, it's easy enough to make the changes stick by creating a custom template for security_ux_ias1022.conf in FND_TOP/admin/template/custom, and changing the ARGS_NAMES filter as follows:</p>
<pre class="brush: plain; title: ; notranslate">
SecFilterSelective ARGS_NAMES &quot;!^([-_@|#!=A-Za-z0-9/ ():.$]){0,255}([-_@|#!=A-Za-z0-9/ :.$]){0,255}$&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/06/oracle-ebs-diagnostics-quirks-11i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Apps DBAs, have you empowered your users?</title>
		<link>http://only4left.jpiwowar.com/2011/05/apps-dbas-empower-your-users/</link>
		<comments>http://only4left.jpiwowar.com/2011/05/apps-dbas-empower-your-users/#comments</comments>
		<pubDate>Mon, 30 May 2011 07:00:23 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[R12]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/05/apps-dbas-empower-your-users/</guid>
		<description><![CDATA[<p>A little bit of preachiness about the value of the Oracle E-Business Suite Diagnostics product. Hopefully, you're using it. Actually, if you're an Apps DBA, hopefully your <i>users</i> are using it</p>
]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/05/apps-dbas-empower-your-users/" size="small" count="true"></div></div><p>Last week, I <a href="http://only4left.jpiwowar.com/2011/05/presentation-slides-using-oracle-ebs-diagnostics/" title="Oracle EBS Diagnostics talk">gave a talk</a> to my local Oracle Applications User Group about the value of the <a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=342459.1" title="Oracle EBS Diagnostics overview">Oracle E-Business Suite Diagnostics</a> product (IZU). Feedback was positive, though I was still somewhat surprised that I'd been asked to discuss the topic in the first place. I've been a fan of the tool since 2006, so I've fallen into the trap of assuming that everyone knows about it already. My audience was primarily business analysts and privileged end-users, so I didn't get into technical nuts and bolts, not that there are very many. My general message was, "Here's a free tool from Oracle to help you track down EBS problems in your area of responsibility, all within the scope of the system privileges you already have."</p>
<p>For Apps DBAs, the same message applies: It benefits you to provide this easy-to-configure, easy-to-use EBS product to your business analysts and "Power Users." They'll get access to diagnostic tests that will help them to identify problems and potential solutions (with period close, errant sales orders, wayward invoices, stuck workflows, etc) before they even have to involve Oracle Support. This, in turn, can engender a sense of ownership and understanding of the working of the EBS products.</p>
<p>If the warm fuzzies derived from having empowered users aren't quite enough to motivate installing EBS Diagnostics, how about some enlightened misanthropy? With EBS Diagnostics, properly trained and encouraged users may be more likely to <i>leave you alone</i>. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Consider the usual opening salvo from Oracle Support when an EBS service request is raised:</p>
<ol>
<li>"Please run ACT/RDA/Diagnostic Apps Check for the product in question and upload the results"</li>
<li>"What database version/applications version/product patchset are you running?"</li>
<li>"What version of file X is installed on your system?"</li>
<li>"Have you applied any patches recently?</li>
<li>"Please check the value of profile option Y"</li>
</ol>
<p>Ordinarily, unless you have <i>very</i> lax security rules, answering these questions (except for #5, and maybe #2) requires input from a DBA, sysadmin, or someone else with privileged access to the system (via OAM, or ad-hoc database queries). Anyone with access to EBS Diagnostics, however, can run the RDA report (see #1 above) for an EBS product and answer all of those questions:</p>
<p><i><br />
<img src="http://only4left.jpiwowar.com/wp-content/uploads/2011/05/EBSACTReportSummary.png" width="480" height="323" alt="EBS Diagnostics ACT Report Summary section" title="EBS Diagnostics ACT Report Summary section" /></i></p>
<p><i>(Yes, that's a screenshot from 11i, because that's the version I used for my talk. R12 looks much the same, just bluer).</i></p>
<p>Maybe I'm preaching to the choir here, but I do still find people who either don't know about EBS Diagnostics, or don't see the value of the tool. If you've not done so already, you owe it to yourself to take a look at the Diagnostics product, starting with <a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=167000.1" title="E-Business Suite Diagnostics Installation Guide ">Note 167000.1: E-Business Suite Diagnostics Installation Guide</a> . Put the tools in your users' hands, and see what happens. Sure, some of them might still just throw things over the wall to you, but others will undoubtedly surprise you.</p>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/05/apps-dbas-empower-your-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presentation slides: Using Oracle EBS Diagnostics</title>
		<link>http://only4left.jpiwowar.com/2011/05/presentation-slides-using-oracle-ebs-diagnostics/</link>
		<comments>http://only4left.jpiwowar.com/2011/05/presentation-slides-using-oracle-ebs-diagnostics/#comments</comments>
		<pubDate>Thu, 26 May 2011 06:56:50 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[presentations]]></category>
		<category><![CDATA[R12]]></category>
		<category><![CDATA[references]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/?p=450</guid>
		<description><![CDATA[I somehow got roped into giving a presentation at the BC Oracle Applications User Group meeting on May 26, on the topic of Using Oracle E-Business Suite Diagnostic Tools. Moment of weakness, I guess, but with less than 12 hours to go, it'd be very bad form to bail now. The talk itself is mostly [...]]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/05/presentation-slides-using-oracle-ebs-diagnostics/" size="small" count="true"></div></div><p>I somehow got roped into giving a presentation at the <a href="http://bcoaug.oaug.org">BC Oracle Applications User Group</a> meeting on May 26, on the topic of Using Oracle E-Business Suite Diagnostic Tools.  Moment of weakness, I guess, but with less than 12 hours to go, it'd be very bad form to bail now. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>The talk itself is mostly a demo, and the slides all by themselves don't convey the full impact of me talking too fast, talking too much, screwing up the timing on my jokes, involuntarily edging toward the door, and muttering prayers to whatever god is tuned in that my demo VM doesn't misbehave too badly.  Nevertheless, there are a few references linked in the slides (whose brilliant idea was <i>that</i>?), and I'll be promising my audience that they can visit my blog to find the slides.</p>
<p>Thanks to the members of the BCOAUG for the hospitality!  Hope I didn't bore too many of you to death. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   You can find the slides on <a href="http://www.slideshare.net/jpiwowar/using-oracle-ebusiness-suite-diagnostics">Slideshare</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/05/presentation-slides-using-oracle-ebs-diagnostics/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why merge EBS patches?</title>
		<link>http://only4left.jpiwowar.com/2011/03/why-merge-ebs-patches/</link>
		<comments>http://only4left.jpiwowar.com/2011/03/why-merge-ebs-patches/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 07:01:01 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[patching]]></category>
		<category><![CDATA[R12]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/03/why-merge-ebs-patches/</guid>
		<description><![CDATA[“Everyone knows” that merging E-Business Suite patches is a good idea. It should be the number one, first-pass answer to the question of how to speed up patching, before staged APPL_TOP, distributed AD, database tuning, or even adding more workers. As part of my continuing series, “Captain Obvious over-explains the basics,” I've provided an anecdote to illustrate <i>why</i> merging patches is a good idea.]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/03/why-merge-ebs-patches/" size="small" count="true"></div></div><h3>We already know this stuff, right?</h3>
<p>“Everyone knows” that merging E-Business Suite patches is a good idea. It should be the number one, first-pass answer to the question of how to speed up patching, before staged APPL_TOP, distributed AD, database tuning, or even adding more workers. As part of my continuing series, “Captain Obvious over-explains the basics,” I've provided an anecdote to illustrate <i>why</i> merging patches is a good idea.</p>
<h3>First things first</h3>
<p>A few short notes about when you should and should not merge E-Business Suite patches, and a disclaimer:</p>
<ul>
<li>Don't merge AD patches with non-AD patches. AD patches sometimes change the same utilities that you're using to apply patches, and should be addressed separately from other product patches.</li>
<li>Don't merge a patch if Oracle says that you shouldn't. It's rare that this will happen, but you still need to study your READMEs carefully.</li>
<li>Don't merge patches across codelines (11.5.x, 12.0, 12.1).</li>
<li>Other than that, go nuts. Seriously. There's no reason you can't merge, for example, HR, Inventory, and Order Management patches. You'd be surprised how many of the same files and patch actions are delivered with patches for separate, functionally distinct products.</li>
<li>Your results may not be as dramatic as what I'm describing in this post. Patch payloads differ, systems differ.</li>
</ul>
<h3>Save time before the work even starts</h3>
<p>The larger the set of patches you have to apply, the more potential benefit you'll derive from merging the patches. A good example of a large patching exercise is the application of Extended Support baseline patches for EBS 11.5.10.2. I ended up with 123 patches to apply across multiple products, from rollups to family packs, with all of their small-to-mid-size pre-requisites. That’s a lot of work. So much work, in fact, that running the merged patch in noapply mode took 23 minutes:</p>
<pre class="brush: plain; title: ; notranslate">
[applmgr@testsrv log]$ grep ‘AutoPatch started’ u_baseline_final.log
AutoPatch started at: Thu Mar 03 2011 15:27:45
[applmgr@testsrv log]$ ls -l u_baseline_final.log
-rw-r—r— 1 applmgr oinstall 10390236 Mar 3 15:50 u_baseline_final.log
</pre>
<p>That's serious "think time" for what amounts to a long sequence of file version checks. But if you if you think <i>that’s</i> bad, watch what happened when I tried to run those patches in noapply mode individually. FWIW, the alias <code>testpatch_this</code> runs adpatch with a defaults file and apply=no, so I could get a timing run free of waits for user intervention.</p>
<pre class="brush: plain; highlight: [3]; title: ; notranslate">
[applmgr@testsrv baseline_src]$ time for i in `ls`; do cd $i; testpatch_this; cd ..; done
&lt;lots of patch files later…&gt;
real 135m5.485s
user 19m31.403s
sys 5m41.994s
</pre>
<h3>Fewer decisions = less work to do</h3>
<p>So, where did the time savings come from? The <code>admrgpch</code> utility does a pretty simple job. It:</p>
<ol>
<li>Unzips all the patches to be merged</li>
<li>Parses the individual patch driver files and to identify the actions required by the patch</li>
<li>Merges actions from the current patch driver file with those of previously-parsed patches based on file version</li>
<li>Copies the required files to the new merged patch directory</li>
<li>Assembles the necessary patch actions into a new merged patch driver file, based on on the contents of the individual driver files</li>
</ol>
<p>Step 3 is where we saved nearly 2 hours. Here's a summary of the results of all of the merging and version-checking:</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; select count(1) comparisions
  2  from patch_comps
  3  /

COMPARISIONS
------------
      190038

SQL&gt; select merge_action
  2       , count(1) as file_count
  3    from patch_comps
  4   group by merge_action
  5   order by merge_action
  6  /

MERGE_ACTI FILE_COUNT
---------- ----------
addnew		96925
addnover	11243
newer		14481
older		15257
same		50056
skipnover	 2076

6 rows selected.
</pre>
<p>There were just over 190000 potential files in our merged patch, accounting for at least one action each -- sometimes more, since there are forms to be generated, PL/SQL to be compiled, and executables to link after the files are copied into place. Along the way, <code>admrgpch</code> discarded 65000 files with the same or older version, and replaced 14000 with more recent versions. There's some repetition in the 'newer' and 'addnover' categories, but the rough result in this case is that close to 80000 of the possible files in this collection of patches have been discarded before adpatch is even run. No matter how fast your system is, if you hand it a pile of work that's 40% lighter than it could be, you can probably expect to finish a bit sooner.</p>
<h3>But wait, there's more! (sort of)</h3>
<p>In this case, merging patches has already saved us some significant time just in terms of cutting down the evaluation work that needs to be done at patch time. It's also interesting to look a bit more closely at the individual patch actions that are being culled.  After all, if all we're doing is preventing several thousand files from being copied to the OA_HTML directory, well...it's <i>nice</i>, but not exactly compelling.  If we can save time in the relinking and forms and reports generation phases, on the other hand, that's more real work that can be avoided.  There's a small caveat here, of course: some of this "saved work" might be avoided by adpatch anyway, if the forms/reports to be generated are older than what's already on the system.  Still, why relink a bunch of executables 20 times in one patch session, when once will do?  </p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; select patch_action
  2       , repeats
  3       ,  count(1) as file_count
  4       , repeats*count(1) as duplicates
  5        from
  6	   ( select filename
  7		      , patch_action
  8		      , count(1) - 1 as repeats
  9	       from patch_actions
 10	      where patch_action in ('genform','genrep', 'link')
 11	      group by filename, patch_action
 12	   )
 13   group by patch_action, repeats
 14   order by patch_action desc, repeats desc
</pre>
<pre>
PATCH_ACTION				    REPEATS FILE_COUNT DUPLICATES
---------------------------------------- ---------- ---------- ----------
link						 25	     2	       50
						 24	     9	      216
						 23	    33	      759
						 22	   313	     6886
						 21	     6	      126
						 19	     1	       19
						 15	     1	       15
						 13	     3	       39
						 12	     1	       12
						 11	     2	       22
						  4	     2		8
						  3	     8	       24
						  2	     2		4
						  1	     2		2
						  0	     4		0
****************************************		       ----------
Total Dups							     8182

genrep						 18	     1	       18
						  8	     1		8
						  4	     1		4
						  3	     3		9
						  2	    19	       38
						  1	   421	      421
						  0	   379		0
****************************************		       ----------
Total Dups							      498

genform 					 21	    13	      273
						 20	    12	      240
						 19	    53	     1007
						 17	     4	       68
						 15	     6	       90
						 14	     1	       14
						 10	   119	     1190
						  9	     1		9
						  7	     1		7
						  6	     5	       30
						  5	    21	      105
						  4	   107	      428
						  3	    77	      231
						  2	   394	      788
						  1	   742	      742
						  0	  1245		0
****************************************		       ----------
Total Dups							     5222
</pre>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/03/why-merge-ebs-patches/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing EBS 11.5.10.2 Vision?  Quick list of useful links.</title>
		<link>http://only4left.jpiwowar.com/2011/03/vision-11-5-10-2-notes/</link>
		<comments>http://only4left.jpiwowar.com/2011/03/vision-11-5-10-2-notes/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 08:01:01 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[11i]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[references]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/03/vision-11-5-10-2-notes/</guid>
		<description><![CDATA[<p>A short list of references for installing E-Business Suite Vision 11.5.10.2 on Oracle Enterprise Linux 5.  Hopefully this isn't actually useful to anyone, because why would you really want to do that these days?</p>
]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/03/vision-11-5-10-2-notes/" size="small" count="true"></div></div><p>My EBS 11i Vision VM bit the dust recently, and I found myself needing to reinstall. I know, yes, backups. I <b>know</b>, okay? I KNOW. I <i>know</i>. *whimper*</p>
<p>Anyhow, time to party like it's mid-2005! This isn't going to be as super-long as my R12 Vision install series (which is now an <a href="http://www.oraclenerd.com/2011/02/ebs-install-guide-ebook.html" title="EBS R12--the Book">eBook</a> that you should <a href="http://only4left.jpiwowar.com/2011/02/r12-install-ebook/" title="R12 Ebook">totally buy</a>). Instead, it's a quick list of links to help you get started on something you'll hopefully only need to do once, if ever. At least I now have public notes in case, heaven forfend, I need to do this again myself. Please note that these links are biased toward an installation on Oracle Enterprise Linux 5, because that's the 32-bit Linux media I had closest to hand. There are a few quirks when installing on OEL5, but thankfully they're all well-documented.</p>
<h2>Start with the basics</h2>
<dl>
<dt><a href="http://download.oracle.com/docs/cd/B25284_01/current/acrobat/r115102ins.pdf" title="11i CU2 Rapid Install Guide">Installing Oracle Applications: A Guide to Using Rapid Install Release 11i (11.5.10.2)</a></dt>
<dd>Just in case you need a refresher on system resource requirements and various other setup bits.</dd>
<dt><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=316803.1" title="Oracle Applications Release Notes, Release 11i (11.5.10.2) ">Note 316803.1: Oracle Applications Release Notes, Release 11i (11.5.10.2)</a></dt>
<dd>Not a lot of meat here, but it does provide a reference to the most recent Rapid Install/"startCD" patch, in the unlikely event that it changes. Don't hold your breath; the product's in Extended Support, and the release notes document hasn't been updated in 2 years.</dd>
<dt><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=316806.1" title="Oracle Applications Installation Update Notes, Release 11i (11.5.10.2) ">Note 316806.1: Oracle Applications Installation Update Notes, Release 11i (11.5.10.2)</a></dt>
<dd>Here's the really useful stuff, listing required kernel versions, OS packages, and special instructions for various OS releases. The information in this note gets you 95% of what's needed to do the install. Make sure to apply patches 6365595 and 6078836, to avoid errors on "afmkinit.sh INSTE8_SETUP 127" and "libdb.so.3: cannot open shared object file," respectively.</dd>
<dt><a href="https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=4366832" title="11.5.10.2 StartCD Patch">Most recent Rapid Install patch</a></dt>
<dd>Why go digging through the release notes for the patch number?</dd>
<dt><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=316843.1" title="MD5 Checksums for 11i10.2 Rapid Install Media ">Note 316843.1: MD5 Checksums for 11i10.2 Rapid Install Media</a></dt>
<dd>Just in case you think your old disk-based staging area may be suspect, and you're wondering if you need to go back to the install DVDs. You know, theoretically.</dd>
</dl>
<h2>OEL5-specific stuff</h2>
<dl>
<dt><a href="http://public-yum.oracle.com/" title="Oracle Linux nom-nom-nom">Setup for Oracle's public YUM server</a></dt>
<dd>You might need this setup to download additional packages, if you don't want to search your install media.</dd>
<dt><a href="http://oss.oracle.com/projects/compat-oracle/files/Enterprise_Linux/" title="Oracle compatibility RPMs">Oracle Open-source "compatibility" project</a></dt>
<dd>This is where to grab the additional required RPMs listed in note 316806.1. If you're wondering where to find binutils 2.15, it's in compat-binutils215-2.15.92.0.2-24.i386.rpm.</dd>
<dt><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=730444.1" title="Oracle Applications 11i Installation on OEL5 or RHEL5 ">Note 730444.1: Oracle Applications 11i Installation on OEL5 or RHEL5</a></dt>
<dd>This note provides solutions to a pair of quirks related to installation on OEL5.</dd>
<dt><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=451994.1" title="Unable to Find 'kshell' in Path When Running adcfgclone.pl ">Note 451994.1: Unable to Find 'kshell' in Path When Running adcfgclone.pl</a></dt>
<dd>Rather than chasing down and installing pdksh, as suggested in Note 730444.1, I found that a simple <code>export KSH_VERSION='@(#)PD KSH v5.2.14 99/07/13.2'</code>, as suggested in this note, to be sufficient to satisfy the installer's requirements.</dd>
<dt><a href="https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=747424.1" title="Installation of 11.5.10.2 On OEL Fails ">Note 747424.1: Installation of 11.5.10.2 On OEL Fails</a></dt>
<dd>To avoid an interruption in the installation process, use the steps described in this note (replacing LD_ASSUME_KERNEL in adgetlnxver.sh) before running the zip commands described in the pre-installation tasks for patch 6365595 in Note 316806.1. Depending on your version of OEL, this may not be necessary, but why risk it?</dd>
</dl>
<p>Thanks for joining me on this trip down memory lane. Please return your Wayback Machines, Deloreans, and telephone booths to their assigned places. Be excellent to each other.</p>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/03/vision-11-5-10-2-notes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>EBS R12 Vision Install Guide is now an eBook (for Kate)</title>
		<link>http://only4left.jpiwowar.com/2011/02/r12-install-ebook/</link>
		<comments>http://only4left.jpiwowar.com/2011/02/r12-install-ebook/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 05:25:50 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[R12]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2011/02/r12-install-ebook/</guid>
		<description><![CDATA[<p>The EBS R12 Install Guide is now an eBook, on sale to benefit ORACLENERD's daughter, Kate.</p>
]]></description>
			<content:encoded><![CDATA[<div class="none"><div class="g-plusone" data-href="http://only4left.jpiwowar.com/2011/02/r12-install-ebook/" size="small" count="true"></div></div><p><a href="http://www.oraclenerd.com/2011/02/ebs-install-guide-ebook.html" title="ORACLENERD">Chet</a> and <a href="http://theappslab.com/2011/02/14/the-ebs-install-guide-book/" title="The AppsLab">Jake</a> have both already covered this topic, but please allow me the small conceit that someone out there might read about it here first. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  About a year ago, I wrote a series of guest posts for the <a href="http://www.oraclenerd.com/2009/12/ebs-install-guide-part-1.html" title="EBS R12 install guide">ORACLENERD</a> blog about installing a Vision instance of Oracle E-Business Suite Release 12. It proved to be inexplicably popular, and even spawned something Chet called the <a href="http://www.oraclenerd.com/2009/12/ebs-challenge.html" title="The EBS Challenge! Woo!">EBS Challenge</a>, so Chet and I have bundled the whole series together into a PDF document that flows a bit better than a handful of posts spread over two blogs. Same quirky style, same nigh-endless stack of highly informative screenshots, but way less clicking, and you can take it with you!</p>
<h2>Donationware</h2>
<p>I was initially resistant to asking people to pay for content that I'd already made available for free, even considering the value-add of content restructuring and packaging. When we considered a charitable angle, though, I was all in. If you're a regular reader of Chet's blog, you'll know that one of the primary passions in his life is his daughter, <a href="http://www.oraclenerd.com/search/label/kate" title="Katezilla! Rawr!">Kate</a>, who has been diagnosed with <a href="http://www.autismspeaks.org/navigating/pdd_nos.php" title="Pervasive Developmental Disorder - Not Otherwise Specified">PDD-NOS</a>. All proceeds from sales of the eBook, after Paypal takes their cut, will be directed to defraying the costs of Kate's care.</p>
<p>If you're interested in building your very own R12 E-Business Suite playground, I hope you'll consider <a href="http://www.oraclenerd.com/2011/02/ebs-install-guide-ebook.html" title="EBS R12--the Book">picking up a copy</a> of the PDF version of the guide. If you're one of the thousands (that's still a bit mind-boggling) of people who have already read the guide on Chet's blog, and if you derived some value from the experience, I hope you'll consider <a href="http://www.oraclenerd.com/2011/02/ebs-install-guide-ebook.html" title="EBS R12--the Book">buying a copy</a> to show your appreciation. Heck, buy a copy for everyone in your office! Think of it as an opportunity to make a direct contribution to making life easier for Kate and her parents. You even get a chance to "try before you buy;" all the content in the eBook is already available for you to review on our blogs. I probably left in the same embarrassing typos and bad grammar. You can't lose, and if you buy, Kate wins.</p>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2011/02/r12-install-ebook/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

