DUPLICATE RMAN DATABASE PROCESS
Document Scope:
Standalone database 11gR2
Prepare your Target ENV or Steps to be done
1. Stop all the monitoring jobs, including backup
2. Set the ENV Variables
3. Check available Space as you might running low on Space.
4. Ping both Target and Source vise versa, and make sure you are able to Ping it. (tnsping dbname)
5. Take export of table / tables needs to be restore after PROD Copy in target DB.
6. Get the Id's with passwords and other details(roles) in case you want to restore back(as some times you don't want PROD ID's)
7. Get Directory structure from existing database in Target
8. Also get DB Links, which you need to restore later.
9. Cleanup the Archive log location and Flashback files.
10. Clean the listener log or move the file.
11. After shutdown of database you can also Copy the control files to be on Safe side.
12. From Source Database, must get the Last full backup time under its logs, and get the exact time and add one or two mins more, OR you can have specific time which you want.
Run the under mentioned script, when you all set, and check the logs,
I usually run it in nohup as under command and on Target database only
mtanbusy@mt7007:mtandonm:/export/home/mtanbusy $nohup /export/home/mtanbusy/mtanp1_to_mtandonm_duplicate.rman.20130808 &
Do the tail on this file to check its logs as under
tail -f mtanp1_to_mtandonm_duplicate_20130808.log
This is my Script which I used to get the PROD Copy for DEV
NOTE:- Always check the PROD Data file count before firing it or while creating the script, so you won't get Error while running and make sure you have enough space under DEV to accommodate the data as said above.
mtanbusy@mt7007:mtandonm:/export/home/mtanbusy $ vi mtanp1_to_mtandonm_duplicate.rman.20130808
. /var/opt/oracle/bin/mtandonm.env ## This is my Variable File on this location or you can set manual
LOG_DIR=/export/home/mtanbusy
LOG_FILE='mtanp1_to_mtandonm_duplicate_20130808.log'
rman log=$LOG_FILE append MSGNO <
connect catalog rman/XXXXX@gdbp1;
connect auxiliary sys/XXXXX@mtandonm;
run
{
set until time "to_date('2013-08-08:23:57:00','YYYY-MM-DD:hh24:mi:ss')"; ## PROD Ful backup Time
allocate auxiliary channel ax1 device type 'SBT' parms 'ENV=(TDPO_OPTFILE=/m060/tsm/tdpo-mtandonm_mtanp1.opt)';
allocate auxiliary channel ax2 device type 'SBT' parms 'ENV=(TDPO_OPTFILE=/m060/tsm/tdpo-mtandonm_mtanp1.opt)';
allocate auxiliary channel ax3 device type 'SBT' parms 'ENV=(TDPO_OPTFILE=/m060/tsm/tdpo-mtandonm_mtanp1.opt)';
SET NEWNAME FOR tempfile 1 TO "/m061/mtanbusy/mtandonmdata/temp01.dbf";
SET NEWNAME FOR DATAFILE 1 TO "/m060/mtanbusy/mtandonmdata/system01.dbf";
SET NEWNAME FOR DATAFILE 2 TO "/m062/mtanbusy/mtandonmdata/MTANP1TS1Y.dbf";
SET NEWNAME FOR DATAFILE 3 TO "/m063/mtanbusy/mtandonmdata/DBATBS1.dbf";
SET NEWNAME FOR DATAFILE 4 TO "/m062/mtanbusy/mtandonmdata/TOADTS1.dbf";
SET NEWNAME FOR DATAFILE 5 TO "/m063/mtanbusy/mtandonmdata/USER01.dbf";
SET NEWNAME FOR DATAFILE 6 TO "/m062/mtanbusy/mtandonmdata/SYSAUX01.dbf";
SET NEWNAME FOR DATAFILE 7 TO "/m063/mtanbusy/mtandonmdata/TOOLS01.dbf";
logfile
GROUP 1 (
'/m060/mtanbusy/mtandonmdata/redo01a.log',
'/m061/mtanbusy/mtandonmdata/redo01b.log'
) SIZE 1024M,
GROUP 2 (
'/m060/mtanbusy/mtandonmdata/redo02a.log',
'/m061/mtanbusy/mtandonmdata/redo02b.log'
) SIZE 1024M,
GROUP 3 (
'/m060/mtanbusy/mtandonmdata/redo03a.log',
'/m061/mtanbusy/mtandonmdata/redo03b.log'
) SIZE 1024M;
}
EOF
ERROR_CODE=$?
if [ "$ERROR_CODE" != 0 ]; then
echo "" >>$LOG_FILE
date >>$LOG_FILE
echo "*** ERROR ***" >>$LOG_FILE
echo "*** Problem in DB Duplicate" >>$LOG_FILE
echo "" >>$LOG_FILE
exit $ERROR_CODE;
fi
echo 'End DB Duplicate ' $(date) >>$LOG_FILE
================
After its Completion, might take few hours depending on size and network.
Do the Following RMAN Steps
1. RMAN
RMAN> CONNECT TARGET /;
RMAN> connect catalog rman/XXXXX@gdbp1;
RMAN> REGISTER DATABASE;
2. Upgrade catalog;
it will ask you again and say the same (it will take few min)
3. Put the RMAN Persistence parameter back in it.
Beside this, do the following as well;
1. Take out the PROD ID's which you don't need.
2. Put the Id's which were there before DB Refresh, as we created Script earlier
3. Change the Password of Functional ID's as earlier said, we don't want to have PROD Password.
4. Remove the directories and DB Links as these are from PROD.
5. Must Put back the old directories and DB links as we took before refresh.
6. Revert back your Monitoring under OEM GRID and other tools.
7. Release your backup jobs if on Hold.
Hope you will be Happy after following all these Steps .. Good Luck.
No comments:
Post a Comment