记录rman的备份脚本

增备

$ cat  racdb_incr.sh  
#!/bin/ksh

dt=`date +%Y%m%d`
export ORACLE_SID=racdb1

rman target /  >/home/oracle/log/20330arch_$dt.log << EOF
run{
CONFIGURE BACKUP OPTIMIZATION ON;                          
CONFIGURE CONTROLFILE AUTOBACKUP ON;                       
CONFIGURE DEFAULT DEVICE TYPE TO 'sbt_tape';
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 900 DAYS; 
allocate channel c1 type 'sbt_tape' parms  'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'
connect  "sys/XXXXXXXXXXXXXXx@racdb1";
allocate channel c2 type 'sbt_tape' parms  'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'
connect  "sys/XXXXXXXXXXXXXX@racdb2";
sql "alter system archive log current";
backup  format '20330arch_%U_%T.bak' archivelog all delete input;
configure controlfile autobackup format for device type 'sbt_tape' to '20330arch_controlfile_spfile_%F';
release channel c1;
release channel c2;
}
exit;
EOF

全备

$ cat racdb_full.sh
#!/bin/ksh

dt=`date +%Y%m%d`
export ORACLE_SID=racdb1
export TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt

rman target /  >/home/oracle/log/20330full_$dt.log << EOF
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 900 DAYS;
configure controlfile autobackup format for device type 'sbt_tape' to '20330full_controlfile_spfile_%F';
backup database format '20330full_%U_%T.bak';
exit;
EOF

标签: none

评论已关闭