飄ぺ風
【宁可因梦想而忙碌,不要因忙碌而失去梦想】

 环境:oracle 11g rac asm for linux 6.7

 

将系统备份,准备恢复至备机上,将pfile备份拷贝至备机

1.删除备机的现有库

sql> shutdown immediate

sql> startup mount restrict

sql> drop database;

 

2.使用spfile创建pfile

sql>create pfile from spfile='/home/oracle/pfileogg.ora';

 

3.修改pfile,并使用pfile启动数据库至nomount

sql>startup nomount pfile='PFILE路径';

 

4.使用rman恢复控制文件,并启动至mount状态

rman target /

rman> restore controlfile from 'controlfile备份';

rman>sql 'alter database mount';

rman>catalog start with '备份位置';

 

5.恢复数据文件时遇到如下报错:

 

rman> restore database;

 

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

 

 

检查过备份文件,发现都是存在的,根本没有问题。最后检查发现是incarnation的问题,因为对该数据库做过了一次恢复,做了resetlogs操作。

 

解决方法:重置数据库的incarnation到2,然后还原数据库,问题解决。

关于incarnation的资料,可以参考官方资料7.6.2 Point-in-Time Recovery and Database Incarnations: Concepts

 

rman>list incarnation;

List of Database Incarnations

DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time

------- ------- -------- ---------------- --- ---------- ----------

1       1       OGG      2941743472       PARENT  1          17-SEP-11

2       2       OGG      2941743472       PARENT  995548     24-FEB-14

3       3       OGG      2941743472       CURRENT 1070775    26-FEB-14

rman>reset database to  incarnation 2;

rman>restore database;

rman>recover database;

恢复完成,以resetlogs参数open成功。

 

恢复后查找了一些incarnation的资料

官方解释如下:

Listing Database Incarnations

Each time an OPEN RESETLOGS operation is performed on a database, this operation creates a new incarnation of the database. Database incarnations and their effect on database recovery are explained in"Database Incarnations".

 

源文档 <http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmreprt.htm>

Database Incarnations

A database incarnation is created whenever you open the database with the

RESETLOGS option. After complete recovery, you can resume normal operations

without an OPEN RESETLOGS. After a DBPITR or recovery with a backup control file,

however, you must open the database with the RESETLOGS option, thereby creating a

new incarnation of the database. The database requires a new incarnation to avoid

confusion when two different redo streams have the same SCNs, but occurred at

different times. If you apply the wrong redo to your database, then you corrupt it.

The existence of multiple incarnations of a single database determines how RMAN

treats backups that are not in the current incarnation path. Usually, the current

database incarnation is the correct one to use. Nevertheless, in some cases resetting the

database to a previous incarnation is the best approach. For example, you may be

dissatisfied with the results of a point-in-time recovery that you have performed and

want to return the database to a time before the RESETLOGS. An understanding of

database incarnations is helpful to prepare for such situations.

 

总结了一下,主要是该测试环境的数据库之前恢复过一次,并且resetlogs了,第二次重新恢复的时候会遇到此问题,所以将incarnation恢复至之前一个就正常了。

 

posted on 2017-09-07 18:02  飄ぺ風  阅读(1871)  评论(0编辑  收藏  举报