oracle 归档日志 策略,RMAN 配置归档日志删除策略
5、演示归档日志删除策略
[Oracle@linux1 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Nov 12 15:10:17 2013
--查看当前数据库保留策略
RMAN> show retention policy;
RMAN configuration parameters for database with db_unique_name USBO are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
--查看当前数据库保归档日志留策略
RMAN> show archivelog deletion policy;
RMAN configuration parameters for database with db_unique_name USBO are:
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
--查看过时的备份
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
no obsolete backups found
--列出copy副本
RMAN> list copy;
specification does not match any datafile copy in the repository
specification does not match any control file copy in the repository
List of Archived Log Copies for database with db_unique_name USBO
=====================================================================
Key Thrd Seq S Low Time
-——— —— ———- - —————————-
124 1 121 A 2013/11/12 15:34:15
Name: /u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_121_983pm3gp_.arc —当前的归档日志
--修改当前的归档日志保留策略为2个备份副本
RMAN> configure archivelog deletion policy to backed up 2 times to device type disk;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK;
new RMAN configuration parameters are successfully stored
--备份归档日志,并删除已经备份的归档日志
RMAN> backup archivelog all delete input;
Starting backup at 2013/11/12 15:37:25
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=121 RECID=124 STAMP=831310563
input archived log thread=1 sequence=122 RECID=125 STAMP=831310645
channel ORA_DISK_1: starting piece 1 at 2013/11/12 15:37:26
channel ORA_DISK_1: finished piece 1 at 2013/11/12 15:37:27
piece handle=/u03/database/usbo/fr_area/USBO/backupset/2013_11_12/o1_mf_annnn_TAG20131112T153726_983pop3p_.bkp
tag=TAG20131112T153726 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
RMAN-08138: WARNING: archived log not deleted - must create more backups —->出现警告提示,日志当前不能被删除,更多的备份需要创建
archived log file name=/u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_121_983pm3gp_.arc thread=1 sequence=121
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=/u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_122_983pooxb_.arc thread=1 sequence=122
Finished backup at 2013/11/12 15:37:27
--从os层面查看归档日志,当前已备份的两个归档日志没有删除
sys@USBO> ho ls -hltr /u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/*
-rw-r——- 1 oracle asmadmin 3.0K Nov 12 15:36 /u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_121_983pm3gp_.arc
-rw-r——- 1 oracle asmadmin 4.5K Nov 12 15:37 /u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_122_983pooxb_.arc
--从视图查询也可以获得其状态
sys@USBO> select name,status from v$archived_log where STATUS=’A’;
NAME STA
-———————————————————————————————————————- —-
/u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_121_983pm3gp_.arc A
/u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_122_983pooxb_.arc A
--第二次备份归档日志
-- Author : Leshami
-- Blog : http://www.linuxidc.com
RMAN> backup archivelog all delete input tag=arc_2nd;
Starting backup at 2013/11/12 15:41:58
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=121 RECID=124 STAMP=831310563 —sequence 121与122依旧被备份
input archived log thread=1 sequence=122 RECID=125 STAMP=831310645
input archived log thread=1 sequence=123 RECID=126 STAMP=831310918
channel ORA_DISK_1: starting piece 1 at 2013/11/12 15:41:58
channel ORA_DISK_1: finished piece 1 at 2013/11/12 15:41:59
piece handle=/u03/database/usbo/fr_area/USBO/backupset/2013_11_12/o1_mf_annnn_ARC_2ND_983py6mv_.bkp tag=ARC_2ND comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s) —sequence 121与122被删除
archived log file name=/u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_121_983pm3gp_.arc RECID=124 STAMP=831310563
archived log file name=/u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_122_983pooxb_.arc RECID=125 STAMP=831310645
RMAN-08138: WARNING: archived log not deleted - must create more backups —->出现警告提示,日志123不能被删除,更多的备份需要创建
archived log file name=/u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_123_983py6gh_.arc thread=1 sequence=123
--再次查看,只有sequence 123存在,121与122已经被删除
RMAN> list copy;
specification does not match any datafile copy in the repository
specification does not match any control file copy in the repository
List of Archived Log Copies for database with db_unique_name USBO
=====================================================================
Key Thrd Seq S Low Time
-——— —— ———- - —————————-
126 1 123 A 2013/11/12 15:37:25
Name: /u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_123_983py6gh_.arc
Finished backup at 2013/11/12 15:41:59
--配置新的归档日志删除策略
RMAN> configure archivelog deletion policy to backed up 1 times to device type disk;
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DISK;
new RMAN configuration parameters are successfully stored
--第三次备份归档日志
RMAN> backup archivelog all tag=arc_3rd;
Starting backup at 2013/11/12 15:44:11
current log archived
using channel ORA_DISK_1 —下面是skip的提示信息,因为根据新的策略,sequence 123已经被备份过一次了
skipping archived log file /u03/database/usbo/fr_area/USBO/archivelog/2013_11_12/o1_mf_1_123_983py6gh_.arc; already backed up 1 time(s)
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=124 RECID=127 STAMP=831311051
channel ORA_DISK_1: starting piece 1 at 2013/11/12 15:44:12
channel ORA_DISK_1: finished piece 1 at 2013/11/12 15:44:13
piece handle=/u03/database/usbo/fr_area/USBO/backupset/2013_11_12/o1_mf_annnn_ARC_3RD_983q2d34_.bkp tag=ARC_3RD comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2013/11/12 15:44:13
--清除策略
RMAN> configure archivelog deletion policy clear;
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DISK;
RMAN configuration parameters are successfully reset to default value
--列出所有归档日志的备份信息
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
-——— ————— —————- —————— —————————-
24 8.00K DISK 00:00:00 2013/11/12 15:37:26
BP Key: 24 Status: AVAILABLE Compressed: NO Tag: TAG20131112T153726
Piece Name: /u03/database/usbo/fr_area/USBO/backupset/2013_11_12/o1_mf_annnn_TAG20131112T153726_983pop3p_.bkp
List of Archived Logs in backup set 24
Thrd Seq Low SCN Low Time Next SCN Next Time
-—- ———- ————— —————————- ————— ————-
1 121 3090437 2013/11/12 15:34:15 3090507 2013/11/12 15:36:03
1 122 3090507 2013/11/12 15:36:03 3090591 2013/11/12 15:37:25
BS Key Size Device Type Elapsed Time Completion Time
-——— ————— —————- —————— —————————-
25 37.50K DISK 00:00:00 2013/11/12 15:41:58
BP Key: 25 Status: AVAILABLE Compressed: NO Tag: ARC_2ND
Piece Name: /u03/database/usbo/fr_area/USBO/backupset/2013_11_12/o1_mf_annnn_ARC_2ND_983py6mv_.bkp
List of Archived Logs in backup set 25
Thrd Seq Low SCN Low Time Next SCN Next Time
-—- ———- ————— —————————- ————— ————-
1 121 3090437 2013/11/12 15:34:15 3090507 2013/11/12 15:36:03
1 122 3090507 2013/11/12 15:36:03 3090591 2013/11/12 15:37:25
1 123 3090591 2013/11/12 15:37:25 3090746 2013/11/12 15:41:58
BS Key Size Device Type Elapsed Time Completion Time
-——— ————— —————- —————— —————————-
26 2.50K DISK 00:00:00 2013/11/12 15:44:12
BP Key: 26 Status: AVAILABLE Compressed: NO Tag: ARC_3RD
Piece Name: /u03/database/usbo/fr_area/USBO/backupset/2013_11_12/o1_mf_annnn_ARC_3RD_983q2d34_.bkp
List of Archived Logs in backup set 26
Thrd Seq Low SCN Low Time Next SCN Next Time
-—- ———- ————— —————————- ————— ————-
1 124 3090746 2013/11/12 15:41:58 3090839 2013/11/12 15:44:11
还没有评论,来说两句吧...