开源中文网

您的位置: 首页 > 数据库应用 > Oracle > 正文

备份脚本分享一下,集群环境

来源:  作者:

备份脚本分享一下,集群环境: 

全备: 

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<<EOF 
run 

allocate channel ch1 device type disk connect sys/eaidba@solo1; 
allocate channel ch2 device type disk connect sys/eaidba@solo1; 
allocate channel ch3 device type disk connect sys/eaidba@solo1; 
allocate channel ch4 device type disk connect sys/eaidba@solo1; 
allocate channel ch5 device type disk connect sys/eaidba@solo2; 
allocate channel ch6 device type disk connect sys/eaidba@solo2; 
allocate channel ch7 device type disk connect sys/eaidba@solo2; 
allocate channel ch8 device type disk connect sys/eaidba@solo2; 
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<<EOF 
run 

allocate channel ch1 device type disk connect sys/eaidba@solo1; 
allocate channel ch2 device type disk connect sys/eaidba@solo1; 
allocate channel ch3 device type disk connect sys/eaidba@solo1; 
allocate channel ch4 device type disk connect sys/eaidba@solo1; 
allocate channel ch5 device type disk connect sys/eaidba@solo2; 
allocate channel ch6 device type disk connect sys/eaidba@solo2; 
allocate channel ch7 device type disk connect sys/eaidba@solo2; 
allocate channel ch8 device type disk connect sys/eaidba@solo2; 
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; 

Tags:备份 脚本 分享
关于开源中文网 - 联系我们 - 广告服务 - 网站地图 - 版权声明