分类: Oracle
2009-04-14 12:59:07
备份脚本分享一下,集群环境:
全备:
export ORACLE_SID=solo1
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.3
rq=` date +"20%y%m%d%H%M%S" `
/oracle/app/oracle/product/10.2.3/bin/rman nocatalog target rman/rman log=/oracle/rman /backup_log/backupall_$rq.log<
run
{
allocate channel ch1 device type disk connect ;
allocate channel ch2 device type disk connect ;
allocate channel ch3 device type disk connect ;
allocate channel ch4 device type disk connect ;
allocate channel ch5 device type disk connect ;
allocate channel ch6 device type disk connect ;
allocate channel ch7 device type disk connect ;
allocate channel ch8 device type disk connect ;
crosscheck backup;
crosscheck archivelog all;
sql 'alter system archive log current';
backup database format '/eaibak/fullbak/db_%d_%T_%U';
sql 'alter system archive log current';
backup archivelog all format '/eaibak/fullbak/arc_%t_%s' delete all input;
backup format '/eaibak/fullbak/cntrl_%s_%p_%t' current controlfile;
crosscheck backup;
crosscheck archivelog all;
delete expired backup;
delete obsolete;
delete noprompt backup of database completed before 'sysdate -15';
delete archivelog all;
delete noprompt backup of archivelog all completed before 'sysdate -15';
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
release channel ch8;
}
EOF
归档:
export ORACLE_SID=solo1
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.3
rq=` date +"20%y%m%d%H%M%S" `
/oracle/app/oracle/product/10.2.3/bin/rman nocatalog target rman/rman log=/oracle/rman /backup_log/backuparc_$rq.log<
{
allocate channel ch1 device type disk connect ;
allocate channel ch2 device type disk connect ;
allocate channel ch3 device type disk connect ;
allocate channel ch4 device type disk connect ;
allocate channel ch5 device type disk connect ;
allocate channel ch6 device type disk connect ;
allocate channel ch7 device type disk connect ;
allocate channel ch8 device type disk connect ;
sql 'alter system archive log current';
backup archivelog all format '/eaibak/fullbak/arc_%t_%s' delete all input;
crosscheck archivelog all;
delete archivelog all;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
release channel ch8;
}
EOF
可以大致的监控到RMAN备份进行的程度
SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;