Is it possible to use ‘restore UNTIL SCN’ with rman and Oracle 9i in NOCATALOG mode

backuporaclerman

I'm trying to do a hot backup with rman that I can copy to a USB drive so I can recover it on a new server.

The backup was done two days ago and the restore database command was working on the same day so I guess I need to use UNTIL SCN with the last SCN but I get RMAN-20208: UNTIL CHANGE is before RESETLOGS change

I saw on the Internet that I should use RESET DATABASE but I get RMAN-06002: command not allowed when not connected to a recovery catalog and I think this procedure may only work with Oracle 10 and later (I'm using Oracle 9i).

Any ideas?

Backup in rman

CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'c:/brubru/auto/%F';

run
{
CROSSCHECK BACKUP;
CROSSCHECK COPY;
CROSSCHECK BACKUPSET;
CROSSCHECK COPY OF DATABASE;
CROSSCHECK archivelog all;

allocate channel d1 device type disk format 'c:/brubru/%U.bkp';
BACKUP CHECK LOGICAL DATABASE format ‘c:/brubru/data_%d_%s_%T.bak’ PLUS ARCHIVELOG DELETE INPUT;
release channel d1;
}

Restore (on a second server)

> oradim -new -sid PEM -intpwd sys

> set ORACLE_SID=PEM
> rman target /

Recovery Manager: Release 9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database (not started)

RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file 'C:\ORACLE\ORA92\DATABASE\INITPEM.ORA'

trying to start the Oracle instance without parameter files ...
Oracle instance started

Total System Global Area      97589952 bytes

Fixed Size                      453312 bytes
Variable Size                 46137344 bytes
Database Buffers              50331648 bytes
Redo Buffers                    667648 bytes

RMAN> set dbid 2176828955

executing command: SET DBID

RMAN> RUN {
2>     SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'C:\brubru\auto
\%F';
3>     RESTORE SPFILE FROM AUTOBACKUP;
4> }

executing command: SET CONTROLFILE AUTOBACKUP FORMAT
using target database controlfile instead of recovery catalog

Starting restore at 13-05-20

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20130520
channel ORA_DISK_1: looking for autobackup on day: 20130519
channel ORA_DISK_1: looking for autobackup on day: 20130518
channel ORA_DISK_1: autobackup found: C:\brubru\auto\c-2176828955-20130518-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 13-05-20

RMAN> shutdown immediate

Oracle instance shut down

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area     135338868 bytes

Fixed Size                      453492 bytes
Variable Size                109051904 bytes
Database Buffers              25165824 bytes
Redo Buffers                    667648 bytes

RMAN> set dbid=2176828955

executing command: SET DBID

RMAN> RUN {
2>     SET CONTROLFILE AUTOBACKUP FORMAT
3>           FOR DEVICE TYPE DISK TO 'C:\brubru\auto\%F';
4>     RESTORE CONTROLFILE FROM AUTOBACKUP;
5> }

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 13-05-20

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=13 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20130520
channel ORA_DISK_1: looking for autobackup on day: 20130519
channel ORA_DISK_1: looking for autobackup on day: 20130518
channel ORA_DISK_1: autobackup found: C:\brubru\auto\c-2176828955-20130518-00
channel ORA_DISK_1: controlfile restore from autobackup complete
replicating controlfile
input filename=C:\BDD_ORACLE\ORADATA\PEM\CONTROL01.CTL
output filename=C:\BDD_ORACLE\ORADATA\PEM\CONTROL02.CTL
output filename=C:\BDD_ORACLE\ORADATA\PEM\CONTROL03.CTL
Finished restore at 13-05-20

RMAN> alter database mount;

database mounted

RMAN> run
2> {
3> allocate channel c1 device type disk format 'c:\brubru\%U.bkp';
4> restore database;
5> release channel c1;
6> }

released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=13 devtype=DISK

Starting restore at 13-05-20

released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/20/2013 15:53:37
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 15 found to restore
RMAN-06023: no backup or copy of datafile 14 found to restore
RMAN-06023: no backup or copy of datafile 13 found to restore
RMAN-06023: no backup or copy of datafile 12 found to restore
RMAN-06023: no backup or copy of datafile 11 found to restore
RMAN-06023: no backup or copy of datafile 10 found to restore
RMAN-06023: no backup or copy of datafile 9 found to restore
RMAN-06023: no backup or copy of datafile 8 found to restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to 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

RMAN> list backup;


List of Backup Sets
===================

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
105     737M       DISK        00:00:39     13-05-18
        BP Key: 105   Status: AVAILABLE   Tag: TAG20130518T124955
        Piece Name: C:\BRUBRU\39O9ULFK_1_1.BKP

  List of Archived Logs in backup set 105
  Thrd Seq     Low SCN    Low Time Next SCN   Next Time
  ---- ------- ---------- -------- ---------- ---------
  1    1156    245177104  13-05-11 245458552  13-05-12
  1    1157    245458552  13-05-12 245647641  13-05-13
  1    1158    245647641  13-05-13 245857439  13-05-14
  1    1159    245857439  13-05-14 246084782  13-05-15
  1    1160    246084782  13-05-15 246304002  13-05-16
  1    1161    246304002  13-05-16 246519120  13-05-17
  1    1162    246519120  13-05-17 246722961  13-05-18
  1    1163    246722961  13-05-18 246779464  13-05-18

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
106     Full    1G         DISK        00:02:14     13-05-18
        BP Key: 106   Status: AVAILABLE   Tag: TAG20130518T125043
        Piece Name: C:\BRUBRU\DATA_PEM_106_20130518.BAK
  List of Datafiles in backup set 106
  File LV Type Ckp SCN    Ckp Time Name
  ---- -- ---- ---------- -------- ----
  1       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\SYSTEM01.DBF
  2       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\UNDOTBS01.DBF
  3       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\CWMLITE01.DBF
  4       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\DRSYS01.DBF
  5       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\EXAMPLE01.DBF
  6       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\INDX01.DBF
  7       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\ODM01.DBF
  8       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\TOOLS01.DBF
  9       Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\USERS01.DBF
  10      Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\XDB01.DBF
  11      Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\USER.ORA
  12      Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\GDR2.ORA
  13      Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\PEM\USR.ORA
  14      Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\RMAN\RMAN01.DBF
  15      Full 246779607  13-05-18 C:\BDD_ORACLE\ORADATA\RMAN3\RMAN301.DBF

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
107     163K       DISK        00:00:01     13-05-18
        BP Key: 107   Status: AVAILABLE   Tag: TAG20130518T125258
        Piece Name: C:\BRUBRU\3BO9ULLA_1_1.BKP

  List of Archived Logs in backup set 107
  Thrd Seq     Low SCN    Low Time Next SCN   Next Time
  ---- ------- ---------- -------- ---------- ---------
  1    1164    246779464  13-05-18 246779907  13-05-18

RMAN> run
2> {
3> allocate channel c1 device type disk format 'c:\brubru\%U.bkp';
4> set until SCN 246779907;
5> restore database;
6> release channel c1;
7> }

allocated channel: c1
channel c1: sid=13 devtype=DISK

executing command: SET until clause
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of set command at 05/20/2013 15:59:11
RMAN-20208: UNTIL CHANGE is before RESETLOGS change

RMAN> LIST INCARNATION;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            CUR Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       PEM      2176828955       NO  190578     10-02-10
2       2       PEM      2176828955       YES 246779908  13-05-18

RMAN> RESET DATABASE TO INCARNATION 1;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of reset command at 05/20/2013 15:55:33
RMAN-06002: command not allowed when not connected to a recovery catalog

Best Answer

Yes, this scenario is possible in NOCATALOG mode. I did exactly this on 9.2 last Saturday so I can vouch for it :) Your attempt was almost successful. The only thing you did wrong is you restored the control file that was too new, it was above Reset SCN 246779908. If you move away C:\brubru\auto\c-2176828955-20130518-00 it would probably find a bit older controlfile and the restore would succeed. Ensure LIST INCARNATIONS does not display the new incarnation at all - controlfile shouldn't know about it.