There
are many ways to Duplicate/Copy one database to another using RMAN. The details
below are not meant to replace Oracle documenation and may not cover all
scenarios. The intent for this wiki page is to document the steps frequently
used to duplicate a database from a specified backup location.
The
assumption is that all files needed for the restore (backupset, archive logs
and control file) will be within a single directory location on the TARGET
server under /backup.
PREPARE:
•
Comment out any backup or archivelog backups from running (via cron or
otherwise) while this restore is occurring.
•
Capture any database accounts that will need to be restored. These will be
needed in the POST-REFRESH steps.
•
cd $ORACLE_HOME/dbs
•
mv initPROD.ora initPROD.ora.orig
•
Connected as sysdba, create pfile from spfile; followed by exit;
•
vi initPROD.ora (remove top lines of file with PROD and update control_files
line to read *.control_files='+REDO1','+REDO2' #Restore Controlfile
REFRESH:
•
On the Target database, connect to SQL*Plus as sysdba and issue shutdown
immediate; followed by exit;
•
rm $ORACLE_HOME/dbs/snap*, .dat, lk files
•
Connect to ASM database using .oraenv and entering +ASM and then asmcmd -p
•
Clean out all ASM files UNDER directories DATA/PROD, FRA/PROD, REDO1, REDO2
•
Reconnect to TARGET database using .oraenv and entering PROD
•
srvctl remove database -d PROD
•
add to /etc/oratab the following entry: PROD:/u01/app/oracle/product/12.1.0.2/dbhome_1:N
•
Connected as sysdba, create spfile from pfile;
•
Connected as sysdba, startup nomount; followed by exit;
•
On the TARGET database server issue: Rman auxiliary /
•
DUPLICATE DATABASE TO PROD NOFILENAMECHECK BACKUP LOCATION
'/backup/PPT1_BFR_LIVE_REFRESH/';
POST-REFRESH:
•
At the server prompt type: more initPROD.ora.orig (The purpose here is so you
can cut and paste in the CREATE SPFILE line coming up.)
•
Connect to SQL*Plus as sysdba
•
create pfile from spfile;
•
create SPFILE='+DATA/PROD/spfilePROD.ora' from pfile;
•
shutdown immediate; followed by exit;
•
mv initPROD.ora initPROD.ora.lns
•
mv initPROD.ora.orig initPROD.ora
•
rm lkPROD spfilePROD.ora hc_PROD.dat
•
srvctl add database -d PROD -o /u01/app/oracle/product/12.1.0.2/dbhome_1 -p
'+DATA/PROD/spfilePROD.ora' -a DATA,FRA,REDO1,REDO2
•
srvctl start database -d PROD
•
register database in RMAN
•
CONFIGURE RETENTION POLICY TO REDUNDANCY 3; <-- database="" dependent="" environment="" o:p="" on="">-->
•
CONFIGURE DEVICE TYPE DISK PARALLELISM 6 BACKUP TYPE TO BACKUPSET;
•
CONFIGURE COMPRESSION ALGORITHM 'LOW';
•
Turn on any cron entries that were commented out, if any.
•
Restore any database accounts captured before the process started.
No comments:
Post a Comment