Sunday, 14 April 2013

Oracle Handy script: copy schemas

select 'CREATE USER '|| username||' IDENTIFIED by '||username ||' DEFAULT TABLESPACE TBS_1 TEMPORARY TABLESPACE TEMPTS1 PROFILE DEFAULT  ACCOUNT UNLOCK;',
  ' GRANT CONNECT TO '|| username||';',
  ' GRANT RESOURCE TO '|| username||';',
  ' GRANT UNLIMITED TABLESPACE TO '|| username||';',
  ' GRANT ALTER SESSION TO '|| username||';',
  ' GRANT CREATE SESSION TO '|| username||';',
' imp system/sys file=/oradata/AEMEDB/AEMEDB_FULL_14042013.dmp  fromuser='|| username||' touser='|| username||';'
 from dba_users
 order by created desc;




Friday, 12 April 2013

Oracle Advanced Queues and Streams: A Definition in Plain English

A mathematician, an accountant and an economist apply for the same job. The interviewer calls in the mathematician and asks "What do two plus two equal?" 

The mathematician replies "Four." 

The interviewer asks "Four, exactly?" The mathematician looks at the interviewer incredulously and says "Yes, four, exactly." 

Then the interviewer calls in the accountant and asks the same question "What do two plus two equal?" The accountant says "On average, four - give or take ten percent, but on average, four." 

Then the interviewer calls in the economist and poses the same question "What do two plus two equal?" 

The economist gets up, locks the door, closes the shade, sits down next to the interviewer and says "What do you want it to equal?" 

And now for something completely different: 

What is AQ? Advanced Queues, or AQ, is Oracle's messaging solution. AQ provides a persistent (or non-persistent for specialty apps) queue mechanism that can guarantee delivery of a message. It has interfaces to PL/SQL, OCI and Java. It's Oracle's answer to IBM's MQ Series. 

A message can be an XML document, a set of fields, an array of data and just about anything else you can think of. 

AQ works on a publish/subscribe model. That means that someone (a publisher puts a message on the queue and someone else (a subscriber) takes the message off. A queue can have multiple subscribers. Technically it can have multiple publishers but I haven't worked with that configuration and I'm not sure what the usefulness of that is. I think I would prefer multiple queues, one for each publisher. 

What's AQ good for? What does it do? 

One example would be replication. In Oracle Advanced Replication, AQ is the mechanism that copies data from one instance to another. The master site (publisher) will receive an update, it puts the update and a before and after image of the data in a queue. The slave sites (Subscribers) pull the data off the queue and apply them to the local database. The before and after images are used by replication to find the correct record and see if there are any update conflicts. 

Besides Oracle replication, or your own home-grown replication, there are a lot of other uses for AQ. 

You can drop a message on a queue for local usage. Say if you have a transactional system and are getting backed up but don't want to turn away incoming transactions. You can implement a queue. The receiving procedure can drop the transactions on the queue and a local de-queue procedure in the background can pull them off when it has time. 

You can use AQ to interface with Java. AQ supports the Java Messaging Specification (JMS) API. Using Java, XML and AQ you can easily implement a SOA (service oriented architecture) web service. 

What is Streams? Here's a brief description of streams and what you can use it for. 

AQ and Replication both entail data movement. Streams is the current technology enabling that data movement. Streams is kind of like AQ, but with rules applied. 

Let's think about AQ. AQ is basically a table and some table maintenance code wrapped around streams. When you enqueue a record, you're using AQ. Streams takes over and moves it to the next database, enqueueing it locally. AQ then takes over again, dequeuing it for consumption. 

Streams has some nice features. I think the most important is the rule based transformations. A transformation allows you to modify the payload in flight. A receiving application doesn't need to be aware of the sending applications formats, it just receives what it needs. 

Think of the way mainframes send data down to a data warehouse. The mainframe doesn't send entire vsam files down to let the warehouse figure out what pieces it needs. The warehouse group defines the fields it needs, a mainframe programmer writes a Cobol (maybe) program and sends a new, specific file down. 

With streams, the receiving application can define what it needs and the sending application can define rules to match. The nice thing with streams is that there can be multiple consumers receiving the same payload but have different rules applied for them. The sender sends one payload and it's transformed many times in different ways for multiple consumers. Rules are also easily defined as opposed to writing a program, scheduling a batch processing window, writing a load routine, etc. With streams, identify the source, define the rules and write a consumer dequeue. 

Speaking of data warehouses, another use of streams is in change data capture (CDC). You identify a source object, say your transaction detail table in the oltp system. You can create a rule that says capture all transactions that are approved and billable. Define the billing warehouse as a consumer for that stream. That payload can be applied to a staging table for loading into a warehouse table. The apply to the staging table can be done without coding. With almost 0 lines of code you can move the data you want, i.e. billable items, from your oltp system directly to your warehouse. 

Streams is also non-stressful to the source database. Streams reads the redo-logs and gathers information from that as opposed to running queries or DML against the source database's tables. 

Streams and AQ are both pretty fascinating technologies. And there is a lot more to them than I speak about here. In the near future I want to show how to do some setup and build a little application using CDC. If you're using AQ in 10g, then you're already using streams behind the scenes. I think that's the hallmark of good technology; it makes life easier and you never have to see it. 

Source: http://it.toolbox.com/blogs/oracle-guide/advanced-queues-and-streams-a-definition-in-plain-english-3677

Tuesday, 9 April 2013

Unix: VI search and replace command examples



Let us say you would like to find a word called "foo" and replace with "bar".

First hit [Esc] key

Type : (colon) followed by %s/foo/bar/ and hit [Enter] key.
:%s/foo/bar/

Above command will replace first occurrence of word foo with bar on all lines. The % is shorthand for all lines.

To replace all occurrences of word foo with bar on all lines, use the g option (which indicates all occurrences on a line).
:%s/foo/bar/g

Note that the g can be replaced with a number 1,2,...N to change only the n'th occurrence on each line.

Use find and replace on line ranges (match by line numbers)

You can also make changes on range of lines i.e. replace first occurrence of foo with bar on lines 5 through 20 only, enter:
:5,20s/foo/bar/

Following command will replace first occurrence of foo with bar starting at the current line for the next 100 lines:
:.,+100s/foo/bar/

Match by words

Finally, you can match by words i.e. replace first occurrence of foo with bar starting at at the next line containing a word "test":
:/test/s/foo/bar/g

As usual you can specify ranges:
:/test/,/guest/s/foo/bar/g

Please note that all search/replace commands should be start with the [ESC]: keystroke combination onl

Wednesday, 20 March 2013

Oracle Apps: Kill FNDLIBR unix processes


ps -ef |grep FNDLIBR | grep -v grep | awk '{print $2}' | xargs kill -9

Thursday, 14 March 2013

Oracle 11i: Multi to single node cloning steps

We have application with two nodes. One for DB and Concurrent manager(bahix07) and second(bahix06) is for apllication server and other processes.

In this article we will do cloning multi node to single node cloning.

1- Run the preclone for Application and Database.
  A- On the application server bahix06 as an application user:
        cd $COMMON_TOP/admin/scripts/*
-----------------------------------------------------------------------------------

$ perl adpreclone.pl appsTier merge
Running adgenhfver.pl with command...
         perl /fmsappl/oracle/fmsprodappl/ad/11.5.0/bin/adgenhfver.pl isPrimary=y applsysusr=APPLSYS tempdir=/fmsappl/oracle/fmsprodcomn/temp

Please enter the APPS User [APPS]: apps
Please enter the APPS password:

This is the merge Primary node:
PLATFORM: aix
Current APPL_TOP: bahix06

APPL_TOPs belonging to FMSPROD, that can be merged with bahix06:
bahix07(ADMIN, CONCURRENT_PROCESSING)

Do you want to include bahix07 in the merge ? [y]:

Generating the high version files manifest. This will take some time, please wait...

sqlplus -s apps/xxxxxx @/fmsappl/oracle/fmsprodappl/ad/11.5.0/patch/115/sql/admsnlst.sql FMSPROD bahix06 bahix07,bahix06 APPLSYS /fmsappl/oracle/fmsprodappl/admin/FMSPROD/out/hfilever_appl_top.txt Y

Manifest located in: /fmsappl/oracle/fmsprodappl/admin/FMSPROD/out/hfilever_appl_top.txt

You can now go ahead and run the preparation on the subsequent node(s) while this process completes.

Running Rapid Clone with command...
        perl /fmsappl/oracle/fmsprodappl/ad/11.5.0/bin/adclone.pl java=/usr/java5 mode=stage stage=/fmsappl/oracle/fmsprodcomn/clone component=appsTier method=CUSTOM appctx=/fmsappl/oracle/fmsprodappl/admin/FMSPROD_bahix06.xml merge showProgress

Beginning application tier Stage - Tue Mar 12 12:43:41 2013
Log file located at /fmsappl/oracle/fmsprodappl/admin/FMSPROD_bahix06/log/StageAppsTier_03121243.log


Completed Merge APPL_TOP preparation for current Node...
Tue Mar 12 12:47:21 2013


Completed running perl /fmsappl/oracle/fmsprodappl/ad/11.5.0/bin/adclone.pl java=/usr/java5 mode=stage stage=/fmsappl/oracle/fmsprodcomn/clone component=appsTier method=CUSTOM appctx=/fmsappl/oracle/fmsprodappl/admin/FMSPROD_bahix06.xml merge showProgress ...
$
---------------------------------------------------------------------------------------------

     

  B- On the second node bahix07 as an application user:
    cd $COMMON_TOP/admin/scripts/*


$  perl adpreclone.pl appltop merge
Running adgenhfver.pl with command...
         perl /fmsprod/oracle/fmsprodappl/ad/11.5.0/bin/adgenhfver.pl isPrimary=n applsysusr=APPLSYS tempdir=/fmsprod/oracle/fmsprodcomn/temp

Please enter the APPS User [APPS]: apps
Please enter the APPS password: xxxxx

Current APPL_TOP: bahix07
This is a subsequent node to be merged into the primary node.
Downloading the high version files manifest from the database...

Found the manifest for merging bahix07,bahix06 using bahix06 as the Primary node.

sqlplus -s apps/xxxxxx  @/fmsprod/oracle/fmsprodappl/ad/11.5.0/patch/115/sql/admsnlst.sql FMSPROD bahix07 bahix07,bahix06 APPLSYS /fmsprod/oracle/fmsprodappl/admin/FMSPROD/out/hfilever_appl_top.txt N

Manifest located in: /fmsprod/oracle/fmsprodappl/admin/FMSPROD/out/hfilever_appl_top.txt
Running Rapid Clone with command...
        perl /fmsprod/oracle/fmsprodappl/ad/11.5.0/bin/adclone.pl java=/usr/java5 mode=stage stage=/fmsprod/oracle/fmsprodcomn/clone component=appltop method=CUSTOM appctx=/fmsprod/oracle/fmsprodappl/admin/FMSPROD_bahix07.xml merge showProgress

Beginning appltop Merge - Tue Mar 12 13:07:08 2013
Log file located at /fmsprod/oracle/fmsprodappl/admin/FMSPROD_bahix07/log/MergeApplTop_03121307.log


Completed Merge APPL_TOP preparation for current Node...
Tue Mar 12 13:22:08 2013


Completed running perl /fmsprod/oracle/fmsprodappl/ad/11.5.0/bin/adclone.pl java=/usr/java5 mode=stage stage=/fmsprod/oracle/fmsprodcomn/clone component=appltop method=CUSTOM appctx=/fmsprod/oracle/fmsprodappl/admin/FMSPROD_bahix07.xml merge showProgress ...
$


-------------------------------------------------------------------------------------------
Note: Copy the generated under $COMMON_TOP/clone/appl/bahix07 to the new server under the same target server path.
-------------------------------------------------------------------------------------------

C-  On the database node bahix07 as a database user:

    cd $ORACLE_HOME/appsutil/scripts/*

$   perl adpreclone.pl dbTier
Running Rapid Clone with command...
        perl /fmsprod/oracle/fmsproddb/appsutil/bin/adclone.pl java=/fmsprod/oracle/fmsproddb/jdk mode=stage stage=/fmsprod/oracle/fmsproddb/appsutil/clone component=dbTier method=CUSTOM dbctx=/fmsprod/oracle/fmsproddb/appsutil/FMSPROD_bahix07.xml  showProgress

Beginning database tier Stage - Tue Mar 12 13:28:54 2013
APPS Password : orasys2012
Log file located at /fmsprod/oracle/fmsproddb/appsutil/log/FMSPROD_bahix07/StageDBTier_03121329.log


Completed Stage...
Tue Mar 12 13:29:17 2013


Completed running perl /fmsprod/oracle/fmsproddb/appsutil/bin/adclone.pl java=/fmsprod/oracle/fmsproddb/jdk mode=stage stage=/fmsprod/oracle/fmsproddb/appsutil/clone component=dbTier method=CUSTOM dbctx=/fmsprod/oracle/fmsproddb/appsutil/FMSPROD_bahix07.xml  showProgress ...
$


-------------------------------------------------------------------------------------------

2- Copy the files to the target server:

Copy the generated directory from Secondery node to the primary node:
BAHIX07: scp -rp  $COMMON_TOP/clone/appl/bahix07 applprod@bahix06:/fmsappl/oracle/fmsprodcomn/clone/appl/

After copying the new directory we will archive bahix06 directories:
On bahix06: tar cvf - fmsprodappl  fmsprodcomn  fmsprodora | gzip > appltop.tar.gz

Move the archived files, DB home and data files to the target server. In our case we are copying the latest backup of the data files.

$ tar cvf - fmsprodappl  fmsprodcomn  fmsprodora | gzip > appltop.tar.gz

$  scp -rp appltop.tar.gz  appclone@10.180.1.105:/fmstest/clone/
$  scp -rp fmsproddata appclone@10.180.1.105:/fmstest/clone/
$  scp -rp fmsproddb appclone@10.180.1.105:/fmstest/clone/

Extract the copied files in the target system:
 $ gunzip < /fmstest/clone/appltop.tar.gz | tar xvf -


--------------------------------------------

2- Run the cfgclone for Database and Application.

a- We will start with the database tier; we renamed the directories in the target server as follow:

$ ls
fmscloneappl  fmsclonecomn  fmsclonedata  fmsclonedb    fmscloneora

Under /fmstest/clone/fmsclonedb/appsutil/clone/bin we will run the adcfgclone.pl
$ perl adcfgclone.pl dbTier
----------------------------------------------------------------------------------------------

$ perl adcfgclone.pl dbTier
Enter the APPS password [APPS]:
xxxxxx

First Creating a new context file for the cloned system.
The program is going to ask you for information about the new system:


Provide the values required for creation of the new Database Context file.

Do you want to use a virtual hostname for the target node (y/n) [n] ?:

Target instance is a Real Application Cluster (RAC) instance (y/n) [n]:

Target System database name [FMSPROD]:FMSCLONE

Target system RDBMS ORACLE_HOME directory [/fmsprod/oracle/fmsproddb]:/fmstest/clone/fmsclonedb

Target system utl_file accessible directories list [/usr/tmp, /fmsprod/oracle/fmsproddb/appsutil/outbound/FMSPROD_bahix07, /fmsdata1/OraApps_FTP]:/usr/tmp, /fmsdata1/OraApps_FTP

Number of DATA_TOP's on the target system [1]:

Target system DATA_TOP 1 [/fmsprod/oracle/fmsproddata]:/fmstest/clone/fmsclonedata

Do you want to preserve the Display set to bahix06:1.0 (y/n) [y] ?:y

Perl executable location is set to:
/usr/bin/perl

Do you want to preserve the port values from the source system on the target system (y/n) [y] ?:n

Clone Context uses the same port pool mechanism as the Rapid Install
Once you choose a port pool, Clone Context will validate the port availability.

Enter the port pool number [0-99]:
20

Checking the port pool 20
done: Port Pool 20 is free
Database port is 1541

Backing up /fmstest/clone/fmsclonedb/appsutil/FMSCLONE_bahix08.xml to /fmstest/clone/fmsclonedb/appsutil/FMSCLONE_bahix08.xml8.bak

Creating the new Database Context file from :
  /fmstest/clone/fmsclonedb/appsutil/template/adxdbctx.tmp

The new database context file has been created :
  /fmstest/clone/fmsclonedb/appsutil/FMSCLONE_bahix08.xml

Log file located at /tmp/CloneContext_0314103415.log

Running Rapid Clone with command:
        perl /fmstest/clone/fmsclonedb/appsutil/clone/bin/adclone.pl java=/fmstest/clone/fmsclonedb/appsutil/clone/bin/../jre mode=apply stage=/fmstest/clone/fmsclonedb/appsutil/clone/bin/.. component=dbTier method=CUSTOM dbctxtg=/fmstest/clone/fmsclonedb/appsutil/FMSCLONE_bahix08.xml  showProgress contextValidated=true

Beginning database tier Apply - Thu Mar 14 10:35:36 2013
-e
/fmstest/clone/fmsclonedb/appsutil/FMSCLONE_bahix08.xml
-stage
/fmstest/clone/fmsclonedb/appsutil/clone/bin/..
-pwd
xxxxx
-showProgress
-ouiCLI
Log file located at /fmstest/clone/fmsclonedb/appsutil/log/FMSCLONE_bahix08/ApplyDBTier_03141035.log


Completed Apply...
Thu Mar 14 10:46:30 2013


Starting database listener for FMSCLONE:
Running:
 /fmstest/clone/fmsclonedb/appsutil/scripts/FMSCLONE_bahix08/addlnctl.sh start FMSCLONE

You are running addlnctl.sh version 115.7

Logfile: /fmstest/clone/fmsclonedb/appsutil/log/FMSCLONE_bahix08/addlnctl.txt

Starting listener process FMSCLONE ...


Listener FMSCLONE has already been started.


addlnctl.sh: exiting with status 0
$
------------------------------------------------------------------------------------------------------


Change the following after dbTier cfgclone and before apps cfgclone:
1- Change the directories – if any need to be changed
select 'CREATE OR REPLACE DIRECTORY '||DIRECTORY_NAME||' AS '||''''||DIRECTORY_PATH||''''||';' 
from all_directories;

- Edit the commands by replacing FMSPROD with FMSCLONE ie source with target and Execute. 
- You would also be required to check and recreate the DB links as per tns entries and requirements in the Target Instance.

 - Update apps.wf_systems (This should show the target Instance and not the source Instance)
select name,display_name from apps.wf_systems;
update apps.wf_systems set name='FMSCLONE',display_name='FMSCLONE';
COMMIT;


 - Update Notification status (This needs to be bone before running adcfgclone on the apps tier , to avoid any Notifications to be sent from the Target Instance)

UPDATE wf_notifications SET status ='CLOSED', mail_status ='SENT', end_date ='01-JAN-01' WHERE mail_status in ('MAIL','INVALID','OPEN') ; 
Commit;

update wf_agents set address = replace ( address,'FMSPROD','FMSCLONE' ) ;
select name ,display_name from wf_systems;
update wf_systems set 
DISPLAY_NAME = replace ( DISPLAY_NAME, 'FMSPROD','FMSCLONE'); 
Commit;

update fnd_concurrent_queues set node_name='' where node_name='';
update fnd_user set email_address = 'xxxxx@xcxxx.com';
Update per_people_f set email_address = 'xxxxx@xcxxx.com';
Update po_vendor_sites_all set email_address = 'xxxxx@xcxxx.com',
remittance_email =  'xxxxx@xcxxx.com';
commit;

Change the apps password using FNDCPASS tool:
FNDCPASS apps/[Old Password] 0 Y system/[Old Password] SYSTEM APPLSYS [New Password]


b- Run the cfgclone for the apps tier:
      From the COMMON_TOP(/fmstest/clone/fmsclonecomn/clone/bin) the cfgclone for the appstier:

   

Apps clone post changes:

1- Add the custom top paths to $APPL_TOP/admin/adovars.env file:

   XXAEME_TOP="/fmstest/fmsclone/fmscloneappl/xxaeme/11.5.0"
   export XXAEME_TOP
   XXHRDBI_TOP="/fmstest/fmsclone/fmscloneappl/xxhrdbi/11.5.0"
   export XXHRDBI_TOP

2- Modify the DISPLAY parameter in the context file and run Autoconfig.




Clone issues which I got during my work
========================================================================
OUI-10197:Unable to create a new Oracle Home at /fmsclone/fmsclonedb. Oracle Home already exists at this location. Select another lo
cation.
SEVERE:OUI-10197:Unable to create a new Oracle Home at /fmsclone/fmsclonedb. Oracle Home already exists at this location. Select ano
ther location.
ERRORCODE = 255 ERRORCODE_END
./runInstaller  -silent -detachHome ORACLE_HOME= 

Solution: Remove the exisiting home
$  runInstaller  -silent -detachHome ORACLE_HOME=/fmstest/clone/fmsclonedb
/fmstest/clone/fmsclonedb/oui/bin/runInstaller  -silent -detachHome ORACLE_HOME=/fmstest/clone/fmsclonedb

========================================================================
Oracle Forms not opening:
Stop application services.
Run autoconfig at dbTier then appsTier.

========================================================================
Wrong DISPLAY environment variable value:
change the value manually in adstrtal.sh, adcmctl.sh, gsmstrt.sh and export the DISPLAY in adovars.env file under $APPL_TOP/admin directory.
========================================================================

http 403
Forbidden
You don't have permission to access /OA_HTML/AppsLocalLogin.jsp on this server.
apache not considering the symbolic link

Solution:
Temporarily enable iAS to use symbolic links.
Replace all occurrences of
'Option -FollowSymLinks'
 for
 'Option +FollowSymLinks'
in
$IAS_ORACLE_HOME/Apache/Apache/conf/httpd.conf
and
$IAS_ORACLE_HOME/Apache/Apache/conf/httpd_pls.conf
and bounce apache. If this is the issue, you should then go back and implement the changes via autoconfig. The value from this is controllable from your Apps Context, see s_options_symlinks .
"s_options_symlinks">Options +FollowSymLinks


=================================================================
Internal Server Error


The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, applprod@aemeweb.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

Actually the solution was to copy and relink the FNDFS from the production to clone.
Don't forget to run the adrelink after each clone !!


roubleshooting Issues with Report Review Agent (FNDFS) in APPS 10SC [ID 98093.1]


Sunday, 24 February 2013


Main “steps” documents id:

362205.1: 10g Release 2 Export/Import Process for Oracle Applications Release 11i

557738.1: Export/import notes on Applications 11i Database 11g

1265268.1: Interoperability Notes Oracle EBS 11i with Oracle Database 11gR2 (11.2.0.1)

165195.1: Using AutoConfig to Manage System Configurations with Oracle Applications 11i

Oracle Database Upgrade Guide 11g Release 2 (11.2) part no. E23633-07

Other doc_id: 881505.1, 1367654.1

Troubleshooting:

Oracle Text: Re-installation of Applications 11i (11.5.10) Oracle Text Indexes [ID 312640.1]



Contents

Upgrade 11i EBS database from 10.2.0.4 to 11.2.0.1. 1

Before the Database Installation and Upgrade. 3

I.       Interoperability “Pre”: 3

Database Upgrade: 4

II.      Pre-Export the database: 4

III.         Pre-Import the database: 6

IV-         Export the database: 9

V-     Import the database: 10

IV-         Post-Import and database configuration: 11

Before the Database Installation and Upgrade

       I.            Interoperability “Pre”:

From doc_id: 1265268.1 -> Section1: Upgrading an E-Business Suite 11i Database to Oracle Database 11g Release 2 (11.2.0)

1)   Verify S/W and system’s versions:

a)      Ebs 11.5.10.2

b)      ATG Rollup Patch 6

c)       Developer 6i Patch set 18

d)      AutoConfig Latest version with 9835302

2)   Nothing to do

3)   Nothing to do

4)   Deregister the current database server

To deregister the current database server node because If you plan to change the database port, host, SID, or database name parameter, run the following command as the owner of the Oracle RDBMS file system and current database instance:

$ perl $ORACLE_HOME/appsutil/bin/adgentns.pl

appspass=[APPS db user password]

contextfile=$CONTEXT_FILE -removeserver

5)   Update application tier context file with new database listener port number

If you want to continue use the APPS tier, modify XML file with new database info. OR just make new cloned instance to connect to new DB tier.

s_dbhost New database hostname
s_dbdomain New database domain name
s_db_serv_sid New database SID
s_dbport New database listener port
s_apps_jdbc_connect_descriptor NULL
6)   Upgrade the database instance

362205.1:   10g Release 2 Export/Import Process for Oracle Applications Release 11i

557738.1:   Export/import notes on Applications 11i Database 11g

1265268.1: Interoperability Notes Oracle EBS 11i with Oracle Database 11gR2 (11.2.0.1)

165195.1: Using AutoConfig to Manage System Configurations with Oracle Applications 11i

Oracle Database Upgrade Guide 11g Release 2 (11.2)  part no. E23633-07

According to previous documents the upgrade will be using import/export method.

Database Upgrade:

    II.            Pre-Export the database:

From doc_id: 362205.1 -> Section1: Prepare the source system

From doc_id: 557738.1 -> Section1: Prepare the source system

7)   Apply the Applications consolidated export/import utility patch

Apply both patches for exporting 10 (4872830) and 11g (1235353).

8)   Apply latest Applications database preparation scripts patch

Apply Patch 7225862 to every application tier server node in the source system.

9)   Create a working directory on source database node

Create a working directory named expimp in the source system that will contain all generated files and scripts required to complete this section. As an example,

$ mkdir /u01/expimp

10)       Generate target database instance creation script adcrdb.sql (10g),  aucrdb.sql (11g)

11g $sqlplus system/manager  @$AU_TOP/patch/115/sql/auclondb.sql 11

10g $sqlplus system/manager  @$AU_TOP/patch/115/sql/adclondb.sql

Then edit this script to reflect the new environment.

“Split it into 2 files, first one for CREATE DATABASE statement include in it the UNDO TABLESPACE section. The other file is to the rest of tablespaces adcrdb_db.sql and adcrdb_tbs.sql”.

Also adpostcrdb.sql which you use to convert tablespaces to locally managed will be created.

11)       Record Advanced Queue settings

Copy the auque1.sql script from the $AU_TOP/patch/115/sql directory on the source administration server node to the working directory in the source database server node

$ sqlplus /nolog

SQL> connect / as sysdba;

SQL> @auque1.sql

It generates auque2.sql in the current directory.

12)       Remove rebuild index parameter in spatial indexes

SQL> select * from dba_indexes where index_type=’DOMAIN’ and

upper (parameters) like ‘%REBUILD%’;

To remove the rebuild index parameter, use SQL*Plus to connect to the source database as the owner of the index and run the following command:

SQL> alter index [index name] rebuild parameters (‘parameters’)

Where [parameters] is the original parameter set without the rebuild_index parameter.

13)       Synchronize Text indexes

$ sqlplus ‘/ as sysdba’

SQL> select pnd_index_owner,pnd_index_name,count(*)

from ctxsys.ctx_pending

group by pnd_index_owner,pnd_index_name;

To synchronize the indexes, run the following command:

SQL> exec ctx_ddl.sync_index(‘[index owner].[index name]‘);

14)       Drop SYS.ENABLED$INDEXES (conditional)

SQL> drop table sys.enabled$indexes;

15)       Shut down Applications server processes and database listener



 III.            Pre-Import the database:

16)       Prepare to create the 11.2.0 Oracle home

The 11.2.0 Oracle home must be installed on the database server node in a different directory than the current Oracle home

a) Finish OS prerequisites for new Oracle home “new host or exist host”.

b) Oracle OS owner profile option and environment variables.

17)       Install the base 11.2.0 software: install  software only

18)       Install Oracle Database 11g Products from the 11g Examples CD

19)       Create nls/data/9idata directory

Run the $ORACLE_HOME/nls/data/old/cr9idata.pl script to create the $ORACLE_HOME/nls/data/9idata directory.

20)       Apply additional 11.2.0.1 RDBMS patches  “9 patches using opatch”

Append Opatch tool to PATH,

$export PATH=$PATH:$ORACLE_HOME/OPatch

and run the following patches:

8570322

8685327

8761974

8771297

12672969-> instead of 8772028

8796511

8897784

8964142

8405205

21)       Create working directory on target database server.

Create a working directory named expimp in the target system that will contain all generated files and scripts required to complete this section. As an example,

$ mkdir /u01/expimp

22)       Copy scripts needed

Copy the following from Source environment “database or application servers” to the working directory on target database:

        I.            Copy initialization parameter file and CBO parameter file (initSID.ora and ifilecbo.ora “if exists”) from source database server, modify wanted parameter
      II.            Copy modified database creation scripts (adcrdb_db.sql and adcrdb_tbs.sql and adpostcrdb.sql) from source database server
    III.            Copy database preparation scripts (addb1020.sql, adsy1020.sql, adjv1020.sql, and admsc1020.sql) OR (audb1110.sql/audb1120.sql, ausy1110.sql/ausy1120.sql, aujv1110.sql/aujv1120.sql, and aumsc1110.sql/aumsc1120.sql) from $APPL_TOP/admin directory of the source administration server node.
    IV.            Copy auque2.sql generated file on step 18 from source database server working directory.
      V.            Copy $APPL_TOP/admin/adstats.sql from the administration server node to the working directory in the target database server node
    VI.            Copy $APPL_TOP/admin/adgrants.sql sql from the administration server node to the working directory in the target database server node.
  VII.            Copy $AD_TOP/patch/115/sql/adctxprv.sql from the administration server node to the working directory in the target database server node.
Create appsutil.zip file
perl /bin/admkappsutil.pl

This will create appsutil.zip in $APPL_TOP/admin/out .

Then copy it to new ORACLE_HOME then

unzip -o appsutil.zip

23)       Create the target database instance

Use modified adcrdb.sql script, generated from step 17

$ sqlplus /nolog

SQL> connect / as sysdba;

SQL> spool adcrdb.log;

SQL> startup nomount;

SQL> @adcrdb_db.sql

SQL> @adcrdb_tbs.sql

SQL> @ adpostcrdb.sql

SQL> exit;

24)     Set up the SYS schema
the audb1110.sql, audb1120.sqlor addb1020.sql script sets up the SYS schema for use with the Applications. On the target database server node, use SQL*Plus to connect to the target database instance as SYSDBA and run as sys.

$ sqlplus “/ as sysdba” @/u01/expimp/audb1120.sql

25)     Set up the SYSTEM schema
the ausy1110.sql, ausy1120.sql or adsy1020.sql script sets up the SYSTEM schema for use with the Applications. On the target database server node, use SQL*Plus to connect to the target database instance as SYSTEM and run as system

$ sqlplus system/manager @/u01/expimp/ausy1120.sql

26)     Install Java Virtual Machine
The aujv1110.sql, aujv1120.sql or adjv1020.sql script installs the Java Virtual Machine (JVM) in the database. On the target database server node, use SQL*Plus to connect to the target database instance as SYSTEM and run as system.

$ sqlplus system/manager @/u01/expimp/aujv1120.sql

27)     Install other required components

the aumsc1110.sql, aumsc1120.sql or admsc1020.sql script installs the following required components in the database: ORD, Spatial, XDB, OLAP, Data Mining, interMedia, and ConText. On the target database server node, use SQL*Plus to connect to the target database instance as SYSTEM and as system.

$ sqlplus system/manager @/u01/expimp/aumsc1120.sql FALSE SYSAUX TEMP

28)     Install custom RDBMS components (conditional)
if you have other custom RDBMS components loaded in the source database such as Label Security; install them in the target database. To determine the RDBMS components that are loaded in the source and target databases, use SQL*Plus to connect to the databases as SYSDBA and run the following command:

SQL> select * from dba_registry;

29)     Disable automatic gathering of statistics
Use SQL*Plus to connect to the database as SYSDBA and use the following commands to restart the database in restricted mode and run adstats.sql:

$ sqlplus “/ as sysdba”

SQL> shutdown normal;

SQL> startup restrict;

SQL> @adstats.sql

SQL> exit;

30)       Back up the target database instance
the target database instance is now prepared for an import of the Applications data. You should perform a backup before starting the import.

IV-             Export the database:

31)       Create the export parameter file

Copy $AU_TOP/patch/115/import/auexpdp.dat template file and edit it with proper values as following:

directory=DUMP_DIR

dumpfile=full_exp%U.dmp

filesize=1G

full=y

logfile=full_expdpapps.log

32)       Create export directory

$ sqlplus system/manager

SQL> create directory DUMP_DIR as ‘/u01/expimp’;

33)       Shut down Applications server processes

34)       Grant privilege to source system schema

$ sqlplus / as sysdba

SQL> grant EXEMPT ACCESS POLICY to system;

35)            Export the Applications database instance

If the source database is 10.2.0 or 11.1.0, use the following command:

$ expdp system/[system password] \

parfile=[export parameter file name]

If the source database is 11.2.0, use the following command:

$ expdp “‘/ as sysdba’” parfile=[export parameter file name]

36)       Revoke privilege from source system schema

SQL> revoke EXEMPT ACCESS POLICY from system;

V-                  Import the database:

37)       Create the import parameter file

Copy the export parameter file you created in Step 30 from the source database server node to the working directory in the target database server node, renaming it if necessary. Updating the new file with the following changes converts it to an import parameter file:

Remove the exclude parameters.
Remove the filesize parameter.
Change the name of the log file.
Uncomment the transform parameter.
It will be like this:

directory=DUMP_DIR

dumpfile=full_exp%U.dmp

full=y

transform=oid:n

logfile=impdpapps.log

38)       Create export directory

$ sqlplus system/manager

SQL> create directory DUMP_DIR as ‘/u01/expimp’;

39)       Copy the export dump files from source to target

40)       Set Oracle Text parameter

if the target database is 11.2.0, use SQL*Plus to connect to the target database as SYSDBA and run the following command to grant datastore privileges:

$ sqlplus “/ as sysdba”

SQL> exec ctxsys.ctx_adm.set_parameter (‘file_access_role’, ‘public’);

41)            Import the Applications database instance

Start the import session on the target database server node using the customized import parameter file.

If the target database is 11.1.0, use the following command:

$ impdp system/manager parfile=[import parameter file name]

If the target database is 11.2.0, use the following command:

$ impdp “‘/ as sysdba’” parfile=[import parameter file name]

42)       Revoke privilege from target system schema
Revoke the exempt access policy privilege from system by using SQL*Plus to connect to the database as SYSDBA and run the following command:

SQL> revoke EXEMPT ACCESS POLICY from system;

IV-             Post-Import and database configuration:

From doc: Export/import notes on Applications 11i Database 11g [ID 557738.1]

And doc: Interoperability Notes Oracle EBS 11i with Oracle Database 11gR2 (11.2.0) [ID 881505.1]

And doc Using AutoConfig to Manage System Configurations with Oracle Applications 11i [ID 165195.1]

43)       Reset Advanced Queues

Run file created in step:11.

$ sqlplus /nolog

SQL> connect / as sysdba;

SQL> @/u01/expimp/auque2.sql

44)       Perform patch post-install instructions
run all the patch post install instructions except for those of 13001379 and 13366268. There is no need to run the post install instructions of 13001379 and 13366268 as they are run as part of the database upgrade.

45)       Run adgrants.sql

$ sqlplus “/ as sysdba” @adgrants.sql APPS

46)       Grant create procedure privilege on CTXSYS

$ sqlplus apps/apps @adctxprv.sql SYSTEM CTXSYS

47)       Set CTXSYS parameter

$ sqlplus “/ as sysdba”

SQL> exec ctxsys.ctx_adm.set_parameter(‘file_access_role’, ‘public’);

48)       Deregister the current database server

$ sqlplus apps/apps

SQL> exec fnd_conc_clone.setup_clean;

49)       Some errors will be shown in the autoconfig

To avoid any error in running autoconfig in coming steps, review and verify the number and status of CTXSYS objects, synm. and grants.
To avoid any problem in INDEXES owned by CTXSYS, please run the following selected scripts from document: @jtfiappr.sql apps
Oracle Text: Re-installation of Applications 11i (11.5.10) Oracle Text Indexes [ID 312640.1]

enable applsys.wf_java_defered queue


some of grants may be lost so run the following list:
Compile the invalid objects.
$ sqlplus “/ as sysdba” @$ORACLE_HOME/rdbms/admin/utlrp.sql

50)       Generate your Database Context File

Ensure that shell reflect the oracle_home and bin.

From extracted appsutil.zip

cd /appsutil/bin
perl adbldxml.pl tier=db appsuser=apps

answer the question to generate XML file.

51)       Generate and Apply AutoConfig Configuration files in DB tier.

Execute the following commands:

cd /appsutil/bin
adconfig.sh contextfile=XML file created in step 50

52)       Re-create custom database links
if the Oracle Net listener in the 11.2.0 Oracle home is defined differently than the one used by the old Oracle home, you must re-create any custom self-referential database links that exist in the Applications database instance. To check for the existence of database links, use SQL*Plus on the database server node to connect to the Applications database instance as APPS and run the following query:

$ sqlplus apps/[apps password]

SQL> select db_link from dba_db_links;

The EDW_APPS_TO_WH and APPS_TO_APPS database links, if they exist, should have been updated with the new port number by AutoConfig in the previous step.

If you have custom self-referential database links in the database instance, use the following commands to drop and re-create them:

$ sqlplus apps/[apps password]

SQL> drop database link [custom database link];

SQL> create database link [custom database link] connect to

[user] identified by [password] using

‘(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=[hostname])

(PORT=[port number]))(CONNECT_DATA=(SID=[ORACLE_SID])))’;

where [custom database link], [user], [password], [hostname], [port number], and [ORACLE_SID] reflect

the new Oracle Net listener for the database instance.

Drop database link “PRODUCTION.HQ.ASQ.COM”;

create database link “PRODUCTION.HQ.ASQ.COM”

using ‘(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=demo.local)(PORT=1521))))(CONNECT_DATA=(SERVICE_NAME=UPGRD))’;

Drop public database link “READAPPSPROD.REGRESS.RDBMS.DEV.US.ORACLE.COM”;

create public database link “READAPPSPROD.REGRESS.RDBMS.DEV.US.ORACLE.COM” using ’192.168.1.245:1521/UPGRD’;

Drop database link “EDW_APPS_TO_WH.HQ.ASQ.COM”;

create database link “EDW_APPS_TO_WH.HQ.ASQ.COM” using ’192.168.1.245:1521/UPGRD’;

Drop database link “EDW_APPS_TO_WH.ABDULSAMADALQURASHI.LOCAL”;

create database link “EDW_APPS_TO_WH.ABDULSAMADALQURASHI.LOCAL” using ’192.168.1.245:1521/UPGRD’;

Drop database link “APPS_TO_APPS.HQ.ASQ.COM”;

create database link “APPS_TO_APPS.HQ.ASQ.COM” using ’192.168.1.245:1521/UPGRD’;

Drop database link “APPS_TO_APPS.ABDULSAMADALQURASHI.LOCAL”;

create database link “APPS_TO_APPS.ABDULSAMADALQURASHI.LOCAL” using ’192.168.1.245:1521/UPGRD’;

Drop database link “APPS_TO_APPS.LOCAL”;

create database link “APPS_TO_APPS.LOCAL” using ’192.168.1.245:1521/UPGRD’;

Drop database link “EDW_APPS_TO_WH.LOCAL”;

create database link “EDW_APPS_TO_WH.LOCAL” using ’192.168.1.245:1521/UPGRD’;

53)       Generate and Apply AutoConfig Configuration files in APPS tier.

54)       Apply Oracle Human Resources (HRMS) patch 7721754

55)       Use adadmin to:

Compile invalid object
Re-create grants and synonyms using adadmin
Compile flexfield

Oracle LogMiner

Today we got an issue that stuck our database. Database generated an expected number of archives which consumed the free space on the server. We asked our team if there is any long running process or abnormal process they confirmed nothing happened. We got the root cause by tracing the archives using the Oracle logMiner. The issue was a lot of inserts came to a custom audit table.

First identify the name and location for your archives.
select name,FIRST_TIME
from v$archived_log
where trunc(FIRST_TIME) = trunc(to_date('22-02-2013','dd-mm-yyyy'));
-------------------------------------              ------------------------------
/OraData/Archive/arch_1_226111.arc            08/03/2007 19:06:19
/OraData/Archive/arch_1_226112.arc            08/03/2007 19:06:20
/OraData/Archive/arch_1_226113.arc            08/03/2007 19:06:22

Then let the logminor use theses logs:
SQL> exec DBMS_LOGMNR.ADD_LOGFILE('/OraData/Archive/arch_1_226111.arc');
PL/SQL procedure successfully completed.

SQL> exec DBMS_LOGMNR.ADD_LOGFILE('/OraData/Archive/arch_1_226112.arc');
PL/SQL procedure successfully completed.


SQL> exec DBMS_LOGMNR.ADD_LOGFILE('/OraData/Archive/arch_1_226113.arc');
PL/SQL procedure successfully completed.


From the belwo query we can check if logminor can see the files:
SELECT * FROM V$LOGMNR_LOGS;

Then initiate the mining process by:
SQL> exec DBMS_LOGMNR.START_LOGMNR(options => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);
PL/SQL procedure successfully completed.

We can check the executed SQL statements by one of the following queries:

select seg_owner,seg_name,seg_type_name,operation ,min(TIMESTAMP) mintime,max(TIMESTAMP) maxtime,count(*) vcount
from v$logmnr_contents
group by seg_owner,seg_name,seg_type_name,operation
order by count(*) desc; 


SELECT timestamp, scn, start_scn, operation, seg_owner, seg_name, sql_redo
FROM V$LOGMNR_CONTENTS
ORDER BY timestamp, scn;



 

Number of Visitors