RMAN 的备份信息如下:
RMAN> list backupset summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
9 b 1 a disk 01-jun-11 1 1 no dave_lev1
10 b 1 a disk 01-jun-11 1 1 no dave_lev1
13 b a a disk 01-jun-11 1 1 no arc_bak
14 b a a disk 01-jun-11 1 1 no arc_bak
15 b a a disk 01-jun-11 1 1 no arc_bak
16 b a a disk 01-jun-11 1 1 no arc_bak
17 b a a disk 01-jun-11 1 1 no arc_bak
18 b a a disk 01-jun-11 1 1 no arc_bak
19 b a a disk 01-jun-11 1 1 no arc_bak
20 b a a disk 01-jun-11 1 1 no arc_bak
21 b a a disk 01-jun-11 1 1 no arc_bak
22 b f a disk 01-jun-11 1 1 no bak_ctlfile
23 b f a disk 01-jun-11 1 1 no spfile
RMAN> crosscheck backup;
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/dave_lev1_0cmdpuof_1_1_20110601 recid=9 stamp=752679695
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/dave_lev1_0bmdpuoe_1_1_20110601 recid=10 stamp=752679695
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0fmdpven_1_1_20110601 recid=13 stamp=752680408
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0gmdpven_1_1_20110601 recid=14 stamp=752680422
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0hmdpvj4_1_1_20110601 recid=15 stamp=752680549
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0imdpvj5_1_1_20110601 recid=16 stamp=752680582
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0jmdpvo4_1_1_20110601 recid=17 stamp=752680709
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0kmdpvo5_1_1_20110601 recid=18 stamp=752680721
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0mmdpvss_1_1_20110601 recid=19 stamp=752680863
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0lmdpvsr_1_1_20110601 recid=20 stamp=752680860
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/arch_0nmdpvv0_1_1_20110601 recid=21 stamp=752680929
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/ctl_file_0omdpvv7_1_1_20110601 recid=22 stamp=752680937
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/backup/dave_spfile_0pmdpvva_1_1_20110601 recid=23 stamp=752680939
Crosschecked 13 objects
但是restore validate的时候, 报错:
RMAN> restore database validate;
Starting restore at 01-JUN-11
using channel ORA_DISK_1
RMAN-00571: =================================================
RMAN-00569: ===== ERROR MESSAGE STACK FOLLOWS ====
RMAN-00571: ==========================================
RMAN-03002: failure of restore command at 06/01/2011 21:21:28
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
一般来说,遇到这种问题是因为控制过旧,即控制文件中没有备份的信息。
比如在nocatalog模式下,备份数据文件之前,先备份控制文件,然后在备份数据库。 在还原的时候,先还原还原控制文件,此时的控制文件中并没有包含RMAN 备份的信息,这时进行恢复就会遇到RMAN-06023 的错误。 但我这里控制文件没有修改。 所以不是这个原因造成。
google 一下。 有网友通过以下几种方法解决了这个问题:
1. shutdown abort。
2. crosscheck backup
3 设置 DBID
4. 重建UNDO Tablespace
这几种方法是问题的一方面,不过我遇到的情况还有一个特殊性。 就是我的RMAN 采用了增量备份,但是我没有做0级备份,而是直接用1级备份。 这种情况下,RMAN 发现没有0级备份,所以此时的1级备份也相当于0级备份。
尝试重新做了一次0级备份,在次validate,居然ok了。
RMAN> RESTORE DATABASE VALIDATE;
Starting restore at 01-JUN-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /u01/backup/dave_lev0_10mdqqtd_1_1_20110601
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/backup/dave_lev0_10mdqqtd_1_1_20110601 tag=DAVE_LEV0
channel ORA_DISK_1: validation complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /u01/backup/dave_lev0_0vmdqqtd_1_1_20110601
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/backup/dave_lev0_0vmdqqtd_1_1_20110601 tag=DAVE_LEV0
channel ORA_DISK_1: validation complete, elapsed time: 00:00:15
Finished restore at 01-JUN-11
正常情况下直接进行1级备份也是可以进行恢复的。 所以不应该出现这种问题。 所以在进行一次测试,就是使用1级备份进行恢复,看这种备份能否正常用于恢复。
到另一台单实例测试库上进行一下测试。 上面这台是我的RAC 测试库,折腾坏了,一时也没空去捣鼓。
备份脚本参考:
Nocatalog 下的RMAN 增量备份 shell脚本
http://www.cndba.cn/Dave/article/1476
先做一个1级备份:
RMAN> list backup summary;
using target database control file instead of recovery catalog
List of Backups
===============
key ty lv s device type completion time #pieces #copies compressed tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
5 b 1 a disk 02-jun-11 1 1 no dave_lev1
6 b 1 a disk 02-jun-11 1 1 no dave_lev1
9 b a a disk 02-jun-11 1 1 no arc_bak
10 b a a disk 02-jun-11 1 1 no arc_bak
11 b f a disk 02-jun-11 1 1 no bak_ctlfile
12 b f a disk 02-jun-11 1 1 no spfile
用restore 进行一次验证:
RMAN> restore database validate;
Starting restore at 02-JUN-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=148 devtype=DISK
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /u01/backup/dave_lev1_0amdrva4_1_1_20110602
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/backup/dave_lev1_0amdrva4_1_1_20110602 tag=DAVE_LEV1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /u01/backup/dave_lev1_09mdrva3_1_1_20110602
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/backup/dave_lev1_09mdrva3_1_1_20110602 tag=DAVE_LEV1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:16
Finished restore at 02-JUN-11
居然没有报错,灵异事件啊。
灵异就灵异吧,继续验证下这个1级备份的恢复问题。
RMAN> shutdown immediate
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 239075328 bytes
Fixed Size 1218700 bytes
Variable Size 83887988 bytes
Database Buffers 146800640 bytes
Redo Buffers 7168000 bytes
RMAN> restore database;
Starting restore at 02-JUN-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u01/app/oracle/oradata/dave1/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/dave1/sysaux01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/dave1/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/dave_lev1_0amdrva4_1_1_20110602
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/backup/dave_lev1_0amdrva4_1_1_20110602 tag=DAVE_LEV1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/dave1/system01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/dave1/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/backup/dave_lev1_09mdrva3_1_1_20110602
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/backup/dave_lev1_09mdrva3_1_1_20110602 tag=DAVE_LEV1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 02-JUN-11
RMAN> recover database;
Starting recover at 02-JUN-11
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:06
Finished recover at 02-JUN-11
RMAN> alter database open;
database opened
这种1级备份可以用来恢复。之前还遇到过一次rman 过期备份集在自动备份脚本里用: delete noprompt expired backup; 不能删除的问题。
有遇到这种情况的同学也可以说说。
-------------------------------------------------------------------------------------------------------
QQ:492913789
Email:ahdba@qq.com
Blog: http://www.cndba.cn/dave
DBA1 群:62697716(满); DBA2 群:62697977(满) DBA3 群:62697850(满)
DBA 超级群:63306533(满); DBA4 群: 83829929 DBA5群: 142216823
DBA6 群:158654907 聊天 群:40132017 聊天2群:69087192
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请