Tuesday, October 18, 2011

ORA-19909: datafile 1 belongs to an orphan incarnation

ORA-19909: during duplication


-------------------------------------------------------------------------------------------------------
RMAN > CONNECTED TO TARGET AND AUXILIARY
                 DUPLICATE TARGET DATABASE TO DB2'

........................
........................
.........................
starting media recovery

archived log for thread 1 with sequence 934 is already on disk as file /erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-934_T-1_A-760035616_3ump3je0
archived log for thread 1 with sequence 935 is already on disk as file /erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-935_T-1_A-760035616_4mmp3r0u
archived log for thread 2 with sequence 1368 is already on disk as file /erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-1368_T-2_A-760035616_49mp3jfm
archived log for thread 2 with sequence 1369 is already on disk as file /erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-1369_T-2_A-760035616_4bmp3jgq
archived log for thread 2 with sequence 1370 is already on disk as file /erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-1370_T-2_A-760035616_4emp3jhr
archived log file name=/erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-934_T-1_A-760035616_3ump3je0 thread=1 sequence=934
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 10/14/2011 21:08:53
RMAN-03015: error occurred in stored script Memory Script
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-934_T-1_A-760035616_3ump3je0'
ORA-00283: recovery session canceled due to errors
ORA-19906: recovery target incarnation changed during recovery

RMAN> exit


Recovery Manager complete.
[server1:+ASM1:oracle] sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Fri Oct 14 21:38:15 2011

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '+DB2/DB2/datafile/system.274.764540307'


SQL> recover database using backup controlfile;
ORA-00283: recovery session canceled due to errors
ORA-19909: datafile 1 belongs to an orphan incarnation
ORA-01110: data file 1: '+DB2/DB2/datafile/system.274.764540307'


SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[server1:+ASM1:oracle] ls -ltr /erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-934_T-1_A-760035616_3ump3je0
-rw-r-----   1 oracle   oinstall 285634048 Oct 14 17:49 /erpinstall/rman/arc_arch_D-DB1_id-1844823682_S-934_T-1_A-760035616_3ump3je0
[server1:+ASM1:oracle] rman target /

Recovery Manager: Release 11.1.0.7.0 - Production on Fri Oct 14 21:44:40 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: DB2 (DBID=1844823682, not open)

RMAN> list incarnatin;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "all, archivelog, backup, backuppiece, backupset, backed, completed, copy, controlfilecopy, datafilecopy, device, db_unique_name, expired, failure, foreign, global, incarnation, like, proxy, recoverable, restore, script, tag"
RMAN-01008: the bad identifier was: incarnatin
RMAN-01007: at line 1 column 6 file: standard input

RMAN> list incarnation;

using target database control file instead of recovery catalog

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       DB2   1844823682       PARENT  5539943343956 24-AUG-11
2       2       DB2   1844823682       CURRENT 5545713781531 20-SEP-11

RMAN> reset database to incarnation 1;

database reset to incarnation 1

RMAN> list incarnatin;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "all, archivelog, backup, backuppiece, backupset, backed, completed, copy, controlfilecopy, datafilecopy, device, db_unique_name, expired, failure, foreign, global, incarnation, like, proxy, recoverable, restore, script, tag"
RMAN-01008: the bad identifier was: incarnatin
RMAN-01007: at line 1 column 6 file: standard input

RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       DB2   1844823682       CURRENT 5539943343956 24-AUG-11
2       2       DB2   1844823682       ORPHAN  5545713781531 20-SEP-11

RMAN> exit

start recovery

sql> recover database using backup controlfile;
and provide all the archivelogs and open resetlogs;

Wednesday, July 13, 2011

RMAN COMPRESSED BACKUP TO TAPES AND DISKS CONFIGURATIONS

COMPRESSED BACKUP TO Disk WITH PARALLELISM 3 :

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ERPBF are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/dir_name/rman_bkp/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BZIP2'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 3 TIMES TO DISK;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u02/db/tech_st/11.1.0/dbs/snapcf_DBNAME.f'; # default

Here the backup goes to /dir_name/rman_bkp/ 


COMPRESSED BACKUP TO TAPE WITH PARALLELISM 3 :

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ERPBF are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64.1';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BZIP2'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 3 TIMES TO 'SBT_TAPE';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u02/db/tech_st/11.1.0/dbs/snapcf_DBNAME.f'; # default

check if netbackup or other client is installed and media library has to be set in parameter
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'SBT_LIBRARY=......';

Friday, June 24, 2011

orapwd file error: ld.so.1: orapwd: fatal: libclntsh.so.11.1: open failed: No such file or directory Killed

orapwd file=$ORACLE_HOME/dbs/orapwDB1 password=system
ld.so.1: orapwd: fatal: libclntsh.so.11.1: open failed: No such file or directory
Killed

Action:

set env
relink all

now try again...

Wednesday, June 22, 2011

Point in Time Rman Restore from tape backup.

Point in time recovery after dropping existing database.
Requirements: Rman backup log file
SQL> startup nomount
RMAN> set DBID 1194164416;
RMAN> run {
ALLOCATE CHANNEL c1 DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64.1';
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F';
restore controlfile from 'backup piece name';  Eg: f6mfa3bj_1_1  , from backup log file;
}

RMAN> alter database mount;
RMAN> restore database from tag ='Tag number from backup log file'; eg: 'TAG20110619T190015';
RMAN>{ set SET UNTIL TIME 'Jun 19 2011 20:00:17';
 recover database from tag ='TAG20110619T193704';     (archive logs backup tag #)
}

SQL> alter database open resetlogs;

Tuesday, May 31, 2011

When the file is created using the utl_file plsql package, how to set the desired file permission

When the file is created using the utl_file plsql package, how to set the desired file permission ?

Solution
In the Client/Server architecture , if you connect to Oracle database from any client workstation, through SQLNET, a session is created on behalf of your user process. It is the responsibility of the listener process to connect user process with available shared server / dispatcher process. These are the background process serving on behalf of user process. Normally oracle is the owner of these background process.

The file permissions is not a function of the UTL_FILE package at all.The concept is if you are establishing a local session on the server,then the shadow process you started inherits the permissions as you logged in as..
However if you login from a remote client say a SQLplus session from a NT workstation, then the file inherits the permission of the TNS Listener of the server. The TNS Listener permission is that permission as at the time when the listener was started by the oracle user. By stopping the listener and logging back in and restarting listener after setting the new umask value, the <oracle> user basically inherits the new umask value which in turn passes it to the new listener.Hence whenever you change the umask value , you should always restart the listener so that it gets the umask value of the user who has started the listener.

1. Login to server as oracle
2. stop the listener
3. set the desired umask value
4. disconnect remote session (session from where you are initiating procedure)
5. log back into the server as oracle to inherit new umask value
6. As a check - type 'umask' at the prompt to check the value
7. start the listener
8. from remote client start a new sqlplus session to test procedure.

You must get the right permissions this time.

You must be connected to database using listener or bequeath connection. So in both the cases the UMASK should be specified properly.

If the database is started using user oracle (UMASK=022) and listener started using user test1(UMASK=002). Always the new files will be created with the ownership of oracle. Hence oracle should have proper permissions to access the folder/directory where file is created.

If you are connected to database using bequeath connection (sqlplus scott/tiger), then file permissions will be inherited from user oracle. Hence the file permissions would be (rw-r-r). If you have connected through listener than file permissions will be inherited from user test1 because the listener was started by test1. Hence the file permissions would be (rw-rw-r).

If the file is already existing and you are trying to change the permission using utl_file package by setting new umask value, the changes will not be affected. You will have to manually change the permission using 'chmod' command.

Example :

Server :

=========

1. Login to server as oracle
login as: oracle
oracle@10.177.59.119's password:
Last login: Thu Oct 18 07:50:27 2007 from 10.177.59.103

2. stop the listener
[oracle@localhost ~]$ lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-OCT-2007 07:53:47

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
The command completed successfully

3. set the desired umask value
[oracle@localhost ~]$ umask
0022
[oracle@localhost ~]$ umask 002

4. disconnect remote session (session from where you are initiating procedure)
5. log back into the server as oracle to inherit new umask value
6. As a check - type 'umask' at the prompt to check the value
7. start the listener
[oracle@localhost ~]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-OCT-2007 07:54:12

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /home/databases/ORA10203/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /home/databases/ORA10203/network/admin/listener.ora
Log messages written to /home/databases/ORA10203/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 18-OCT-2007 07:54:12
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/databases/ORA10203/network/admin/listener.ora
Listener Log File /home/databases/ORA10203/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "ORA10203" has 1 instance(s).
Instance "ORA10203", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@localhost ~]$

Client :
=========

8. from remote client start a new sqlplus session to test procedure.

C:\Documents and Settings\aldsouza>sqlplus scott/tiger@ORA10201_LINUX

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Oct 18 07:47:20 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> declare
2
3 f1 utl_file.file_type;
4
5 begin
6
7 f1 := utl_file.fopen('TEST_DIR','test.txt','w');
8 utl_file.fclose(f1);
9
10 end;
11 /

PL/SQL procedure successfully completed.

SQL>

The file will be created in the TEST_DIR with the following permissions

-rw-rw-r-- 1 oracle dba 0 Oct 18 08:00 test.txt

Monday, May 23, 2011

Instance number '2' is used by host 'hostname' perl adclonectx.pl \

Error while running perl adclonectx.pl \  on second node during cloning RAC db tier for oracle apps


Error message while entering the Instance number 

Eg: Enter Instance number : 2

Instance number '2' is used by host 'hostname'


Action:

Run FND_NODES Cleanup process manually


On Primary node of the Target

1. Run the following

SQL> exec FND_CONC_CLONE.SETUP_CLEAN
2.Run AutoConfig

$ cd $ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME
$ ./adautocfg.sh
On Secondary node

3. Retry adclonectx.pl  on secondary node of the target.

Thursday, May 19, 2011

Gridcontrol 11g agent install on target database using pull method eg: solaris

Inorder to register the target database at Gridcontrol, agent needs to be installed at the target host. here are the steps

At Gridcontrol node
Downloadand install agent according to platform specific and install at GC node, follow readme file

copy agentDownload.solaris from source
1./u01/app/oracle/Middleware/oms11g/sysman/agent_download/11.1.0.1.0/solaris to destination (i.e target node )agen_OH.
here agent_OH = ./u01/app/oracle/product/gc_agent

2.export PATH=$PATH:/usr/sfw/bin

3./u01/app/oracle/product/gc_agent$ chmod u+x agentDownload.solaris

4.sh agentDownload.solaris -b /u01/app/oracle/product/gc_agent -m GCHOSTNAME.DOMAIN -r 7799 -y

5. run root.sh as root

6./u01/app/oracle/product/gc_agent/agent11g/bin$ ./emctl secure agent password

Check at Gridcontrol webiste, you will find target database registered.


Thursday, April 28, 2011

Oracle Apps R12 AutoConfig ORA-12705 on Database Tier

Db version 11.1.0.7
Error:
ORA-12705: Cannot access NLS data files or invalid environment specified

If AutoConfig log file shows

[AutoConfig Error Report]
The following report lists errors AutoConfig encountered during each
phase of its execution.  Errors are grouped by directory and phase.
The report format is:
      <filename>  <phase>  <return code where appropriate>

  [PROFILE PHASE]
  AutoConfig could not successfully execute the following scripts:
    Directory: /u01/app/oracle/product/11.0.1/appsutil/install/ERPPJU1_server0090
      afdbprf.sh              INSTE8_PRF         1

  [APPLY PHASE]
  AutoConfig could not successfully execute the following scripts:
    Directory: /u01/app/oracle/product/11.0.1/appsutil/install/ERPPJU1_server0090
      adcrobj.sh              INSTE8_APPLY       1
      txkcreateACL.sh         INSTE8_APPLY       1

AutoConfig is exiting with status 3

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

Action:

Set the Envinronment properly and run the below script
$OH/nls/data/old/cr9idata.pl
then include the path given after execution of cr9idata.pl script.


Run autoconfig again after setting new env file. ......Thanks

Wednesday, April 27, 2011

MIGRATE FILE SYSTEM DATABASE TO ASM

1) OS/DB specifications

OS version is Oracle Solaris 10 and database version is 11.1.0.7

2)Modify init files 


Include the following parameters init file, to refer to the desired ASM disk groups
db_create_file_dest='+DATA01'
db_create_online_log_dest_1='+DATA01'



3) Converting database to ASM

a.Disable change tracking if enabled.

SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
SQL> SHUTDOWN IMMEDIATE
 
b. Restore the control file into new locations from location specified in the old PFILE:


SQL> startup nomount ;
RMAN> RESTORE CONTROLFILE FROM 'filename_of_old_control_file';
RMAN> ALTER DATABASE MOUNT;
 
d. Copy the database into the ASM disk group using the following command:
RMAN> BACKUP AS COPY DATABASE FORMAT '+disk_group';

Switch all datafiles into new ASM disk group
RMAN> SWITCH DATABASE TO COPY;
 
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
 
RMAN> ALTER DATABASE OPEN; / SQL> ALTER DATABASE OPEN RESETLOGS;
 
If you were using change tracking for incremental backups, you can re-enable it now. For example:
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;
  
e. Cleanup of Non-ASM Files After ASM Migration
# delete datafiles
RMAN> DELETE COPY OF DATABASE;
RMAN> HOST 'rm old_online_redo_logs';
RMAN> HOST 'rmold_control_files';
 

Tuesday, April 26, 2011

Cloning DataBase Tier in different servers for Oracle Apps R12 - RAC ASM 11gR1

RAC to RAC DB Tier cloning


1)OS/DB specifications

OS version is Oracle Solaris 10 and database version is 11.1.0.7, Apps - 12.1.3  Cloning from ERPDEV to ERPPAT

Source - ERPDEV on server0091/93
Target - ERPPAT on server0090/92

Prepare the source system database tier for cloning (at ERPDEV)

Log on to the source system as the ORACLE user, and run the following commands:
$ cd [RDBMS ORACLE_HOME]/appsutil/scripts/[CONTEXT_NAME]
$ perl adpreclone.pl dbTier


Configure Primary Node :

2) Copy RDBMS Home from Source to Target

{server0091:oracle:}: /home/oracle/scripts =>cat cp_db.sh
echo "Copy of RDBMS started at `date`"
cd /u01/app/oracle/product/11.0.1
tar  cef - ./* | gzip > /erpdev/orashr/backup/db/db.tar.gz
echo "Copy of RDBMS finished at `date`"

{server0090:oracle:}: /u01/app/oracle/product/11.0.1_erppat =>gunzip db.tar.gs
{server0090:oracle:}: /u01/app/oracle/product/11.0.1_erppat =>tar -xvf db.tar

3) Backup ASM_HOME/network/admin directory in target.

4) Create pairsfile.txt File for Primary Target Node

cd /u01/app/oracle/product/11.0.1_erppat/appsutil/clone and create pairsfile.txt
Set the following values :
s_undo_tablespace=[UNDOTBS1 for Initial Node]
s_dbClusterInst=[Total number of Instances in a cluster e.g. 2]
s_db_oh=[Location of new ORACLE_HOME]

Sample of  pairsfile.txt
{server0090:oracle:}: /u01/app/oracle/product/11.0.1_erppat/appsutil/clone =>cat pairsfile.txt
s_undo_tablespace=APPS_UNDOTS1
s_dbClusterInst=2
s_db_oh=/u01/app/oracle/product/11.0.1_erppat

5) Create Context File for Target Primary Node

perl adclonectx.pl \
contextfile=[PATH to OLD Source RAC contextfile.xml] \
template=[NEW ORACLE_HOME]/appsutil/template/adxdbctx.tmp \
pairsfile=[NEW ORACLE_HOME]/appsutil/clone/pairsfile.txt \
initialnode

Sample value and inputs --
{server0090:oracle:}: /u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin =>perl adclonectx.pl \
> contextfile=/u01/app/oracle/product/11.0.1_erppat/appsutil/ERPDEV1_server0091.xml \
>  template=/u01/app/oracle/product/11.0.1_erppat/appsutil/template/adxdbctx.tmp \
> pairsfile=/u01/app/oracle/product/11.0.1_erppat/appsutil/clone/pairsfile.txt \
> initialnode

                     Copyright (c) 2002 Oracle Corporation
                        Redwood Shores, California, USA

                        Oracle Applications Rapid Clone

                                 Version 12.0.0

                      adclonectx Version 120.23.12010000.1

Running:
/u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin/../jre/bin/java -Xmx600M -classpath /u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin/../jlib/ojdbc5.jar:/u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin/../jlib/xmlparserv2.jar:/u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin/../jlib/java oracle.apps.ad.context.CloneContext  -e /u01/app/oracle/product/11.0.1_erppat/appsutil/ERPDEV1_server0091.xml -tmpl /u01/app/oracle/product/11.0.1_erppat/appsutil/template/adxdbctx.tmp -pairsfile /u01/app/oracle/product/11.0.1_erppat/appsutil/clone/pairsfile.txt -initialnode
Enter the APPS password : erpdevapps
Log file located at /u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin/CloneContext_1028139319.log
Provide the values required for creation of the new Database Context file.
Target System Hostname (virtual or normal) [server0090] :
It is recommended that your inputs are validated by the program.
However you might choose not to validate them under following circumstances:
        -If cloning a context on source system for a remote system.
        -If cloning a context on a machine where the ports are taken and
         you do not want to shutdown the services at this point.
        -If cloning a context but the database it needs to connect is not available.
Do you want the inputs to be validated (y/n) [n] ? :
Target Instance is RAC (y/n) [y] :
Target System Database Name : ERPPAT
Target System Port Pool [0-99] : 1
Report file located at /u01/app/oracle/product/11.0.1_erppat/appsutil/out/portpool.lst
Complete port information available at /u01/app/oracle/product/11.0.1_erppat/appsutil/out/portpool.lst
Provide information for the initial RAC node:
    Host name [server0090] :
    Virtual Host name [null] : server0090-vip
    Instance number [1] :
    Private interconnect name [server0090] : 192.168.114.23
Target System Base Directory : /u01/app/oracle/product/11.0.1_erppat
Oracle OS User [oracle] :
Oracle OS Group [oinstall] :
Target System utl_file_dir Directory List : /usr/tmp
Number of DATA_TOP's on the Target System [2] : 1
Target System DATA_TOP Directory 1 : +ERPPAT
Do you want to preserve the Display [localhost:12.0] (y/n) ? : n
Target System Display [server0090:0.0] :
New context path and file name [/u01/app/oracle/product/11.0.1_erppat/appsutil/ERPPAT1_server0090.xml] :
Do you want to overwrite it (y/n) [n] ? : y
Replacing /u01/app/oracle/product/11.0.1_erppat/appsutil/ERPPAT1_server0090.xml file.
Creating the new Database Context file from :
 /u01/app/oracle/product/11.0.1_erppat/appsutil/template/adxdbctx.tmp
The new database context file has been created :
  /u01/app/oracle/product/11.0.1_erppat/appsutil/ERPPAT1_server0090.xml
Log file located at /u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin/CloneContext_1028139319.log
contextfile=/u01/app/oracle/product/11.0.1_erppat/appsutil/ERPPAT1_server0090.xml
Check Clone Context logfile /u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin/CloneContext_1028139319.log for details.

{server0090:oracle:}: /u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin =>
Note: If the most current AutoConfig Template patch as listed in OracleMetalink Note 387859.1 has already been applied to the source system, it is necessary to edit the value of the target system context variable "s_db_listener" to reflect the desired name for the tns listener. The traditionally accepted value is "LISTENER_[HOSTNAME]" but may be any valid value unique to the target host.
Also check and change local_listener and remote_listener value at context file.

6) Detach Existing Oracle Home at Primary Home

./runInstaller -detachHome ORACLE_HOME=/u01/app/oracle/product/11.0.1_erppat

7) Run dbTeckStack at primary node.

perl adclone.pl \
java=<ORACLE_HOME>/ appsutil/clone/jre \
component=dbTechStack \
mode=apply \
stage=OH/appsutil/clone \
method=CUSTOM \
dbctxtg=<ORACLE_HOME>/appsutil/<DB Context File> \
showProgress contextValidated=true

Following is the sample command :

{server0090:oracle:}: /u01/app/oracle/product/11.0.1_erppat/appsutil/clone/bin =>perl adclone.pl \
> java=/u01/app/oracle/product/11.0.1_erppat/appsutil/clone/jre \
> component=dbTechStack \
> mode=apply \
> stage=/u01/app/oracle/product/11.0.1_erppat/appsutil/clone \
> method=CUSTOM \
> dbctxtg=/u01/app/oracle/product/11.0.1_erppat/appsutil/ERPPAT1_server0090.xml \
> showProgress contextValidated=true

Logfile Path -- /u01/app/oracle/product/11.0.1_erppat/appsutil/log/ERPPAT1_server0090/ ApplyDBTechStack_11031815.log
And corresponding OH clone path -- /u01/app/oraInventory/logs/cloneActions2010-11-03_06-15-90PM.log
/u01/app/oracle/product/11.0.1_erppat/appsutil/log/ERPPAT1_server0090/make_11031816.log
/u01/app/oracle/product/11.0.1_erppat/appsutil/log/ERPPAT1_server0090/ohclone.log


8) Create the target database

a) We need to take hot backup from erpdev and save it to local disk using RMAN

    run{
ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '/erpdev/orashr/bkp/%U';
ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT '/erpdev/orashr/bkp/%U';
ALLOCATE CHANNEL disk3 DEVICE TYPE DISK FORMAT '/erpdev/orashr/bkp/%U';
ALLOCATE CHANNEL disk4 DEVICE TYPE DISK FORMAT  '/erpdev/orashr/bkp/%U';
ALLOCATE CHANNEL disk5 DEVICE TYPE DISK FORMAT  '/erpdev/orashr/bkp/%U';
ALLOCATE CHANNEL disk6 DEVICE TYPE DISK FORMAT  '/erpdev/orashr/bkp/%U';
ALLOCATE CHANNEL disk7 DEVICE TYPE DISK FORMAT  '/erpdev/orashr/bkp/%U';
ALLOCATE CHANNEL disk8 DEVICE TYPE DISK FORMAT  '/erpdev/orashr/bkp/%U';
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
        }

b) FTP the backup and archive log files to server0090(ERPPAT) after creating the same directory where the  
    source db backup files were saved, (alternate is to use ACTIVE DUPLICATION)

c) Create a parameter file for ERPPAT database (auxiliary).

    The following parameters need to change.

    1) control_files
    2) diagnostic_dest
    3) sga_target
    4) db_create_file_dest (ASM location)
    5) db_create_online_log_dest_1 (ASM Location)
    6) log_archive_dest (Enabled archive log mode)
    7) cluster_database=false
    8) _no_recovery_through_resetlogs=TRUE


d) Set ORACLE_HOME and ORACLE_SID accordingly
    Create a password file for auxiliary database using below command.
     %orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password= xxxxxxxx

e) Start auxiliary database in NO MOUNT state
      startup nomount pfile=<path of init.ora>;
      g) Create a static listener for auxiliary database and reload, because auxiliary database will not register        
            itself with the listener.
      h) Make sure that backup pieces are on the same location where it were there on production db.   
            If you don’t have the same location, then make RMAN aware of the changed location.
i) Duplicate Target Database using RMAN Duplicate command
    

      Connect to target and auxiliary
      rman target sys/password_sys@target_db auxiliary sys/password_sys@auxiliary_db
     RMAN> DUPLICATE TARGET DATABASE TO ERPDUP;
Note:-We need to use password file in ERPDEV and also check remote_login_passwordfile=EXCLUSIVE  so that we can connect to ERPDEV using sys user through net alias. Please make necessary change in tnsnames.ora

j) Incorporate RAC related change
        cluster_database  = TRUE in init.ora
        and also check the remote_listener and local_listener values are correct

k) Recreate redo logs of thread 2 & Enable second thread and startup the second instance.
           
           ALTER DATABASE ADD LOGFILE THREAD 2
                   GROUP 3 (‘..../redo03a’,‘…/redo03b’) size 100M,
       GROUP 4 (‘..../redo04a’,‘..../redo04b’) size 100M ;

            SQL> ALTER DATABASE ENABLE PUBLIC THREAD 2;
            SQL> startup;

l) Check redo thread and temp files after duplication of database.
select * from v$log;
SELECT * FROM DBA_TEMP_FILES OR SELECT * FROM V$TEMPFILE

m) Check sqlplus connection with primary SID.

n) Check that Actual IP’s are also included, otherwise add.

e.g --
{server0090:oracle:}: /u01/app/oracle/product/asm/network/admin =>cat listener.ora
# listener.ora.server0090 Network Configuration File: /u01/app/oracle/product/asm/network/admin/listener.ora.server0090
# Generated by Oracle configuration tools.
LISTENER_SERVER0090 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = server0090-vip)(PORT = 1591)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = server0090-vip)(PORT = 1922)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = server0090-vip)(PORT = 1923)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = ip)(PORT = 1591)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = server0090.domain.domain1)(PORT = 1922)(IP = FIRST))
    )
  )


9)Run the library update script against the RAC database.

$ cd [RDBMS ORACLE_HOME]/appsutil/install/[CONTEXT_NAME]
$ sqlplus "/ as sysdba" @adupdlib.sql so

10)Start RDBMS listener and check sqlplus connection with primary SID.

 Shutdown ASM listener and start up (if it was up by CRS) newly created RDBMS listener .


11)Configure the primary target database using DBCONFIG : (check TNS_ADMIN)

$ cd [RDBMS ORACLE_HOME]/appsutil/clone/bin
$  perl adcfgclone.pl dbconfig <ORACLE_HOME>/appsutil/DB Context file

$  perl adcfgclone.pl dbconfig /u01/app/oracle/product/11.0.1_erppat/appsutil/ERPPAT1_server0090.xml

Logfile- /u01/app/oracle/product/11.0.1_erppat/appsutil/log/ERPPAT1_server0090/ ApplyDatabase_10281449.log

Configure Secondary Node :

 Uncompress the archived ORACLE_HOME transferred from the Source System
Uncompress the source system ORACLE_HOME archive to a location matching that present on your target system primary node. The directory structure should match that present on the newly created target system primary node.

$ {server0092:oracle:}: /u01/app/oracle/product/11.0.1_erppat =>tar -xvf  db.tar.gz

11) Archive the [ORACLE_HOME]/appsutil directory structure from the new Primary Node
Log in to the new target system primary node, and execute the following commands:

$ cd [ORACLE_HOME]
$ zip -r appsutil_node1.zip appsutil


13 ) Copy appsutil_node1.zip to the Secondary Target Node
Transfer and then expand the appsutil_node1.zip into the secondary target RAC node [NEW ORACLE_HOME].

$ cd [NEW ORACLE_HOME]
$ unzip -o appsutil_node1.zip

14 ) Update pairsfile.txt for the Secondary Target Node
Alter the existing pairsfile.txt (from the first target node) and change the s_undo_tablespace parameter. As this is the second node, the correct value would be UNDOTS2. As an example, the [NEW_ORACLE_HOME]/appsutils/clone/pairsfile.txt would look like:

 s_undo_tablespace= APPS_UNDOTS2
s_dbClusterInst=2
s_db_oh=/u01/app/oracle/product/11.0.1_erppat


15) Create a Context File for the Secondary Node
Navigate to [NEW_ORACLE_HOME]/appsutil/clone/bin and run the adclonectx.pl utility as follows:

perl adclonectx.pl \
contextfile=[Path to Existing Context File from the First Node] \
template=[NEW ORACLE_HOME]/appsutil/template/adxdbctx.tmp \
pairsfile=[NEW ORACLE_HOME]/appsutil/clone/pairsfile.txt \
addnode


Where:

contextfile : Full path to the existing context file from the first (primary) node.
template : Full path to the existing database context file template.
pairsfile : Full path to the pairsfile created on last step.

Note—Please perform following step before proceed.
./runInstaller -detachHome ORACLE_HOME=/u01/app/oracle/product/11.0.1_erppat

Note: If the most current AutoConfig Template patch as listed in OracleMetalink Note 387859.1 has already been applied to the source system, it is necessary to edit the value of the target system context variable "s_db_listener" to reflect the desired name for the tns listener. The traditionally accepted value is "LISTENER_[HOSTNAME]" but may be any valid value unique to the target host.
Also check and change local_listener and remore listener value at context file.

16 ) Configure NEW ORACLE_HOME
Run the commands below to move to the correct directory and continue the cloning process: $ cd [NEW ORACLE_HOME]/appsutil/clone/bin
$ perl adcfgclone.pl dbTechStack [Full path to the database context file created in previous step]
   check the logfiles in case completion with warnings.


17) Source the new environment file in the ORACLE_HOME
Run the commands below to move to the correct directory and source the environment:

$ cd [NEW ORACLE_HOME]
$ ./[CONTEXT_NAME].env

18) Modify [SID]_APPS_BASE.ora
Edit the [SID]_APPS_BASE.ora file and change the control file parameter to reflect the correct control file location on the shared storage. This will be the same value as in the [SID]_APPS_BASE.ora on the target system primary node which was just created.

19) Start Oracle RAC Database
Start the database using the following commands:

SQL> connect / as sysdba
SQL> startup

20) Execute AutoConfig on both the node. (Point TNS_ADMIN to ASM Home)
Run AutoConfig to generate the proper listener.ora and tnsnames.ora files:

$ cd $ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME
$ ./adautocfg.sh appspass=[APPS Password]

21) Point TNS_ADMIN to ASM HOME/network/admin, shutdown EBS RDBMS listeners and start ASM listeners at both the tiers.

Check that Actual IP’s are also included, otherwise add.

e.g --
{server0090:oracle:}: /u01/app/oracle/product/asm/network/admin =>cat listener.ora
# listener.ora.server0090 Network Configuration File: /u01/app/oracle/product/asm/network/admin/listener.ora.server0090
# Generated by Oracle configuration tools.
LISTENER_SERVER0090 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = server0090-vip)(PORT = 1591)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = server0090-vip)(PORT = 1922)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = server0090-vip)(PORT = 1923)(IP = FIRST))