RMAN-06023: no backup or copy of datafile 1 found to restore
参考文档:
RMAN-06026 RMAN-20003 - During Restore From A Disk Backup to an Identically Cloned Host (Doc ID 763703.1)
RMAN RESTORE FAILS WITH RMAN-06023 ALTHOUGH BACKUPS ARE AVAILABLE (Doc ID 965122.1)
RDBMS 11.2.0.4
问题:
在异机还原数据库的时候,发现报RMAN-06023,提示一些文件没有备份,实际查看备份,这些文件是备份过的。该文档分析产生这个问题的原因。
现象:
1 还原出控制文件后,查看数据库的化身,化身正常
2 catalog备份文件后,恢复数据库提示数据没有备份
3 catalog备份文件后,查看数据库化身,数据块化身变了(变成了上一次恢复演练的时间,上一次恢复演练是22年9月份,本次恢复演练是23年4月份)
原因:
FRA中有上一次还原的归档日志,删除掉问题解决。(从catalog的日志中,可以看到catalog了FRA中的归档日志)
或,设置新的FRA目录 。
或,设置正确的数据库化身
还原控制文件:
/backup/abcdbbackup/rman/def/TEST_cont_131553_20230413.ctl
restore controlfile from '/backup/abcdbbackup/rman/def/TEST_cont_131553_20230413.ctl';
还原控制文件后,查看数据库化身 ,发现当前化身是13年的
[oracle@abcdbadm01 ~]$ rman target /Recovery Manager: Release 11.2.0.4.0 - TESTuction on Thu Apr 13 15:09:36 2023Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: TEST (DBID=123456789)RMAN> list incarnation; using target database control file instead of recovery catalogList of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TEST 123456789 PARENT 1 24-AUG-13
2 2 TEST 123456789 CURRENT 925702 28-NOV-13 <<<<<<< 数据库化身 13年的,和原来的库一样
4 4 TEST 123456789 ORPHAN 6221239119063 08-MAR-22
3 3 TEST 123456789 ORPHAN 6222939576990 24-MAR-22RMAN>
-- 使用catalog start with注册备份备份目录 ,catalog 后,rman中使用restore database preview来验证备份,发现 有几个文件没有备份
这个时候查看数据库化身,数据库化身是22年9月份21日的
datafile 185 will be created automatically during restore operation
datafile 186 will be created automatically during restore operation
datafile 187 will be created automatically during restore operation
datafile 188 will be created automatically during restore operation
datafile 189 will be created automatically during restore operation
datafile 190 will be created automatically during restore operation
datafile 191 will be created automatically during restore operation
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/13/2023 15:08:32
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 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
RMAN> list incarnation; List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TEST 123456789 PARENT 1 24-AUG-13
2 2 TEST 123456789 PARENT 925702 28-NOV-13
4 4 TEST 123456789 ORPHAN 6221239119063 08-MAR-22
3 3 TEST 123456789 ORPHAN 6222939576990 24-MAR-22
5 5 TEST 123456789 CURRENT 6243972998070 21-SEP-22 <<<<<< 化身变成了22年的 RMAN>
-- 在OS上查看这些文件,文件是存在的,权限不存在问题,other组的权限是读,RMAN可以读这些文件。
[root@ractest1 rman]# ls -l /backup/abcdbbackup/rman/def/TEST_incr1_131175_20230407.bak
-rw-r--r-- 1 1001 1006 436338688 Apr 7 02:49 /backup/abcdbbackup/rman/def/TEST_incr1_131175_20230407.bak <<<<<<<<<<<< 这些文件是实际存在的
[root@ractest1 rman]# du -m /backup/abcdbbackup/rman/def/TEST_incr1_131175_20230407.bak
417 /backup/abcdbbackup/rman/def/TEST_incr1_131175_20230407.bak
[root@ractest1 rman]#
-- 重新还原控制文件后,发现当前化身又变成了13年的了
[oracle@ractest1 ~]$ rman target /Recovery Manager: Release 11.2.0.4.0 - TESTuction on Thu Apr 13 15:22:06 2023Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: TEST (not mounted)RMAN> alter database mount;using target database control file instead of recovery catalog
database mountedRMAN> list incarnation; List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TEST 123456789 PARENT 1 24-AUG-13
2 2 TEST 123456789 CURRENT 925702 28-NOV-13 <<<<<<< 数据库化身 13年的
4 4 TEST 123456789 ORPHAN 6221239119063 08-MAR-22
3 3 TEST 123456789 ORPHAN 6222939576990 24-MAR-22RMAN>
-- 重新catalog 后,数据库化身,又变成了22年9月21日的 ,同时,在alert log中显示数据库化身变成了5
RMAN> list incarnation; List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TEST 123456789 PARENT 1 24-AUG-13
2 2 TEST 123456789 PARENT 925702 28-NOV-13
4 4 TEST 123456789 ORPHAN 6221239119063 08-MAR-22
3 3 TEST 123456789 ORPHAN 6222939576990 24-MAR-22
5 5 TEST 123456789 CURRENT 6243972998070 21-SEP-22 <<<<<<< 数据库化身 22年的 RMAN>
Thu Apr 13 15:47:01 2023
SUCCESS: diskgroup DATA was mounted
Thu Apr 13 15:47:01 2023
ERROR: failed to establish dependency between database x5defdb and diskgroup resource ora.DATA.dg
No controlfile conversion
Thu Apr 13 15:47:17 2023
alter database mount
This instance was first to mount
Thu Apr 13 15:47:21 2023
Successful mount of redo thread 1, with mount id 545887237
Database mounted in Shared Mode (CLUSTER_DATABASE=TRUE)
Lost write protection disabled
Completed: alter database mount
Thu Apr 13 15:47:33 2023
Decreasing number of real time LMS from 2 to 0
Thu Apr 13 15:48:02 2023
SUCCESS: diskgroup ARC was mounted
Thu Apr 13 15:48:02 2023
Setting recovery target incarnation to 5 <<<<<<<<<<<<<<<< 数据库化身变成了5
Setting recovery target incarnation to 5
Thu Apr 13 15:48:02 2023
-- 再次 restore database preview ,找不到备份的文件,该文件实际上是存在的
datafile 186 will be created automatically during restore operation
datafile 187 will be created automatically during restore operation
datafile 188 will be created automatically during restore operation
datafile 189 will be created automatically during restore operation
datafile 190 will be created automatically during restore operation
datafile 191 will be created automatically during restore operation
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/13/2023 15:27:33
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 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 restoreRMAN>
-- 设置数据库化身为13年的,在alert log中,可以看到数据库化身设置成了2 ,并且FRA使用了21%左右
reset database to incarnation 2;RMAN> reset database to incarnation 2;database reset to incarnation 2RMAN>
Thu Apr 13 15:23:27 2023
Setting recovery target incarnation to 5
Setting recovery target incarnation to 5
Thu Apr 13 15:23:27 2023
ERROR: failed to establish dependency between database x5defdb and diskgroup resource ora.ARC.dg
Thu Apr 13 15:24:27 2023
Trying to expand controlfile section 14 for Oracle Managed Files
Expanded controlfile section 14 from 2126 to 4252 records
Requested to grow by 2126 records; added 26 blocks of records
Thu Apr 13 15:26:03 2023
Trying to expand controlfile section 13 for Oracle Managed Files
Expanded controlfile section 13 from 1000 to 2000 records
Requested to grow by 1000 records; added 45 blocks of records
Thu Apr 13 15:29:44 2023
Setting recovery target incarnation to 2 <<<<< 数据库化身变成2
Thu Apr 13 15:34:46 2023
db_recovery_file_dest_size of 409600 MB is 21.19% used. This is a <<<<<< FRA 使用了21%左右
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Thu Apr 13 15:46:14 2023
Shutting down instance (abort)
-- 然后再次restore database preview ,发现没有问题。
RMAN> list incarnation;List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TEST 123456789 PARENT 1 24-AUG-13
2 2 TEST 123456789 CURRENT 925702 28-NOV-13
4 4 TEST 123456789 ORPHAN 6221239119063 08-MAR-22
3 3 TEST 123456789 ORPHAN 6222939576990 24-MAR-22
5 5 TEST 123456789 ORPHAN 6243972998070 21-SEP-22RMAN> restore database preview;
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
130686 88.16M DISK 00:00:13 13-APR-23 BP Key: 131397 Status: AVAILABLE Compressed: YES Tag: TAG20230413T134854Piece Name: /backup/abcdbbackup/rman/def/TEST_arch_131552_20230413.archList of Archived Logs in backup set 130686Thrd Seq Low SCN Low Time Next SCN Next Time---- ------- ---------- --------- ---------- ---------2 157337 6293003807532 13-APR-23 6293006820607 13-APR-232 157338 6293006820607 13-APR-23 6293006839906 13-APR-231 159111 6293006822018 13-APR-23 6293006839479 13-APR-23
Media recovery start SCN is 6292877030425
Recovery must be done beyond SCN 6293006663962 to clear datafile fuzziness
Finished restore at 13-APR-23RMAN>
-- 原因分析,
数据库的 FRA设置的是+ARC,而ARC磁盘目录下,存在着2022年9月21日左右的一些归档日志。然后查看catalog start with的日志,发现把2022年9月份的日志给catalog了
SYS@test defdb1>show parameter db_recoverNAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
db_recovery_file_dest string
+ARC
db_recovery_file_dest_size big integer
400G
SYS@test defdb1>
ASMCMD> cd archivelog
ASMCMD> ls
2022_09_20/
2022_09_21/
2022_09_22/
2022_09_23/
ASMCMD> pwd
+arc/x5defdb/archivelog
ASMCMD>
RMAN> catalog start with '/backup/abcdbbackup/rman/def/'; Starting implicit crosscheck backup at 13-APR-23
allocated channel: ORA_DISK_1
allocated channel: ORA_DISK_2
allocated channel: ORA_DISK_3
Crosschecked 401 objects
Finished implicit crosscheck backup at 13-APR-23Starting implicit crosscheck copy at 13-APR-23
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
Crosschecked 18 objects
Finished implicit crosscheck copy at 13-APR-23searching for all files in the recovery area
cataloging files...
cataloging doneList of Cataloged Files
=======================
File Name: +arc/X5defDB/ARCHIVELOG/2022_09_23/thread_1_seq_6.863.1116116411 <<<<<< 控制文件中catalog了22年9月份的归档日志
File Name: +arc/X5defDB/ARCHIVELOG/2022_09_22/thread_1_seq_5.861.1116058953
File Name: +arc/X5defDB/ARCHIVELOG/2022_09_21/thread_2_seq_1.847.1116004687
File Name: +arc/X5defDB/ARCHIVELOG/2022_09_21/thread_2_seq_3.849.1116005885
File Name: +arc/X5defDB/ARCHIVELOG/2022_09_21/thread_2_seq_4.852.1116005889
File Name: +arc/X5defDB/ARCHIVELOG/2022_09_21/thread_2_seq_5.854.1116005889
File Name: +arc/X5defDB/ARCHIVELOG/2022_09_21/thread_1_seq_4.856.1116005891
File Name: +arc/X5defDB/ARCHIVELOG/2022_09_21/thread_2_seq_6.859.1116008013
删除掉ARC目录中,2022年9月份的归档日志
ASMCMD> rm -rf *
ASMCMD> pwd
+arc/x5defdb/archivelog
ASMCMD> ls
ASMCMD-8002: entry 'x5defdb' does not exist in directory '+arc/'
ASMCMD>
-- 再次还原控制文件 ,再次catalog ,发现化身是13年的了 ,而且在RMAN中catalog的记录中,没有catalog FRA的目录
File Name: /backup/abcdbbackup/rman/def/TEST_arch_131548_20230413.arch
File Name: /backup/abcdbbackup/rman/def/TEST_arch_131549_20230413.arch
File Name: /backup/abcdbbackup/rman/def/TEST_arch_131550_20230413.arch
File Name: /backup/abcdbbackup/rman/def/TEST_arch_131551_20230413.arch
File Name: /backup/abcdbbackup/rman/def/TEST_arch_131552_20230413.arch
File Name: /backup/abcdbbackup/rman/def/TEST_cont_131553_20230413.ctl
File Name: /backup/abcdbbackup/rman/def/TEST_spfile_131554_20230413.spfileRMAN> list incarnation;List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 TEST 123456789 PARENT 1 24-AUG-13
2 2 TEST 123456789 CURRENT 925702 28-NOV-13
4 4 TEST 123456789 ORPHAN 6221239119063 08-MAR-22
3 3 TEST 123456789 ORPHAN 6222939576990 24-MAR-22RMAN>
END