Monday, July 13, 2009

Cloning an R12 instance using RMAN backup

- Copy the full backup pieces to the target instance /u01/restore as follows from the sources backup instance (includes level0, level1, arch, controlfile, dbstack and backup)
$ scp -r .
oradev@derp:/u01/restore
- copy appsstack backup to derp
scp -r .
Oradev@derp:/u11/restore
- Set the following environment variables, export ORACLE_SID=PROD
- Startup the instance no mount state,
sql> startup nomount;
- Restore the control file to the new location (old instance path) as follows, $rman target / no catalog set DBID=85045275 restore controlfile from '/u01/restore/rman/ctlback/DP6A_ctl_c-85045275-20090528-03'; startup mount;
- Rename the Redologfiles,so that they can be created in new locations when opened the database is opened in resetlogs,
SQL>alter database rename file '/t2/oracle/PROD/db/apps_st/data/log02a.dbf' to '/u02/oracle/DEV/db/apps_st/data/log02a.dbf';
alter database rename file '/t2/oracle/PROD/db/apps_st/data/log02b.dbf' to '/u02/oracle/DEV/db/apps_st/data/log02b.dbf';
alter database rename file '/t2/oracle/PROD/db/apps_st/data/log01a.dbf' to '/u02/oracle/DEV/db/apps_st/data/log01a.dbf';
alter database rename file '/t2/oracle/PROD/db/apps_st/data/log01b.dbf' to '/u02/oracle/DEV/db/apps_st/data/log01b.dbf';
- RMAN> catalog the backup pieces, so that RMAN will know the new locations if you have the backuppieces are in different path other than source path
RMAN> CATALOG START WITH '/u01/restore/';
Note: We should ship all the available backup pieces even if we restore the latest one.
- This is an incomplete recovery, so we'll restore up to the available archive log sequence+1, (928+1)
sql> set num 20; sql> select first_change#, sequence# from v$archived_log order by first_change# desc;
- Connect to RMAN and start the restore and recovery
- Create temp file and drop the old one pointing to the old location (v$tempfile).
1. CREATE TEMPORARY TABLESPACE temp2 TEMPFILE '/u03/oradata1/temp02.dbf' size 5M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;
2. ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2;
3. DROP TABLESPACE temp1; 4. DROP TABLESPACE temp2;
- The ORACLE_SID will not be changed during this restore, we need to change it using NID after the restore
sql>shutdown immediate; sql>startup mount; sql> alter database noarchivelog;
$ nid target=sys/change_on_install DBNAME=DEV SETNAME=Y
Then change the db_name in pfile to DEV
Then open the database with resetlogs;
Remember to restart the database with the changed SID as ORACLE_SID variable and make the changes in the pfile also
- Clean the FND_NODES table and repopulate it ( as APPS user)
SQL> exec apps.fnd_conc_clone.setup_clean;
- Start the database listener
- 1. Execute $AD_TOP/bin/admkappsutil.pl to generate appsutil.zip for the database tier on source instance.
2. From the 10g ORACLE_HOME/appsutil/bin directory, execute AutoConfig on the database tier by running the adconfig.pl script (it'll create the env files and the template scripts).
- Configure the target system application tier server node (run adcfgclone on APPS tier)
- change APPS password using FNDCPASS (if required) and run autoconfig.

No comments: