Backup
=========
run
{
allocate channel ch1 device type sbt_tape;
send 'NSR_ENV=(NSR_SERVER=*****,NSR_CLIENT=*****,NSR_DATA_VOLUME_POOL=*****)';
restore controlfile from 'MYSID_c-569933170-20171012-03';
release channel ch1;
}
$ cat invoke_restore_MYSID.ksh
export ORACLE_SID=MYSID
export ORACLE_HOME=/applic/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
rman target / log=MYSID_restore_$(date '+%Y%m%d_%H%M%S').log cmdfile=restore_MYSID.rcv
$ cat restore_MYSID.rcv
run
{
allocate channel ch1 device type sbt_tape;
allocate channel ch2 device type sbt_tape;
allocate channel ch3 device type sbt_tape;
allocate channel ch4 device type sbt_tape;
allocate channel ch5 device type sbt_tape;
allocate channel ch6 device type sbt_tape;
set until time "to_date('10/12/2017 15:01:39', 'mm/dd/yyyy hh24:mi:ss')";
send 'NSR_ENV=(NSR_SERVER=*****,NSR_CLIENT=*****,NSR_DATA_VOLUME_POOL=*****)';
set newname for database to '+DATA_DG'
restore database;
switch datafile all;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
}
$ cat recover_MYSID.rcv
run
{
allocate channel ch1 device type sbt_tape;
allocate channel ch2 device type sbt_tape;
allocate channel ch3 device type sbt_tape;
allocate channel ch4 device type sbt_tape;
allocate channel ch5 device type sbt_tape;
allocate channel ch6 device type sbt_tape;
set until time "to_date('10/12/2017 15:01:39', 'mm/dd/yyyy hh24:mi:ss')";
send 'NSR_ENV=(NSR_SERVER=*****,NSR_CLIENT=*****,NSR_DATA_VOLUME_POOL=*****)';
recover database;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
}
restore archivelog from logseq 330570 until logseq 330590;
=========
RUN {
ALLOCATE CHANNEL CH1 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL CH2 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL CH3 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL CH4 TYPE 'SBT_TAPE';
backup incremental level 0 filesperset 1 format '%d_LEVEL0_%s_%t_%p.dbf' database include current controlfile;
sql 'alter system archive log current';
change archivelog all crosscheck;
backup NOT BACKED UP 1 TIMES archivelog all filesperset 1 format '%d_arch_%s_%t_%p.arc';
DELETE ARCHIVELOG ALL BACKED UP 1 TIMES TO DEVICE TYPE sbt COMPLETED BEFORE 'SYSDATE-1/24';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
RELEASE CHANNEL CH3;
RELEASE CHANNEL CH4;
}
RUN {
ALLOCATE CHANNEL CH1 TYPE 'SBT_TAPE' ;
ALLOCATE CHANNEL CH2 TYPE 'SBT_TAPE' ;
ALLOCATE CHANNEL CH3 TYPE 'SBT_TAPE' ;
ALLOCATE CHANNEL CH4 TYPE 'SBT_TAPE' ;
change archivelog all crosscheck;
backup NOT BACKED UP 1 TIMES archivelog all filesperset 1 format '%d_arch_%s_%t_%p.arc' ;
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 1 TIMES TO DEVICE TYPE sbt COMPLETED BEFORE 'SYSDATE-1/24';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
RELEASE CHANNEL CH3;
RELEASE CHANNEL CH4;
}
run {
allocate channel backup_disk1 type disk format '/migration/level0_bkp/db_%s_% t_%p.dbf';
allocate channel backup_disk1 type disk format '/migration/level0_bkp/db_%s_% t_%p.dbf';
allocate channel backup_disk1 type disk format '/migration/level0_bkp/db_%s_% t_%p.dbf';
allocate channel backup_disk1 type disk format '/migration/level0_bkp/db_%s_% t_%p.dbf';
backup as compressed backupset incremental level 1
#backup incremental level 1
filesperset 1 tag 'TEST_STANDARD_LEVEL1' database include current controlfile;
release channel backup_disk1;
release channel backup_disk2;
release channel backup_disk3;
release channel backup_disk4;
}
Restore
========
{
allocate channel ch1 device type sbt_tape;
send 'NSR_ENV=(NSR_SERVER=*****,NSR_CLIENT=*****,NSR_DATA_VOLUME_POOL=*****)';
restore controlfile from 'MYSID_c-569933170-20171012-03';
release channel ch1;
}
$ cat invoke_restore_MYSID.ksh
export ORACLE_SID=MYSID
export ORACLE_HOME=/applic/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
rman target / log=MYSID_restore_$(date '+%Y%m%d_%H%M%S').log cmdfile=restore_MYSID.rcv
$ cat restore_MYSID.rcv
run
{
allocate channel ch1 device type sbt_tape;
allocate channel ch2 device type sbt_tape;
allocate channel ch3 device type sbt_tape;
allocate channel ch4 device type sbt_tape;
allocate channel ch5 device type sbt_tape;
allocate channel ch6 device type sbt_tape;
set until time "to_date('10/12/2017 15:01:39', 'mm/dd/yyyy hh24:mi:ss')";
send 'NSR_ENV=(NSR_SERVER=*****,NSR_CLIENT=*****,NSR_DATA_VOLUME_POOL=*****)';
set newname for database to '+DATA_DG'
restore database;
switch datafile all;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
}
$ cat recover_MYSID.rcv
run
{
allocate channel ch1 device type sbt_tape;
allocate channel ch2 device type sbt_tape;
allocate channel ch3 device type sbt_tape;
allocate channel ch4 device type sbt_tape;
allocate channel ch5 device type sbt_tape;
allocate channel ch6 device type sbt_tape;
set until time "to_date('10/12/2017 15:01:39', 'mm/dd/yyyy hh24:mi:ss')";
send 'NSR_ENV=(NSR_SERVER=*****,NSR_CLIENT=*****,NSR_DATA_VOLUME_POOL=*****)';
recover database;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
}
restore archivelog from logseq 330570 until logseq 330590;