数据库执行异地恢复测试后,原库无法执行备份。
两种解决方法
RESET DATABASE
Purpose
To reset the incarnation of the target database in the RMAN repository, which means to do either of the following actions:
-
Inform. RMAN that the SQL statement ALTER DATABASE OPEN RESETLOGS has been executed and that a new incarnation of the target database has been created. Note that if you run the RMAN command ALTER DATABASE OPEN RESETLOGS (not the SQL statement with the same keywords), then RMAN resets the target database automatically so that you do not have to run RESET DATABASE. By resetting the database, RMAN considers the new incarnation as the current incarnation of the database.
-
To reset the database to a previous incarnation. Typically, you would reset the incarnation when performing incomplete recovery to a point before a RESETLOGS operation, or when attempting to undo the affects of a RESETLOGS by restoring backups taken before a RESETLOGS.
Restrictions and Usage Notes
-
Execute RESET DATABASE only at the RMAN prompt.
-
You must be connected to the target database.
-
A recovery catalog connection is optional. Unlike in catalog mode, RESET DATABASE in nocatalog mode changes the incarnation only for the current RMAN session.
-
You must issue a RESET DATABASE command before you can use RMAN with a target database that has been opened with the SQL statement ALTER DATABASE OPEN RESETLOGS option. If you do not, then RMAN refuses to access the recovery catalog because it cannot distinguish between a RESETLOGS operation and an accidental restore of an old control file. The RESET DATABASE command informs RMAN that you issued a RESETLOGS command.
-
If RMAN is connected NOCATALOG, then you can only specify TO INCARNATION if the database is mounted and the control file contains a record of the prior incarnation. If you do not run RESET DATABASE, RMAN recovers to the last incarnation recorded in the control file.
-
If RMAN is connected in CATALOG mode, then you can specify TO INCARNATION when the database is mounted. If database is mounted, however, then the control file must have a record of the prior incarnation.
Keywords and Parameters
Syntax Element | Description |
---|---|
TO INCARNATION primary_key | Changes the current incarnation to an older incarnation. Specify the primary key of the DBINC record for the database incarnation. Run LIST INCARNATION OF DATABASE to obtain possible key values. After you issue RESET DATABASE TO INCARNATION, then you can run RMAN commands such as RESTORE and RECOVER. |
Examples
Resetting RMAN to a Previous Incarnation in NOCATALOG Mode: Example In NOCATALOG mode, you must mount a control file that knows about the incarnation that you want to recover. The following scenario makes an old incarnation of database trgt current again:
CONNECT TARGET / NOCATALOG # step 1: start and mount a control file that knows about the incarnation to which # you want to return. if the current control file does not know about it, then # you must restore an older control file STARTUP NOMOUNT; RESTORE CONTROLFILE UNTIL TIME 'SYSDATE-250'; ALTER DATABASE MOUNT; # step 2: obtain the primary key of old incarnation LIST INCARNATION OF DATABASE trgt; List of Database Incarnations DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time ------- ------- -------- ------------- ------- ---------- ---------- 1 2 TRGT 1334358386 PARENT 154381 OCT 30 2001 16:02:12 1 116 TRGT 1334358386 CURRENT 154877 OCT 30 2001 16:37:39 # step 3: in this example, reset database to incarnation key 2 RESET DATABASE TO INCARNATION 2; # step 4: restore and recover the database to a point before the RESETLOGS RESTORE DATABASE UNTIL SCN 154876; RECOVER DATABASE UNTIL SCN 154876; # step 5: make this incarnation the current incarnation and then list incarnations: ALTER DATABASE OPEN RESETLOGS; LIST INCARNATION OF DATABASE trgt; List of Database Incarnations DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time ------- ------- -------- ---------------- ------- ---------- ---------- 1 2 TRGT 1334358386 PARENT 154381 OCT 30 2001 16:02:12 1 116 TRGT 1334358386 PARENT 154877 OCT 30 2001 16:37:39 1 311 TRGT 1334358386 CURRENT 154877 AUG 13 2002 17:17:03
Resetting the Database After Incomplete Recovery: Example
This example assumes that an incomplete recovery or recovery with a backup control file was performed in NOCATALOG mode. Later, RMAN is started in CATALOG mode, but the RESYNC command fails because the incarnation has not been reset in the catalog.
% rman target / catalog rman/rman@catdb Recovery Manager: Release 10.1.0.2.0 - Production Copyright (c) 1995, 2003, Oracle. All rights reserved. connected to target database: TRGT (DBID=1334531173) connected to recovery catalog database RMAN> RESYNC CATALOG; RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of resync command on default channel at 11/01/2001 12:00:43 RMAN-20003: target database incarnation not found in recovery catalog RMAN> RESET DATABASE; new incarnation of database registered in recovery catalog starting full resync of recovery catalog full resync complete
另一种是
RMAN> unregister database;
RMAN> register database;
重新注册
这次采用的是unregister database的方法,恢复后查看原来的备份信息都还在。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/527318/viewspace-562959/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/527318/viewspace-562959/