报错如下
RMAN> restore database;
Starting restore at 2024-12-12 22:14:30
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/12/2024 22:14:30
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 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
开始已经从备份中恢复的控制文件,所以应该不是控制文件过旧的问题
检查备份的文件datafile1-4
RMAN> list backup of datafile 1;
RMAN> list backup of datafile 2;
RMAN> list backup of datafile 3;
RMAN> list backup of datafile 4;
备份文件也是可以看到的,说明目录的权限也是对的,如果不对,检查存放备份的目录权限是是不是oracle:oinstall
再查看源库和目标库的incarnation记录
源库
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ORCL 1715253055 PARENT 1 2013-08-24 11:37:30
2 2 ORCL 1715253055 CURRENT 925702 2024-12-11 21:25:22
目标库
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ORCL 1715253055 PARENT 1 2013-08-24 11:37:30
2 2 ORCL 1715253055 PARENT 925702 2024-12-11 21:25:22
3 3 ORCL 1715253055 CURRENT 967932 2024-12-11 23:09:44
原来是目标库在之前恢复的时候做了两次recover database的操作,所以reset scn的记录不一样了
把目标库重置为incarnation 2
reset database to incarnation 2;
RMAN> reset database to incarnation 2;
database reset to incarnation 2
再恢复数据库就可以正常恢复了
RMAN> restore database;
Starting restore at 2024-12-12 22:22:17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/data_ORCL_20241212_1a3che9i_1_1.bak
channel ORA_DISK_1: piece handle=/home/oracle/backup/data_ORCL_20241212_1a3che9i_1_1.bak tag=TAG20241212T214209
发表评论