RMAN恢復指令碼案例
$ crontab -l
0 12,19 * * * $ORACLE_HOME/scripts/arcbkup.sh
59 03 * * * $ORACLE_HOME/scripts/dbbkup.sh
30 9 * * * $ORACLE_HOME/scripts/delete.sh
5 20 * * * $ORACLE_HOME/nmon.sh
$ more $ORACLE_HOME/scripts/arcbkup.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/bkup_proarc.rman log=XXX.log
exit 0
$ more /u3/ERP/db/tech_st/11.2.0/scripts/dbbkup.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/bkup_orapro.rman log=XXX.log
exit 0
$ more /u3/ERP/db/tech_st/11.2.0/scripts/delete.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/delete.rman log=XXX.log
exit 0
$ more bkup_proarc.rman
run {
allocate channel aaa device type sbt;
sql 'alter system archive log current';
backup
filesperset 40
format 'al_%s_%p_%t'
archivelog all delete input;
release channel aaa;
}
$ more bkup_orapro.rman
run {
allocate channel c1 device type sbt;
allocate channel c2 device type sbt;
backup
filesperset 40
format '%d_%t_%s_%p'
tag tiv_full
database;
sql 'alter system archive log current';
backup
filesperset 60
tag arclog
archivelog all delete input;
backup current controlfile;
release channel c1;
release channel c2;
}
$ more delete.rman
run {
delete noprompt obsolete;
}
另外一種備份方式:
[oracle@mds db]$ more /script/fullback.sh
#!/bin/sh
export ORACLE_HOME=XXX
export ORACLE_SID=XXX
$ORACLE_HOME/bin/rman log=XXX/fullback.log <<EOF
connect target /
connect catalog rman/rman@RMAN
run{
allocate channel 'd1' type disk;
allocate channel 'd2' type disk;
allocate channel 'd3' type disk;
backup incremental level=0 database format='XXX/%U.bak' tag='full_bak';
sql 'alter system archive log current';
backup format 'XXX/log/%U.bak' archivelog from time 'sysdate-7';
DELETE noprompt ARCHIVELOG ALL COMPLETED BEFORE 'sysdate-7';
release channel d1;
release channel d2;
release channel d3;
}
exit;
EOF
[oracle@mds db]$ more XXX/deleteback.sh
#!/bin/sh
export ORACLE_HOME=XXX
export ORACLE_SID=XXX
$ORACLE_HOME/bin/rman log=XXX/deleteback.log <<EOF
connect target /
connect catalog rman/rman@RMAN
run{
crosscheck backup;
delete noprompt obsolete;
}
exit;
EOF
windows平臺備份指令碼(需測試):
RUN {
allocate channel c1 type disk;
backup database format 'c:/rman_backup/db_%U' plus archivelog format 'c:/rman_backup/arch_%U';
release channel c1;
}
0 12,19 * * * $ORACLE_HOME/scripts/arcbkup.sh
59 03 * * * $ORACLE_HOME/scripts/dbbkup.sh
30 9 * * * $ORACLE_HOME/scripts/delete.sh
5 20 * * * $ORACLE_HOME/nmon.sh
$ more $ORACLE_HOME/scripts/arcbkup.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/bkup_proarc.rman log=XXX.log
exit 0
$ more /u3/ERP/db/tech_st/11.2.0/scripts/dbbkup.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/bkup_orapro.rman log=XXX.log
exit 0
$ more /u3/ERP/db/tech_st/11.2.0/scripts/delete.sh
#/usr/bin/sh
#. XXX.env
. XXX.env
rman target / cmdfile=XXX/delete.rman log=XXX.log
exit 0
$ more bkup_proarc.rman
run {
allocate channel aaa device type sbt;
sql 'alter system archive log current';
backup
filesperset 40
format 'al_%s_%p_%t'
archivelog all delete input;
release channel aaa;
}
$ more bkup_orapro.rman
run {
allocate channel c1 device type sbt;
allocate channel c2 device type sbt;
backup
filesperset 40
format '%d_%t_%s_%p'
tag tiv_full
database;
sql 'alter system archive log current';
backup
filesperset 60
tag arclog
archivelog all delete input;
backup current controlfile;
release channel c1;
release channel c2;
}
$ more delete.rman
run {
delete noprompt obsolete;
}
另外一種備份方式:
[oracle@mds db]$ more /script/fullback.sh
#!/bin/sh
export ORACLE_HOME=XXX
export ORACLE_SID=XXX
$ORACLE_HOME/bin/rman log=XXX/fullback.log <<EOF
connect target /
connect catalog rman/rman@RMAN
run{
allocate channel 'd1' type disk;
allocate channel 'd2' type disk;
allocate channel 'd3' type disk;
backup incremental level=0 database format='XXX/%U.bak' tag='full_bak';
sql 'alter system archive log current';
backup format 'XXX/log/%U.bak' archivelog from time 'sysdate-7';
DELETE noprompt ARCHIVELOG ALL COMPLETED BEFORE 'sysdate-7';
release channel d1;
release channel d2;
release channel d3;
}
exit;
EOF
[oracle@mds db]$ more XXX/deleteback.sh
#!/bin/sh
export ORACLE_HOME=XXX
export ORACLE_SID=XXX
$ORACLE_HOME/bin/rman log=XXX/deleteback.log <<EOF
connect target /
connect catalog rman/rman@RMAN
run{
crosscheck backup;
delete noprompt obsolete;
}
exit;
EOF
windows平臺備份指令碼(需測試):
RUN {
allocate channel c1 type disk;
backup database format 'c:/rman_backup/db_%U' plus archivelog format 'c:/rman_backup/arch_%U';
release channel c1;
}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29135257/viewspace-1733604/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN備份恢復測試指令碼指令碼
- RMAN恢復案例:丟失全部資料檔案恢復
- 【RMAN】RMAN備份恢復1 RMAN冷備指令碼與crontab計劃任務指令碼
- 【RMAN】RMAN備份恢復2 RMAN熱備指令碼與crontab計劃任務指令碼
- 【RMAN】RMAN備份恢復3 RMAN增量備份指令碼與crontab計劃任務指令碼
- RMAN恢復案例:丟失非系統資料檔案恢復
- rman 異機恢復指令碼(路徑不一致)指令碼
- mysql增量恢復指令碼MySql指令碼
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- RMAN恢復 執行重要檔案RMAN恢復
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- oracle10gR2之RMAN異機恢復案例Oracle
- 【RMAN】RMAN跨版本恢復(上)
- 【RMAN】RMAN跨版本恢復(中)
- RMAN恢復 執行不重要檔案的RMAN恢復
- rman備份恢復-rman恢復資料檔案測試
- RMAN備份恢復典型案例——跨平臺遷移pdb
- RMAN恢復案例:無恢復目錄,丟失全部資料檔案、控制檔案、日誌檔案恢復
- RMAN恢復實踐
- rman恢復方案和oracle異機恢復Oracle
- rman 恢復機制與恢復測試
- oracle實驗記錄 (恢復-rman恢復)Oracle
- rman備份恢復-rman入門
- rman指令碼指令碼
- 【備份恢復】不使用rman工具就能恢復被rm刪除的資料檔案案例
- RMAN備份恢復典型案例——資料檔案存在壞快
- rman恢復--丟失控制檔案的恢復
- rman恢復 使用switch映像副本進行恢復
- 【MySQL】Xtrabackup備份及恢復指令碼MySql指令碼
- Oracle RMAN恢復測試Oracle
- RMAN恢復控制檔案
- Oracle rman 各種恢復Oracle
- RMAN其他恢復主題
- Oracle RMAN異機恢復Oracle
- RMAN恢復資料庫資料庫
- rman 恢復資料塊
- rman恢復資料塊
- RMAN恢復簡單操作