Most of the time Oracle Apps project requires a test instance which is almost similar to Production instance. R12 Production instance can’t be brought down for taking offline clone. So, for online cloning you need to use RMAN. The following is a step by step guide to make a clone instance as similar as Production. Here Production instance is referred as "SOURCE" and test
instance is named as "TARGET".
The assumption is that you have already a R12 target instance which will be refreshed. If you don't have a target instance you need to take an offline backup of Production source instance to create a target instance for the first time. [It's possible to create first target instance online also. I'll write an article later on that.]
1) First take the backup of target database spfile in a pfile
In target db run the following command.
SQL> create pfile='/D02/TARGET/initTARGET.ora' from spfile;
2) Stop the training instance. Both Apps tier and DB tier.
3) Prepare the Source Instance by running preclone in db and apps tier.
db
. /D01/SOURCE/db/tech_st/11.1.0/SOURCE_LONDON.env
cd /D01/SOURCE/db/tech_st/11.1.0/appsutil/scripts/SOURCE_LONDON
perl adpreclone.pl dbTier
apps
. /a01/SOURCE/apps/apps_st/appl/APPSSOURCE_LONDONPAP002.env
cd $ADMIN_SCRIPTS_HOME
perl adpreclone.pl appsTier
4) delete or backup the TARGET instance apps directory. Ensure that you have old context file backup. Also, you may keep old apps env file.
5) start transfering apps tier from TARGET server to SOURCE server using following query. Here we are using rsync to copy to remote directory. Also, we are excluding the concurrent manager log file and particular interface file from copying to remote server.
rsync -az --exclude='xxinterface' --exclude='concmgr' /a01/SOURCE/apps oasTARGET@100.200.10.400:/A01/TARGETAPP/
6) In our case, for RMAN backup, The same /backup directory that is mounted in TARGET database server is also mounted on SOURCE db server as /backup
7) Add the following two lines at the bottom of previously created "/D02/TARGET/initTARGET.ora" file
*.log_file_name_convert=(/D01/SOURCE/db/apps_st/data/,/D02/TARGET/db/apps_st/data/)
*.db_file_name_convert=(/D01/SOURCE/db/apps_st/data/,/D02/TARGET/db/apps_st/data/)
8) Add the target listener information in source tnsnames.ora file.
Open /D02/TARGET/db/tech_st/11.1.0/network/admin/TARGET_LONDONdb001/tnsnames.ora and add the contents from source listener
-----------
9) After setting the the old TARGET db env file start the listener.
. /D02/TARGET/db/tech_st/11.1.0/TARGET_LONDONqdb001.env
lsnrctl start TARGET
lsnrctl start SOURCE
10) Start the source instance with pfile
sqlplus / as sysdba
SQL> startup nomount pfile='/D02/TARGET/initTARGET.ora';
11) delete or backup all the old datafiles
12) Recover the SOURCE Production database in target. In our case, for RMAN backup, The same /backup directory that is mounted in TARGET database server is also mounted on SOURCE db server as /backup
$ rman target sys/****@SOURCE nocatalog auxiliary /
RMAN> DUPLICATE TARGET DATABASE TO 'TARGET';
At the last stage it may show some error. But we'll recover the db by applying archive log.
13) login to the target database using
$ sqlplus / as sysdba
SQL> select status from v$instance; it should be in mount stage.
SQL> recover database using backup controlfile until cancel;
copy the archive file required by the recover command from the source system to the target system. atleast provide 5 archives files. CANCEL the recover command after the desired archive log has been applied. I am giving a sample of this command set.
------------
ORA-00289: suggestion :
/D02/TARGET/db/apps_st/data/archive/1_933_813073562.dbf
ORA-00280: change 5988716976174 for thread 1 is in sequence #933
ORA-00278: log file '/backup/archive_tmp/SOURCE1932813073562.arc' no longer
needed for this recovery
Specify log: {=suggested | filename | AUTO | CANCEL}
/backup/archive_tmp/SOURCE1933813073562.arc
ORA-00279: change 5988717746012 generated at 05/24/2013 03:29:30 needed for
thread 1
ORA-00289: suggestion :
/D02/TARGET/db/apps_st/data/archive/1_934_813073562.dbf
ORA-00280: change 5988717746012 for thread 1 is in sequence #934
ORA-00278: log file '/backup/archive_tmp/SOURCE1933813073562.arc' no longer
needed for this recovery
Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
------------
14) Open the database with resetlogs.
SQL> alter database open resetlogs;
shutdown database
SQL> shut immediate
15) Disable the archive log mode if required. Goto mount stage
SQL> startup mount
SQL> alter database noarchivelog;
SQL> alter database open;
Remove all trace files & alertlog file from udump and bdump.
SQL> shutdown immediate
$ cd bdump/ udump/ $ rm *
create spfile from current pfile
$ sqlplus / as sysdba
SQL> startup
16)Temperory files should be added with following cmds
SQL> ALTER TABLESPACE temp1 ADD TEMPFILE '/D02/TARGET/db/apps_st/data/temp1.dbf' SIZE 1024m;
SQL> ALTER TABLESPACE temp2 ADD TEMPFILE '/D02/TARGET/db/apps_st/data/temp2.dbf' SIZE 1024m;
17) clean the fnd_nodes info by running following script
SQL> conn apps/appspwd
SQL> EXEC FND_CONC_CLONE.SETUP_CLEAN();
SQL> commit;
SQL> create spfile from pfile
--------
18) In the application tier run adcfgclone with old context file to configure apps tier.
cd /A01/TARGETAPP/apps/apps_st/comn/clone/bin/
perl adcfgclone.pl appsTier /A01/TARGETAPP/inst/apps/TARGET_LONDON001/appl/admin/TARGET_LONDON001.xml
--------
19) change custom env file name and custom top location inside that file.
run db autoconfig
run apps autoconfig
restart apps and db
20) Do post clone activities and password change etc.. If you are facing some issues, you can leave a comment below.
No comments:
Post a Comment