Re: restore database from an old incarnation

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Wed, 18 Feb 2009 14:28:12 +0000 (UTC)
Message-ID: <gnh5ts$3gi$4_at_solani.org>



On Tue, 17 Feb 2009 20:39:56 -0800, Anthony wrote:

> Hi,
>
> We are using rman and a 3rd party vendor backing up to tape directly. We
> used Oracle 10g2 on windows 2003 server with a catalog database on
> another database.
>
> I need to restore and recover a database from a previous incarnation to
> a different server. (NOT the original production). I create a new
> instance on the new box. I tried to recover the control file first but
> get following error.
>
> RMAN> run {
> 2> allocate channel ch1 type 'sbt_tape' 3>
> PARMS="BLKSIZE=262144,ENV=(CvClientName=svr-lms- db2,CvInstanceName=In
> stance001)";
> 4> restore controlfile until time = "TO_DATE('10/04/2008
> 04:29:27','MM/DD/YYYY
> HH24:MI:SS')" ;
> 5> }
>
> allocated channel: ch1
> channel ch1: sid=157 devtype=SBT_TAPE channel ch1: CommVault Systems for
> Oracle: Version 7.0.0(BUILD76)
>
> Starting restore at 17-FEB-09
> released channel: ch1
> RMAN-00571:
> =========================================================== RMAN-00569:
> =============== ERROR MESSAGE STACK FOLLOWS ===============
> RMAN-00571:
> =========================================================== RMAN-03002:
> failure of restore command at 02/17/2009 20:37:43 RMAN-06004: ORACLE
> error from recovery catalog database: RMAN-20207: UNTIL TIME
> or RECOVERY WINDOW is before RESETLOGS time
>
>
> How do I go back to a previous incarnation? Please remember I am not
> recovering and restoring the original database. I just want to get back
> a database four months ago for comparison.
>
> Thanks for any help.

You should restore the control file, list the available incarnations, reset the incarnation to the appropriate value and restore it. Here is how to find out the incarnation:

[oracle_at_oracle16 ~]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Wed Feb 18 09:12:31 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: ADPRD (DBID=3026642841)

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       ADPRD    3026642841       PARENT  30961751778 13-FEB-07
2       2       ADPRD    3026642841       CURRENT 49843664666 21-SEP-07

RMAN> This is a development database that has been restored from production.

When you know the incarnation of your database that you want to restore to, you should reset it to the required incarnation using RESET DATABASE TO INCARNATION <inc Key>;

That is a RMAN command, described in the backup ref. manual. As a matter of fact, the example from the manual is more complete than mine. Here it is:

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;
.....

For the rest, I can only advise you take a look into the documentation, available on OTN.

-- 
http://mgogala.freehostia.com
Received on Wed Feb 18 2009 - 08:28:12 CST

Original text of this message