[Rman]Oracle Rman增量備份Level012指令碼
Rman Level012備份實驗http://blog.itpub.net/29812844/viewspace-1988837/
採用0221222增量備份策略,7天一個輪迴
也就是週日0級備份,周1 2 4 5 6 採用2級增量備份,周3採用1級增量備份
開啟控制檔案自動備份
11g控制檔案自動備份新特性:http://blog.csdn.net/u011364306/article/details/50051303
配置控制檔案備份路徑
將過期天數設為7天
建立資料備份目錄
指令碼解釋:
下面開始建立0級 1級 2級備份指令碼
0級備份指令碼
1級備份指令碼
2級備份指令碼
加入到crontab中
Rman備份中變數的含義
backup incremental level 0 database format='LEV0_%d_%t_%U_%s_%p'
format=string 檔案路徑和名稱的格式串,其中可包含宏變數:
%c copy ID
%p backup piece ID
%s backup set ID
%e log sequence
%h log thread ID
%d database name
%n database name(x填充到8個字元)
%I DBID
%f file ID
%F DBID, day, month, year, and sequencer的複合
%N tablespace name
%t timestamp
%M mh mm格式
%Y year yyyy格式
%u backup set+time((x填充到8個字元)
%U %u_%p_%c
%% %
The format specifier %U is replaced with unique filenames for the files when you take backups.
the %F element of the format string combines the DBID, day, month, year, and sequence number to generate a unique filename. %F must be included in any control file autobackup format.
採用0221222增量備份策略,7天一個輪迴
也就是週日0級備份,周1 2 4 5 6 採用2級增量備份,周3採用1級增量備份
開啟控制檔案自動備份
- CONFIGURE CONTROLFILE AUTOBACKUP ON
配置控制檔案備份路徑
- RMAN > CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/file/backup/rman/controlfile_%F'
- RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS
- mkdir -p /file/backup/rman/
-
vim rman_bak_level0.sh
-
#! /bin/bash
-
export ORACLE_BASE=/u01/oracle
-
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
-
export PATH=$ORACLE_HOME/bin:$PATH
-
export ORACLE_SID=neal --資料庫ORACLE_SID
-
export NLS_LANG='AMERICAN_AMERICA.ZHS16GBK' --字符集
-
rman target / <<EOF
-
run{
-
allocate channel d1 type disk; --分配通道d1,型別備份到磁碟
-
allocate channel d2 type disk; --分配通道d2,型別備份到磁碟
-
backup incremental level 0 database format '/file/backup/rman/level0_%d_%s_%p_%u.bkp'; --備份級別、輸出格式、路徑
-
sql 'alter system archive log current'; --對當前redo日誌進行歸檔
-
backup archivelog all delete input format '/file/backup/rman/archivelog_%d_%s_%p_%u.bkp'; --備份歸檔日誌並刪除
-
crosscheck backup; --檢查備份
-
delete noprompt obsolete; --靜默刪除過期備份
-
release channel d1; --釋放通道d1
-
release channel d2; --釋放通道d2
-
}
- EOF
0級備份指令碼
-
vim rman_bak_level0.sh
-
#! /bin/bash
-
export ORACLE_BASE=/u01/oracle
-
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
-
export PATH=$ORACLE_HOME/bin:$PATH
-
export ORACLE_SID=neal
-
export NLS_LANG='AMERICAN_AMERICA.ZHS16GBK'
-
rman target / <<EOF
-
run{
-
allocate channel d1 type disk;
-
allocate channel d2 type disk;
-
backup incremental level 0 database format '/file/backup/rman/level0_%d_%s_%p_%u.bkp';
-
sql 'alter system archive log current';
-
backup archivelog all delete input format '/file/backup/rman/archivelog_%d_%s_%p_%u.bkp';
-
crosscheck backup;
-
delete noprompt obsolete;
-
release channel d1;
-
release channel d2;
-
}
- EOF
-
vim rman_bak_level1.sh
-
#! /bin/bash
-
export ORACLE_BASE=/u01/oracle
-
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
-
export PATH=$ORACLE_HOME/bin:$PATH
-
export ORACLE_SID=neal
-
export NLS_LANG='AMERICAN_AMERICA.ZHS16GBK'
-
rman target / <<EOF
-
run{
-
allocate channel d1 type disk;
-
allocate channel d2 type disk;
-
backup incremental level 1 database format '/file/backup/rman/level1_%d_%s_%p_%u.bkp';
-
sql 'alter system archive log current';
-
backup archivelog all delete input format '/file/backup/rman/archivelog_%d_%s_%p_%u.bkp';
-
crosscheck backup;
-
delete noprompt obsolete;
-
release channel d1;
-
release channel d2;
-
}
- EOF
-
vim rman_bak_level2.sh
-
#! /bin/bash
-
export ORACLE_SID=neal
-
export NLS_LANG='AMERICAN_AMERICA.ZHS16GBK'
-
/u01/oracle/product/11.2.0/db_1/bin/rman target / <<EOF
-
run{
-
allocate channel d1 type disk;
-
allocate channel d2 type disk;
-
backup incremental level 2 database format '/file/backup/rman/level2_%d_%s_%p_%u.bkp';
-
sql 'alter system archive log current';
-
backup archivelog all delete input format '/file/backup/rman/archivelog_%d_%s_%p_%u.bkp';
-
crosscheck backup;
-
delete noprompt obsolete;
-
release channel d1;
-
release channel d2;
-
}
- EOF
-
crontab -e
-
-
#週日0級備份
-
00 23 * * 0 /server/scripts/rman_bak_level0.sh
-
#週一、二、四、五、六2級增量備份
-
00 23 * * 1,2,4,5,6 /server/scripts/rman_bak_level2.sh
-
#週三1級增量備份
- 00 23 * * 3 /server/scripts/rman_bak_level1.sh
backup incremental level 0 database format='LEV0_%d_%t_%U_%s_%p'
format=string 檔案路徑和名稱的格式串,其中可包含宏變數:
%c copy ID
%p backup piece ID
%s backup set ID
%e log sequence
%h log thread ID
%d database name
%n database name(x填充到8個字元)
%I DBID
%f file ID
%F DBID, day, month, year, and sequencer的複合
%N tablespace name
%t timestamp
%M mh mm格式
%Y year yyyy格式
%u backup set+time((x填充到8個字元)
%U %u_%p_%c
%% %
The format specifier %U is replaced with unique filenames for the files when you take backups.
the %F element of the format string combines the DBID, day, month, year, and sequence number to generate a unique filename. %F must be included in any control file autobackup format.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29812844/viewspace-1988829/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 分享Oracle Rman的備份指令碼Oracle指令碼
- rman 備份指令碼指令碼
- oracle10g RMAN增量備份策略Oracle
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- rman 增量備份恢復
- Oracle RMAN備份實戰Oracle
- Oracle OCP(60):RMAN 備份Oracle
- 【RMAN】RMAN備份至ASMASM
- 【RMAN】RMAN的備份保留策略
- oracle 12c rman備份pdbOracle
- ORACLE NBU調取oracle rman指令碼備份歸檔不自動刪除歸檔Oracle指令碼
- RMAN備份概述
- dg丟失歸檔,使用rman增量備份恢復
- Oracle 備份恢復篇之RMAN catalogOracle
- 揭秘ORACLE備份之----RMAN之五(CATALOG)Oracle
- ORACLE DG從庫 Rman備份恢復Oracle
- Oracle RMAN備份以及壓縮原理分析Oracle
- 【RMAN】Oracle12c以後rman 備份恢復命令參考Oracle
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- RMAN備份進度
- RMAN的備份原理
- [20221028]rman使用tape與增量備份測試2.txt
- Oracle ADG環境下的RMAN備份策略Oracle
- 【RMAN】在備庫執行rman備份時報錯RMAN-06820 ORA-17629
- RMAN增量恢復
- RMAN備份恢復技巧
- 【rman備份策略】實驗
- Oracle Rman Catalog的建立方法和備份原理Oracle
- Oracle9i RMAN 的優缺點及RMAN 備份及恢復步驟Oracle
- Oracle 11G RAC複製備庫RMAN-03002 RMAN-05501 RMAN-03015 RMAN-03009 RMAN-10038Oracle
- 【RMAN】Oracle12c之後,rman備份Dataguard備端恢復可能出現邏輯錯誤Oracle
- RMAN備份詳解(轉載)
- [20190522]rman備份問題.txt
- RMAN 備份相關的概念
- 使用RMAN備份資料庫資料庫
- RMAN備份異機恢復
- 使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap
- ORACLE備份指令碼Oracle指令碼
- 利用RMAN備份重建資料庫資料庫