question1:
rman备份,指定
if "backup archivelog all delete all input"
is used, and more than one copy of each log exists on disk, then RMAN will select one of them for backup, but delete all copies after the backup is successful.
实验结果并非如此:
多重归档,取一个来备,然后删除所有的;但我实验的结果是只删除了其中用到的那个,9i环境
answer1:backup archivelog all delete all input会备份并删除所有的归档
backup archivelog all delete input只会选一份备份并删除,剩下的归档在下次还会需要
question2:backup archivelog all delete all input取的归档起点是什么?
answer2:在切换日志的时候,rman会记录生成的归档list archivelog all。如果是因为路径不对没有生成的话就不会记录在内。此后在调用命令备份归档(不管有没有all),rman都会根据这个清单上列的来备份。清单上有的都要备,如果很不幸清单上记录了两个归档地址同为序列26的归档,但是实际上物理硬盘丢失了归档地址1上26序列归档,没关系,rman说我可以原谅你,只取第二个来备,并且在备份时温柔提示:缺了归档地址1的26号归档。但是欠的帐是不会清掉的,还会记录在案,下次再备的话就没那么幸运了,rman报错:快点给我归档地址1的26号归档!!!
准备工作:启用了两个归档目录,最少成功数1
SQL> show parameter archive
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 0
log_archive_dest string
log_archive_dest_1 string location=D:\archive\archive
log_archive_dest_10 string
log_archive_dest_2 string location=D:\ORACLE\oradata\fox
log_archive_min_succeed_dest integer 1
实验1:
RMAN> list archivelog all
2> ;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
40 1 25 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00025.001
41 1 26 A 29-OCT-10 D:\ARCHIVE\ARCHIVE\ARC00026.001
42 1 26 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00026.001
43 1 27 A 29-OCT-10 D:\ARCHIVE\ARCHIVE\ARC00027.001
44 1 27 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00027.001
RMAN> BACKUP ARCHIVELOG ALL DELETE INPUT;
Starting backup at 29-OCT-10
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=25 recid=40 stamp=733657143
input archive log thread=1 sequence=26 recid=41 stamp=733657222
input archive log thread=1 sequence=27 recid=43 stamp=733657738
input archive log thread=1 sequence=28 recid=45 stamp=733657807
channel ORA_DISK_1: starting piece 1 at 29-OCT-10
channel ORA_DISK_1: finished piece 1 at 29-OCT-10
piece handle=D:\ORACLE\ORA92SERV\DATABASE\0JLRLEMG_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00025.001 recid=40 stamp=7
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00026.001 recid=41 stamp=733657222
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00027.001 recid=43 stamp=733657738
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00028.001 recid=45 stamp=733657807
Finished backup at 29-OCT-10
RMAN> list archivelog all
2> ;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
42 1 26 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\
ARC00026.001
44 1 27 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00027.001
46 1 28 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00028.001
再次执行,起点从归档地址2的序列26开始查找RMAN> BACKUP ARCHIVELOG ALL DELETE INPUT;
Starting backup at 29-OCT-10
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=26 recid=42 stamp=733657222
input archive log thread=1 sequence=27 recid=44 stamp=733657738
input archive log thread=1 sequence=28 recid=46 stamp=733657807
input archive log thread=1 sequence=29 recid=47 stamp=733657919
channel ORA_DISK_1: starting piece 1 at 29-OCT-10
channel ORA_DISK_1: finished piece 1 at 29-OCT-10
piece handle=D:\ORACLE\ORA92SERV\DATABASE\0KLRLEQ0_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\
ARC00026.001 recid=42 stamp=7
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00027.001 recid=44 stamp=7
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00028.001 recid=46 stamp=7
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00029.001 recid=47 stamp=733657919
Finished backup at 29-OCT-10
RMAN> list archivelog all;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
53 1 32 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00032.001
RMAN> BACKUP ARCHIVELOG ALL DELETE
all INPUT;
Starting backup at 29-OCT-10
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=32 recid=53 stamp=733658496
input archive log thread=1 sequence=33 recid=54 stamp=733658533
channel ORA_DISK_1: starting piece 1 at 29-OCT-10
channel ORA_DISK_1: finished piece 1 at 29-OCT-10
piece handle=D:\ORACLE\ORA92SERV\DATABASE\0MLRLFD5_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00032.001 recid=53 stamp=733658496
archive log filename=D:\ARCHIVE\ARCHIVE\
ARC00033.001 recid=54 stamp=733658533
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\
ARC00033.001 recid=55 stamp=733658533
Finished backup at 29-OCT-10
实验2:
修改D:\ARCHIVE\ARCHIVE路径,切换日志,则路径1缺少44,45号日志(41为上次使用
backup archivelog all delete input遗留下来的)。可以看出清单上就没有路径1的44,45记录,备份也能正常
RMAN> list archivelog all;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
71 1 41 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00041.001
75 1 44 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00044.001
76 1 45 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00045.001
77 1 46 A 29-OCT-10 D:\ARCHIVE\ARCHIVE\ARC00046.001
78 1 46 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00046.001
RMAN> BACKUP ARCHIVELOG ALL DELETE all INPUT;
Starting backup at 29-OCT-10
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=41 recid=71 stamp=733659138
input archive log thread=1 sequence=44 recid=75 stamp=733659256
input archive log thread=1 sequence=45 recid=76 stamp=733659298
input archive log thread=1 sequence=46 recid=77 stamp=733659331
input archive log thread=1 sequence=47 recid=79 stamp=733659345
channel ORA_DISK_1: starting piece 1 at 29-OCT-10
channel ORA_DISK_1: finished piece 1 at 29-OCT-10
piece handle=D:\ORACLE\ORA92SERV\DATABASE\0QLRLG6H_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00041.001 recid=71 stamp=733659138
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00044.001 recid=75 stamp=733659256
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00045.001 recid=76 stamp=733659298
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00046.001 recid=77 stamp=733659331
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00046.001 recid=78 stamp=733659331
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00047.001 recid=79 stamp=733659345
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00047.001 recid=80 stamp=733659345
Finished backup at 29-OCT-10
进一步
SQL> alter system switch logfile;
System altered.
RMAN> list archivelog all;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
81 1 48 A 29-OCT-10 D:\ARCHIVE\ARCHIVE\ARC00048.001
82 1 48 A 29-OCT-10 D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00048.001
手工删除路径1的48号del D:\ARCHIVE\ARCHIVE\ARC00048.001
再次执行备份RMAN> BACKUP ARCHIVELOG ALL DELETE all INPUT;
Starting backup at 29-OCT-10
current log archived
using channel ORA_DISK_1
archived log D:\ARCHIVE\ARCHIVE\ARC00048.001 not found or out of sync with catalogtrying alternate file for archivelog thread 1, sequence 48channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=48 recid=82 stamp=733660133
input archive log thread=1 sequence=49 recid=83 stamp=733660217
channel ORA_DISK_1: starting piece 1 at 29-OCT-10
channel ORA_DISK_1: finished piece 1 at 29-OCT-10
piece handle=D:\ORACLE\ORA92SERV\DATABASE\0RLRLH1P_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00048.001 recid=82 stamp=733660133
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00049.001 recid=83 stamp=733660217
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00049.001 recid=84 stamp=733660217
Finished backup at 29-OCT-10
备份正常但是提示日志丢失检查下清单
RMAN> list archivelog all;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
81 1 48 A 29-OCT-10 D:\ARCHIVE\ARCHIVE\ARC00048.001
再次备份RMAN> BACKUP ARCHIVELOG ALL DELETE all INPUT;
Starting backup at 29-OCT-10
current log archived
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 10/29/2010 10:31:20
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file D:\ARCHIVE\ARCHIVE\ARC00048.001
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) 靠靠靠靠靠?
这下报错了如果确认48号归档不需要备份了,可以执行RMAN> crosscheck archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 devtype=DISK
validation failed for archived log
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00048.001 recid=81 stamp=733660133
validation succeeded for archived log
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00050.001 recid=85 stamp=733660280
validation succeeded for archived log
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00050.001 recid=86 stamp=7
Crosschecked 3 objects
RMAN>
delete expired archivelog all;released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 devtype=DISK
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
81 1 48 X 29-OCT-10 D:\ARCHIVE\ARCHIVE\ARC00048.001
Do you really want to delete the above objects (enter YES or NO)? y
deleted archive log
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00048.001 recid=81 stamp=733660133
Deleted 1 EXPIRED objects
再次执行备份就成功了RMAN> BACKUP ARCHIVELOG ALL DELETE all INPUT;
Starting backup at 29-OCT-10
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=50 recid=85 stamp=733660280
input archive log thread=1 sequence=51 recid=87 stamp=733660533
channel ORA_DISK_1: starting piece 1 at 29-OCT-10
channel ORA_DISK_1: finished piece 1 at 29-OCT-10
piece handle=D:\ORACLE\ORA92SERV\DATABASE\0SLRLHBL_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00050.001 recid=85 stamp=733660280
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00050.001 recid=86 stamp=7
archive log filename=D:\ARCHIVE\ARCHIVE\ARC00051.001 recid=87 stamp=733660533
archive log filename=D:\ORACLE\ORADATA\FOX\ARCHIVE\ARC00051.001 recid=88 stamp=7
Finished backup at 29-OCT-10