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備份恢復典型案例——異機恢復未知DBID
- RMAN備份恢復典型案例——ORA-00245
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- RMAN增量恢復
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- RMAN恢復實踐
- RMAN恢復之RMAN-06555處理
- RMAN備份恢復典型案例——跨平臺遷移pdb
- rman 增量備份恢復
- Oracle RMAN恢復測試Oracle
- RMAN備份恢復技巧
- RMAN備份恢復典型案例——資料檔案存在壞快
- 查詢RMAN恢復進度
- Oracle RMAN 表空間恢復Oracle
- RMAN備份異機恢復
- rman 備份指令碼指令碼
- Rman_異地、跨平臺、跨版本的恢復總結及案例
- RMAN備份恢復效能優化優化
- 在rman恢復中incarnation的概念
- RMAN備份與恢復測試
- 【MySQL】Xtrabackup備份及恢復指令碼MySql指令碼
- Oracle 備份恢復篇之RMAN catalogOracle
- ORACLE DG從庫 Rman備份恢復Oracle
- rman備份異機恢復(原創)
- RMAN備份恢復典型案例——快速檢查資料庫一致性資料庫
- Vsan資料恢復—Vsan資料恢復案例資料恢復
- 【Vsan資料恢復】Vsan資料恢復案例資料恢復
- 【RMAN】Oracle12c以後rman 備份恢復命令參考Oracle
- 【RMAN】在多租戶環境下的RMAN備份及恢復
- Oracle 12C新特性-RMAN恢復表Oracle
- 12 使用RMAN備份和恢復檔案
- 透過搭建恢復目錄實現RMAN異地備份和恢復
- qcow2恢復案例
- 分享Oracle Rman的備份指令碼Oracle指令碼
- [20190718]12c rman新特性 表恢復.txt
- 備份恢復Lesson 04.Using the RMAN Recovery Catalog
- 【VSAN資料恢復】VSAN儲存資料恢復案例資料恢復
- 【伺服器資料恢復】Vsan資料恢復案例伺服器資料恢復
- shell指令碼案例指令碼