將月末的rman備份設定為永久保留
一、需求:將月末的rman備份設定為永久保留
二、解決思路:
1、可以使用change backup ... keep forever nologs語句將備份集設定為永久保留
2、為了區分需要永久保留的備份集,在月末備份的時候,使用tag標記備份集,即在每個backup語句後加上tag '200907'格式的語句
3、在備份集中不能包含archive log,否則不能使用keep ... nologs選項
三、測試
]> export ORACLE_SID=orcl
]> rman target / catalog
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Jun 15 12:56:45 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1210313093)
connected to recovery catalog database
RMAN> run{
2> ALLOCATE CHANNEL ch00 TYPE disk;
3> BACKUP INCREMENTAL LEVEL=0 SKIP INACCESSIBLE FILESPERSET 5 FORMAT '/rman/bk_%s_%p_%t' DATABASE tag '200907';
sql 'alter system archive log current';
4> 5> BACKUP FORMAT '/rman/cntrl_%s_%p_%t' CURRENT CONTROLFILE tag '200907';
6> backup FORMAT '/rman/spfile_%s_%p_%t' spfile tag '200907';
7> change backup tag '200907' keep forever nologs;
8> RELEASE CHANNEL ch00;
9> }
starting full resync of recovery catalog
full resync complete
allocated channel: ch00
channel ch00: sid=140 devtype=DISK
Starting backup at 15-JUN-09
channel ch00: starting incremental level 0 datafile backupset
channel ch00: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/oradata/orcl/system01.dbf
input datafile fno=00004 name=/oracle/oradata/orcl/users01.dbf
input datafile fno=00003 name=/oracle/oradata/orcl/sysaux01.dbf
input datafile fno=00005 name=/oracle/oradata/orcl/example01.dbf
input datafile fno=00002 name=/oracle/oradata/orcl/undotbs01.dbf
channel ch00: starting piece 1 at 15-JUN-09
channel ch00: finished piece 1 at 15-JUN-09
piece handle=/rman/bk_5_1_689605193 tag=200907 comment=NONE
channel ch00: backup set complete, elapsed time: 00:05:31
channel ch00: starting incremental level 0 datafile backupset
channel ch00: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ch00: starting piece 1 at 15-JUN-09
channel ch00: finished piece 1 at 15-JUN-09
piece handle=/rman/bk_6_1_689605525 tag=200907 comment=NONE
channel ch00: backup set complete, elapsed time: 00:00:07
Finished backup at 15-JUN-09
starting full resync of recovery catalog
full resync complete
sql statement: alter system archive log current
Starting backup at 15-JUN-09
channel ch00: starting full datafile backupset
channel ch00: specifying datafile(s) in backupset
including current control file in backupset
channel ch00: starting piece 1 at 15-JUN-09
channel ch00: finished piece 1 at 15-JUN-09
piece handle=/rman/cntrl_7_1_689605584 tag=200907 comment=NONE
channel ch00: backup set complete, elapsed time: 00:00:05
Finished backup at 15-JUN-09
Starting backup at 15-JUN-09
channel ch00: starting full datafile backupset
channel ch00: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ch00: starting piece 1 at 15-JUN-09
channel ch00: finished piece 1 at 15-JUN-09
piece handle=/rman/spfile_8_1_689605599 tag=200907 comment=NONE
channel ch00: backup set complete, elapsed time: 00:00:02
Finished backup at 15-JUN-09
keep attributes for the backup are changed
backup will never be obsolete
archived logs required to recover from this backup will not be kept
backup set key=78 recid=4 stamp=689605513
keep attributes for the backup are changed
backup will never be obsolete
archived logs required to recover from this backup will not be kept
backup set key=79 recid=5 stamp=689605530
keep attributes for the backup are changed
backup will never be obsolete
archived logs required to recover from this backup will not be kept
backup set key=110 recid=6 stamp=689605587
keep attributes for the backup are changed
backup will never be obsolete
archived logs required to recover from this backup will not be kept
backup set key=120 recid=7 stamp=689605600
released channel: ch00
RMAN>
四、驗證
RMAN> list backup summary tag '200907';
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
78 B 0 A DISK 15-JUN-09 1 1 NO 200907
79 B 0 A DISK 15-JUN-09 1 1 NO 200907
110 B F A DISK 15-JUN-09 1 1 NO 200907
120 B F A DISK 15-JUN-09 1 1 NO 200907
RMAN>
tag=200907的備份集共有4個
RMAN> list backup tag '200907';
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
78 Incr 0 1010.14M DISK 00:05:20 15-JUN-09
BP Key: 82 Status: AVAILABLE Compressed: NO Tag: 200907
Piece Name: /rman/bk_5_1_689605193
Keep: NOLOGS Until: FOREVER
List of Datafiles in backup set 78
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 698455 15-JUN-09 /oracle/oradata/orcl/system01.dbf
2 0 Incr 698455 15-JUN-09 /oracle/oradata/orcl/undotbs01.dbf
3 0 Incr 698455 15-JUN-09 /oracle/oradata/orcl/sysaux01.dbf
4 0 Incr 698455 15-JUN-09 /oracle/oradata/orcl/users01.dbf
5 0 Incr 698455 15-JUN-09 /oracle/oradata/orcl/example01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
79 Incr 0 6.80M DISK 00:00:05 15-JUN-09
BP Key: 83 Status: AVAILABLE Compressed: NO Tag: 200907
Piece Name: /rman/bk_6_1_689605525
Keep: NOLOGS Until: FOREVER
Control File Included: Ckp SCN: 698742 Ckp time: 15-JUN-09
SPFILE Included: Modification time: 15-JUN-09
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
110 Full 6.77M DISK 00:00:03 15-JUN-09
BP Key: 113 Status: AVAILABLE Compressed: NO Tag: 200907
Piece Name: /rman/cntrl_7_1_689605584
Keep: NOLOGS Until: FOREVER
Control File Included: Ckp SCN: 698792 Ckp time: 15-JUN-09
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
120 Full 80.00K DISK 00:00:01 15-JUN-09
BP Key: 122 Status: AVAILABLE Compressed: NO Tag: 200907
Piece Name: /rman/spfile_8_1_689605599
Keep: NOLOGS Until: FOREVER
SPFILE Included: Modification time: 15-JUN-09
RMAN>
這是個備份集都設定為永久保留,並且不保留以後的歸檔日誌,即:Keep: NOLOGS Until: FOREVER
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22049049/viewspace-1023973/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【RMAN】RMAN的備份保留策略
- rman備份集的保留策略
- rman備份設定
- RMAN說,我能備份(9)--RMAN增量備份與備份保留策略
- RMAN 常用操作命令二(備份保留策略)
- oracle rman備份及策略設定Oracle
- Backup And Recovery User's Guide-備份RMAN備份-備份保留期對備份的備份的影響GUIIDE
- rman通過設定口令加密備份!加密
- Rman 定時備份crontab
- Backup And Recovery User's Guide-RMAN備份概念-備份保留期策略GUIIDE
- Backup And Recovery User's Guide-RMAN備份概念-備份保留期策略-備份冗餘GUIIDE
- 備份保留策略
- Backup And Recovery User's Guide-RMAN備份概念-備份保留期策略-過期備份的批量刪除GUIIDE
- RMAN 備份保留策略的常見問題 (文件 ID 2017258.1)
- oracle rman 定時備份指令碼Oracle指令碼
- RMAN定時全備份指令碼指令碼
- Oracle的奇葩設定之非歸檔模式與RMAN備份Oracle模式
- Backup And Recovery User's Guide-RMAN備份概念-備份保留期策略-恢復視窗GUIIDE
- oracle實驗記錄 (恢復-rman操作(設定&備份))Oracle
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-為RMAN備份指定TAGGUIIDE資料庫
- RMAN的備份原理
- RMAN的備份加密加密
- Backup And Recovery User's Guide-備份RMAN備份-使用RMAN備份備份集GUIIDE
- Backup And Recovery User's Guide-RMAN備份概念-RMAN備份的多個拷貝-備份的備份GUIIDE
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-為RMAN備份指定格式GUIIDE資料庫
- 手工將備份資訊新增到RMAN倉庫
- sublime設定備份
- exp備份和rman備份的區別
- 【RMAN】RMAN備份至ASMASM
- RMAN說,我能備份(14)--實戰RMAN備份
- RMAN說,我能備份(11)--RMAN中的備份集屬性
- rman備份後為什麼要同時備份歸檔日誌
- rman 備份策略
- RMAN備份原理
- 將Oracle資料庫改為歸檔模式並啟用Rman備份Oracle資料庫模式
- Backup And Recovery User's Guide-備份RMAN備份-用RMAN備份映象拷貝備份GUIIDE
- rman備份的其它特性
- RMAN備份的並行並行