Monday, 13 February 2017

RMAN duplicate database restore scripts for EBSR12

Creating script for RMAN duplicate database restore for EBS R12

echo  " Recovery_start_time";
echo "date '+%Y/%m/%d @ %H:%M:%S'";
export ORACLE_SID=${ORACLE_SID};
rman log ="/bu/PRD_BKP/${ORACLE_SID}_Recovery_$(date '+%y%m%d@%H%M%S').log" <<EOF
CONNECT AUXILIARY /
run {
allocate auxiliary channel ch1 device type disk;
allocate auxiliary channel ch2 device type disk;
allocate auxiliary channel ch3 device type disk;
allocate auxiliary channel ch4 device type disk;
allocate auxiliary channel ch5 device type disk;
allocate auxiliary channel ch6 device type disk;
allocate auxiliary channel ch7 device type disk;
SET NEWNAME FOR DATAFILE 1 TO '/tdxdbd1/PROJ4/data/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/tdxdbd1/PROJ4/data/system02.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/tdxdbd1/PROJ4/data/system03.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/tdxdbd1/PROJ4/data/system04.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/tdxdbd1/PROJ4/data/system05.dbf';
SET NEWNAME FOR DATAFILE 6 TO '/tdxdbd1/PROJ4/data/system06.dbf';
SET NEWNAME FOR DATAFILE 7 TO '/tdxdbd1/PROJ4/data/system07.dbf';
SET NEWNAME FOR DATAFILE 8 TO '/tdxdbd1/PROJ4/data/system08.dbf';
SET NEWNAME FOR DATAFILE 9 TO '/tdxdbd1/PROJ4/data/system09.dbf';
SET NEWNAME FOR DATAFILE 10 TO '/tdxdbd1/PROJ4/data/system10.dbf';
SET NEWNAME FOR DATAFILE 11 TO '/tdxdbd1/PROJ4/data/system11.dbf';
SET NEWNAME FOR DATAFILE 12 TO '/tdxdbd1/PROJ4/data/sysaux_01.dbf';
SET NEWNAME FOR DATAFILE 13 TO '/tdxdbd1/PROJ4/data/sysaux_02.dbf';
SET NEWNAME FOR DATAFILE 14 TO '/tdxdbd1/PROJ4/data/undo01.dbf';
SET NEWNAME FOR DATAFILE 15 TO '/tdxdbd1/PROJ4/data/undo02.dbf';
....
....
....
....
SET NEWNAME FOR DATAFILE 113 TO '/tdxdbd1/PROJ4/data/a_txn_data14.dbf';
SET NEWNAME FOR DATAFILE 114 TO '/tdxdbd1/PROJ4/data/a_txn_data13.dbf';
SET NEWNAME FOR DATAFILE 115 TO '/tdxdbd1/PROJ4/data/a_txn_data12.dbf';
SET NEWNAME FOR DATAFILE 116 TO '/tdxdbd1/PROJ4/data/a_txn_data11.dbf';
SET NEWNAME FOR DATAFILE 117 TO '/tdxdbd1/PROJ4/data/a_txn_data10.dbf';
SET NEWNAME FOR DATAFILE 118 TO '/tdxdbd1/PROJ4/data/a_txn_data09.dbf';
SET NEWNAME FOR DATAFILE 119 TO '/tdxdbd1/PROJ4/data/a_txn_data08.dbf';
SET NEWNAME FOR DATAFILE 120 TO '/tdxdbd1/PROJ4/data/a_txn_data07.dbf';
SET NEWNAME FOR DATAFILE 121 TO '/tdxdbd1/PROJ4/data/a_txn_data06.dbf';
SET NEWNAME FOR DATAFILE 122 TO '/tdxdbd1/PROJ4/data/a_txn_data05.dbf';
SET NEWNAME FOR DATAFILE 123 TO '/tdxdbd1/PROJ4/data/a_txn_data04.dbf';
SET NEWNAME FOR DATAFILE 124 TO '/tdxdbd1/PROJ4/data/a_txn_data03.dbf';
SET NEWNAME FOR DATAFILE 125 TO '/tdxdbd1/PROJ4/data/a_txn_data02.dbf';
SET NEWNAME FOR DATAFILE 126 TO '/tdxdbd1/PROJ4/data/a_txn_data01.dbf';
SET NEWNAME FOR DATAFILE 127 TO '/tdxdbd1/PROJ4/data/a_txn_ind23.dbf';
SET NEWNAME FOR DATAFILE 128 TO '/tdxdbd1/PROJ4/data/a_txn_ind22.dbf';
SET NEWNAME FOR DATAFILE 130 TO '/tdxdbd1/PROJ4/data/a_txn_ind20.dbf';
SET NEWNAME FOR DATAFILE 131 TO '/tdxdbd1/PROJ4/data/a_txn_ind19.dbf';
SET NEWNAME FOR DATAFILE 132 TO '/tdxdbd1/PROJ4/data/a_txn_ind18.dbf';
SET NEWNAME FOR DATAFILE 133 TO '/tdxdbd1/PROJ4/data/a_txn_ind17.dbf';
SET NEWNAME FOR DATAFILE 134 TO '/tdxdbd1/PROJ4/data/a_txn_ind16.dbf';
SET NEWNAME FOR DATAFILE 135 TO '/tdxdbd1/PROJ4/data/a_txn_ind15.dbf';
SET NEWNAME FOR DATAFILE 136 TO '/tdxdbd1/PROJ4/data/a_txn_ind13.dbf';
SET NEWNAME FOR DATAFILE 137 TO '/tdxdbd1/PROJ4/data/a_txn_ind12.dbf';
SET NEWNAME FOR DATAFILE 138 TO '/tdxdbd1/PROJ4/data/a_txn_ind11.dbf';
SET NEWNAME FOR DATAFILE 139 TO '/tdxdbd1/PROJ4/data/a_txn_ind10.dbf';
SET NEWNAME FOR DATAFILE 140 TO '/tdxdbd1/PROJ4/data/a_txn_ind09.dbf';
....
....
....

SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp01.dbf' TO '/bu/PROJ4/data/temp01.dbf';
SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp02.dbf' TO '/bu/PROJ4/data/temp02.dbf';
SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp03.dbf' TO '/bu/PROJ4/data/temp03.dbf';
DUPLICATE DATABASE TO PROJ4 BACKUP LOCATION '/bu/PRD_BKP'
LOGFILE
  GROUP 1 (
    '/sanddata/PROJ4/data/log1a.dbf',
    '/sanddata/PROJ4/data/log1b.dbf'
  ) SIZE 125M,
  GROUP 2 (
    '/sanddata/PROJ4/data/log2a.dbf',
    '/sanddata/PROJ4/data/log2b.dbf'
  ) SIZE 125M,
  GROUP 3 (
    '/sanddata/PROJ4/data/log3a.dbf',
    '/sanddata/PROJ4/data/log3b.dbf'
  ) SIZE 125M,
  GROUP 4 (
    '/sanddata/PROJ4/data/log4a.dbf',
    '/sanddata/PROJ4/data/log4b.dbf'
  ) SIZE 125M,
  GROUP 5 (
    '/sanddata/PROJ4/data/log5a.dbf',
    '/sanddata/PROJ4/data/log5b.dbf'
  ) SIZE 125M
;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
}
host "echo  Recovery_endttime";
host "date '+%Y/%m/%d @ %H:%M:%S'";
EOF

No comments:

Post a Comment