Friday, 7 September 2012

Recreate Databse from RMAN Backup


How to re-create database from RMAN Backup

While discussing RMAN,  Me and my friend suddenly got a question that  can  we re-create database from the scratch using RMAN backup set? All we have is backup set salvaged from lets us say Hard Disk failure. We lost all the information of Database and left just few backup pieces.
By few brain storming sessions regarding this we came across few ideas that actually worked. In brief it was like
Re-store Control file if we are lucky enough to have it in backup set. Further need to restore and recover Database files to new or same directory structure and finally open database with our old friend option RESETLOGS.

Sounds easy!

Before we start creating database using RMAN backup, we need to keep in mind following few restrictions

1:- You cannot recreate database on Windows OS using RMAN backup taken on another OS.
      Eg. Backup taken on Linux and want to creating instance on Windows.
      However, you can use another OS with same flavor.
      Eg:- You can create Database on Solaris using Backup taken on Linux.

2:- You cannot create Database in Higher version using RMAN backup of Lower version.

 3:- You can create database on different architecture Eg: 32bit or 64 bit but by creating database in such way  does not work properly.

In this post, We will discuss the procedure to recreate oracle database using RMAN backup.

Before we proceed with Database creating using RMAN backup we need to make sure following pre-requisites are met:

1:- Instance of would be new database is in No-Mount stage
2:- RMAN backup is copied to new server.

To demonstrate this, we have got RMAN backup of database around 150GB residing on a Linux server and will create database from scratch into another Linux Server. We will use different directory structure then from old database directory structure.


Now perform following on the server on which you want to create Database.

Put new instance in Nomount stage:
 [oracle@PSLinux ~]$ export ORACLE_SID=DEMO91
[oracle@PSLinux ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 6 04:26:18 2012

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

Connected to an idle instance.

SQL> Startup Nomount pfile=$ORACLE_HOME/dbs/initDEMO91.ora
ORACLE instance started.

Total System Global Area 2142679040 bytes
Fixed Size                  1337720 bytes
Variable Size            1526728328 bytes
Database Buffers          536870912 bytes
Redo Buffers               77742080 bytes
SQL> create spfile from pfile;

File created.

SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.

Total System Global Area 2142679040 bytes
Fixed Size                  1337720 bytes
Variable Size            1526728328 bytes
Database Buffers          536870912 bytes
Redo Buffers               77742080 bytes
SQL>

Check RMAN backup files at OS level:
To use RMAN backup for new database creation, we need to copy all the backup sets to new server. Set the appropriate permission on backup sets. User doing the operation needs to be in Oracle DBA group.

[oracle@PSLinux RMAN_BKUP]$ cd /ASM3/oracle/RMAN_BKUP/
[oracle@PSLinux RMAN_BKUP]$ pwd
/ASM3/oracle/RMAN_BKUP

[oracle@PSLinux RMAN_BKUP]$ ls -ltr RMAN_BKP*
-rwxr-Sr-t 1 oracle oracle 732618752 Sep  2 22:29 RMAN_BKP_01nk27tq_1_1.bkp
-rwxr-Sr-t 1 oracle oracle   1114112 Sep  2 22:30 RMAN_BKP_03nk287h_1_1.bkp
-rwxr-Sr-t 1 oracle oracle 846053376 Sep  2 22:30 RMAN_BKP_02nk2822_1_1.bkp
-rwxr-Sr-t 1 oracle oracle  35232768 Sep  2 22:30 RMAN_BKP_04nk287k_1_1.bkp


Start RMAN

[oracle@PSLinux RMAN_BKUP]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Thu Sep 6 04:34:06 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DEMO91 (not mounted)

First thing we need in this operation is Control file from Backup set. At No-mount stage connecting to new database will be just equal to any other normal RMAN operation.
To make RMAN restore and recover our database from Backup, we need to have DBID known for the database that we want to re-create. However in absence of DBID we can still proceed further. In this case we  re-store Control file from a particular backup set. Following is the command that we run :


RMAN> Run
2> {
3> Restore Controlfile to '/ASM3/oracle/oradata/DEMO91/DEMO91_CTL_FILE.ctl' from '/ASM3/oracle/RMAN_BKUP/RMAN_BKP_03nk287h_1_1.bkp';
4> }

Starting restore at 06-SEP-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 06-SEP-12

Now! Check weather operation is successful and Control file is restored on specific location that we gave within RUN  block.

[oracle@PSLinux RMAN_BKUP]$ cd /ASM3/oracle/oradata/DEMO91/
[oracle@PSLinux DEMO91]$ ls -trl
total 17320
-rw-rw---- 1 oracle oracle 17711104 Sep  6 04:49 DEMO91_CTL_FILE.ctl

Now next will be to put Database in Mount stage.

RMAN> alter database mount;
database mounted

Now check what files we have in backup set.
RMAN> list backup;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    698.67M    DISK        00:02:11     31-AUG-12
        BP Key: 1   Status: AVAILABLE  Compressed: YES  Tag: TAG20120831T212513
        Piece Name: /backups/bkp/RMAN_BKP_01nk27tq_1_1.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 21089226   31-AUG-12 /backups/DEMO91/sysaux01.dbf
  4       Full 21089226   31-AUG-12 /backups/DEMO91/psdefault.dbf
  7       Full 21089226   31-AUG-12 /backups/DEMO91/adapp.dbf
  8       Full 21089226   31-AUG-12 /backups/DEMO91/amapp.dbf
  9       Full 21089226   31-AUG-12 /backups/DEMO91/avapp.dbf
  11      Full 21089226   31-AUG-12 /backups/DEMO91/bnapp.dbf
  12      Full 21089226   31-AUG-12 /backups/DEMO91/bnlarge.dbf
  16      Full 21089226   31-AUG-12 /backups/DEMO91/cularg1.dbf
  18      Full 21089226   31-AUG-12 /backups/DEMO91/cularg3.dbf
  21      Full 21089226   31-AUG-12 /backups/DEMO91/dtapp.dbf
  23      Full 21089226   31-AUG-12 /backups/DEMO91/eobfapp.dbf
  24      Full 21089226   31-AUG-12 /backups/DEMO91/eocfapp.dbf
  25      Full 21089226   31-AUG-12 /backups/DEMO91/eocmapp.dbf
  27      Full 21089226   31-AUG-12 /backups/DEMO91/eocmwrk.dbf
  29      Full 21089226   31-AUG-12 /backups/DEMO91/eoculrg.dbf
  30      Full 21089226   31-AUG-12 /backups/DEMO91/eodsapp.dbf
  32      Full 21089226   31-AUG-12 /backups/DEMO91/eoecapp.dbf
  34      Full 21089226   31-AUG-12 /backups/DEMO91/eoecwrk.dbf
  35      Full 21089226   31-AUG-12 /backups/DEMO91/eoeiapp.dbf
  38      Full 21089226   31-AUG-12 /backups/DEMO91/eoewlrg.dbf
  41      Full 21089226   31-AUG-12 /backups/DEMO91/eoiulrg.dbf
  43      Full 21089226   31-AUG-12 /backups/DEMO91/eolarge.dbf
  44      Full 21089226   31-AUG-12 /backups/DEMO91/eoltapp.dbf
  46      Full 21089226   31-AUG-12 /backups/DEMO91/eopplrg.dbf
  48      Full 21089226   31-AUG-12 /backups/DEMO91/eotplrg.dbf
  49      Full 21089226   31-AUG-12 /backups/DEMO91/epapp.dbf
  51      Full 21089226   31-AUG-12 /backups/DEMO91/erapp.dbf
  53      Full 21089226   31-AUG-12 /backups/DEMO91/erwork.dbf
  54      Full 21089226   31-AUG-12 /backups/DEMO91/faapp.dbf
  55      Full 21089226   31-AUG-12 /backups/DEMO91/falarge.dbf
  59      Full 21089226   31-AUG-12 /backups/DEMO91/giapp.dbf
  61      Full 21089226   31-AUG-12 /backups/DEMO91/gpdeapp.dbf
  65      Full 21089226   31-AUG-12 /backups/DEMO91/hrapp2.dbf
  66      Full 21089226   31-AUG-12 /backups/DEMO91/hrapp3.dbf
  69      Full 21089226   31-AUG-12 /backups/DEMO91/hrapp6.dbf
  72      Full 21089226   31-AUG-12 /backups/DEMO91/hrlarg1.dbf
  76      Full 21089226   31-AUG-12 /backups/DEMO91/hrslarge.dbf
  79      Full 21089226   31-AUG-12 /backups/DEMO91/htapp.dbf
  80      Full 21089226   31-AUG-12 /backups/DEMO91/inapp.dbf
  83      Full 21089226   31-AUG-12 /backups/DEMO91/pcapp.dbf
  85      Full 21089226   31-AUG-12 /backups/DEMO91/piapp.dbf
  86      Full 21089226   31-AUG-12 /backups/DEMO91/pilarge.dbf
  88      Full 21089226   31-AUG-12 /backups/DEMO91/poapp.dbf
  90      Full 21089226   31-AUG-12 /backups/DEMO91/psimgr.dbf
  91      Full 21089226   31-AUG-12 /backups/DEMO91/psindex.dbf
  92      Full 21089226   31-AUG-12 /backups/DEMO91/ptamsg.dbf
  94      Full 21089226   31-AUG-12 /backups/DEMO91/ptappe.dbf
  97      Full 21089226   31-AUG-12 /backups/DEMO91/ptlock.dbf
  99      Full 21089226   31-AUG-12 /backups/DEMO91/ptprjwk.dbf
  103     Full 21089226   31-AUG-12 /backups/DEMO91/pttree.dbf
  106     Full 21089226   31-AUG-12 /backups/DEMO91/py0lrg.dbf
  108     Full 21089226   31-AUG-12 /backups/DEMO91/pylarge.dbf
  109     Full 21089226   31-AUG-12 /backups/DEMO91/pywork.dbf
  110     Full 21089226   31-AUG-12 /backups/DEMO91/saapp.dbf
  113     Full 21089226   31-AUG-12 /backups/DEMO91/srapp.dbf
  115     Full 21089226   31-AUG-12 /backups/DEMO91/stlarge.dbf
  117     Full 21089226   31-AUG-12 /backups/DEMO91/tlapp.dbf
  120     Full 21089226   31-AUG-12 /backups/DEMO91/waapp.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    806.85M    DISK        00:02:49     31-AUG-12
        BP Key: 2   Status: AVAILABLE  Compressed: YES  Tag: TAG20120831T212513
        Piece Name: /backups/bkp/RMAN_BKP_02nk2822_1_1.bkp
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 21089303   31-AUG-12 /backups/DEMO91/system01.dbf
  3       Full 21089303   31-AUG-12 /backups/DEMO91/psundots01.dbf
  5       Full 21089303   31-AUG-12 /backups/DEMO91/aaapp.dbf
  6       Full 21089303   31-AUG-12 /backups/DEMO91/aalarge.dbf
  10      Full 21089303   31-AUG-12 /backups/DEMO91/bdapp.dbf
  13      Full 21089303   31-AUG-12 /backups/DEMO91/ccapp.dbf
  14      Full 21089303   31-AUG-12 /backups/DEMO91/coapp.dbf
  15      Full 21089303   31-AUG-12 /backups/DEMO91/cuaudit.dbf
  17      Full 21089303   31-AUG-12 /backups/DEMO91/cularg2.dbf
  19      Full 21089303   31-AUG-12 /backups/DEMO91/cularge.dbf
  20      Full 21089303   31-AUG-12 /backups/DEMO91/diapp.dbf
  22      Full 21089303   31-AUG-12 /backups/DEMO91/eoapp.dbf
  26      Full 21089303   31-AUG-12 /backups/DEMO91/eocmlrg.dbf
  28      Full 21089303   31-AUG-12 /backups/DEMO91/eocuapp.dbf
  31      Full 21089303   31-AUG-12 /backups/DEMO91/eodslrg.dbf
  33      Full 21089303   31-AUG-12 /backups/DEMO91/eoeclrg.dbf
  36      Full 21089303   31-AUG-12 /backups/DEMO91/eoeilrg.dbf
  37      Full 21089303   31-AUG-12 /backups/DEMO91/eoewapp.dbf
  39      Full 21089303   31-AUG-12 /backups/DEMO91/eoewwrk.dbf
  40      Full 21089303   31-AUG-12 /backups/DEMO91/eoiuapp.dbf
  42      Full 21089303   31-AUG-12 /backups/DEMO91/eoiuwrk.dbf
  45      Full 21089303   31-AUG-12 /backups/DEMO91/eoppapp.dbf
  47      Full 21089303   31-AUG-12 /backups/DEMO91/eotpapp.dbf
  50      Full 21089303   31-AUG-12 /backups/DEMO91/eplarge.dbf
  52      Full 21089303   31-AUG-12 /backups/DEMO91/erlarge.dbf
  56      Full 21089303   31-AUG-12 /backups/DEMO91/fgapp.dbf
  57      Full 21089303   31-AUG-12 /backups/DEMO91/fglarge.dbf
  58      Full 21089303   31-AUG-12 /backups/DEMO91/fsapp.dbf
  60      Full 21089303   31-AUG-12 /backups/DEMO91/gpapp.dbf
  62      Full 21089303   31-AUG-12 /backups/DEMO91/hpapp.dbf
  63      Full 21089303   31-AUG-12 /backups/DEMO91/hrapp.dbf
  64      Full 21089303   31-AUG-12 /backups/DEMO91/hrapp1.dbf
  67      Full 21089303   31-AUG-12 /backups/DEMO91/hrapp4.dbf
  68      Full 21089303   31-AUG-12 /backups/DEMO91/hrapp5.dbf
  70      Full 21089303   31-AUG-12 /backups/DEMO91/hrapp7.dbf
  71      Full 21089303   31-AUG-12 /backups/DEMO91/hrimage.dbf
  73      Full 21089303   31-AUG-12 /backups/DEMO91/hrlarge.dbf
  74      Full 21089303   31-AUG-12 /backups/DEMO91/hrsapp.dbf
  75      Full 21089303   31-AUG-12 /backups/DEMO91/hrsarch.dbf
  77      Full 21089303   31-AUG-12 /backups/DEMO91/hrswork.dbf
  78      Full 21089303   31-AUG-12 /backups/DEMO91/hrwork.dbf
  81      Full 21089303   31-AUG-12 /backups/DEMO91/paapp.dbf
  82      Full 21089303   31-AUG-12 /backups/DEMO91/palarge.dbf
  84      Full 21089303   31-AUG-12 /backups/DEMO91/pclarge.dbf
  87      Full 21089303   31-AUG-12 /backups/DEMO91/piwork.dbf
  89      Full 21089303   31-AUG-12 /backups/DEMO91/psimage.dbf
  93      Full 21089303   31-AUG-12 /backups/DEMO91/ptapp.dbf
  95      Full 21089303   31-AUG-12 /backups/DEMO91/ptaudit.dbf
  96      Full 21089303   31-AUG-12 /backups/DEMO91/ptcmstar.dbf
  98      Full 21089303   31-AUG-12 /backups/DEMO91/ptprc.dbf
  100     Full 21089303   31-AUG-12 /backups/DEMO91/ptrpts.dbf
  101     Full 21089303   31-AUG-12 /backups/DEMO91/pttbl.dbf
  102     Full 21089303   31-AUG-12 /backups/DEMO91/pttlrg.dbf
  104     Full 21089303   31-AUG-12 /backups/DEMO91/ptwork.dbf
  105     Full 21089303   31-AUG-12 /backups/DEMO91/pvapp.dbf
  107     Full 21089303   31-AUG-12 /backups/DEMO91/pyapp.dbf
  111     Full 21089303   31-AUG-12 /backups/DEMO91/sacapp.dbf
  112     Full 21089303   31-AUG-12 /backups/DEMO91/salarge.dbf
  114     Full 21089303   31-AUG-12 /backups/DEMO91/stapp.dbf
  116     Full 21089303   31-AUG-12 /backups/DEMO91/stwork.dbf
  118     Full 21089303   31-AUG-12 /backups/DEMO91/tllarge.dbf
  119     Full 21089303   31-AUG-12 /backups/DEMO91/tlwork.dbf

RMAN>

We got to know that we have around 120 files and we want to re-create database using this database on different directory structure.But problem with backup set is its location recorded in Control file.

Piece Name: /backups/bkp/RMAN_BKP_02nk2822_1_1.bkp
We have no such /backups/bkp/ directory structure in new server and once we run CROSSCHECK then these backup sets would have EXPIRED status.

RMAN> crosscheck backup;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/backups/bkp/RMAN_BKP_01nk27tq_1_1.bkp RECID=1 STAMP=792797115
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/backups/bkp/RMAN_BKP_02nk2822_1_1.bkp RECID=2 STAMP=792797251
Crosschecked 2 objects

So to proceed further, we need to register copied backup sets in Control file. In such scenario CATALOG command will serve our purpose.

RMAN> Catalog BackupPiece '/ASM3/oracle/RMAN_BKUP/RMAN_BKP_01nk27tq_1_1.bkp';

cataloged backup piece
backup piece handle=/ASM3/oracle/RMAN_BKUP/RMAN_BKP_01nk27tq_1_1.bkp RECID=3 STAMP=793256550

RMAN> Catalog BackupPiece '/ASM3/oracle/RMAN_BKUP/RMAN_BKP_03nk287h_1_1.bkp';

cataloged backup piece
backup piece handle=/ASM3/oracle/RMAN_BKUP/RMAN_BKP_03nk287h_1_1.bkp RECID=4 STAMP=793256565

RMAN> Catalog BackupPiece '/ASM3/oracle/RMAN_BKUP/RMAN_BKP_02nk2822_1_1.bkp';

cataloged backup piece
backup piece handle=/ASM3/oracle/RMAN_BKUP/RMAN_BKP_02nk2822_1_1.bkp RECID=5 STAMP=793256583

RMAN> Catalog BackupPiece '/ASM3/oracle/RMAN_BKUP/RMAN_BKP_04nk287k_1_1.bkp';

cataloged backup piece
backup piece handle=/ASM3/oracle/RMAN_BKUP/RMAN_BKP_04nk287k_1_1.bkp RECID=6 STAMP=793256598

We have our backup pieces Cataloged successfully and we can check this by running following command.

RMAN> list backup of datafile 1;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    806.85M    DISK        00:02:49     31-AUG-12
        BP Key: 5   Status: AVAILABLE  Compressed: YES  Tag: TAG20120831T212513
        Piece Name: /ASM3/oracle/RMAN_BKUP/RMAN_BKP_02nk2822_1_1.bkp
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 21089303   31-AUG-12 /backups/DEMO91/system01.dbf


Further procedure is very simple have  got Restore and Recover commands included. But the complexity is, we have to re-store database files to new location /ASM3/oracle/oradata/DEMO91/ not on its default /backups/DEMO91/

To do this, we need to Set a new name of Old database files and update the Control file with these change.

Check contents of following run block.
Run
{
Set Until Scn 210777197;
Set NewName for Datafile '/backups/DEMO91/sysaux01.dbf'to'/ASM3/oracle/oradata/DEMO91/sysaux01.dbf';
Set NewName for Datafile '/backups/DEMO91/psdefault.dbf'to'/ASM3/oracle/oradata/DEMO91/psdefault.dbf';
Set NewName for Datafile '/backups/DEMO91/adapp.dbf'to'/ASM3/oracle/oradata/DEMO91/adapp.dbf';
Set NewName for Datafile '/backups/DEMO91/amapp.dbf'to'/ASM3/oracle/oradata/DEMO91/amapp.dbf';
Set NewName for Datafile '/backups/DEMO91/avapp.dbf'to'/ASM3/oracle/oradata/DEMO91/avapp.dbf';
Set NewName for Datafile '/backups/DEMO91/bnapp.dbf'to'/ASM3/oracle/oradata/DEMO91/bnapp.dbf';
Set NewName for Datafile '/backups/DEMO91/bnlarge.dbf'to'/ASM3/oracle/oradata/DEMO91/bnlarge.dbf';
Set NewName for Datafile '/backups/DEMO91/cularg1.dbf'to'/ASM3/oracle/oradata/DEMO91/cularg1.dbf';
Set NewName for Datafile '/backups/DEMO91/cularg3.dbf'to'/ASM3/oracle/oradata/DEMO91/cularg3.dbf';
Set NewName for Datafile '/backups/DEMO91/dtapp.dbf'to'/ASM3/oracle/oradata/DEMO91/dtapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eobfapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eobfapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eocfapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eocfapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eocmapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eocmapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eocmwrk.dbf'to'/ASM3/oracle/oradata/DEMO91/eocmwrk.dbf';
Set NewName for Datafile '/backups/DEMO91/eoculrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eoculrg.dbf';
Set NewName for Datafile '/backups/DEMO91/eodsapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eodsapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eoecapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eoecapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eoecwrk.dbf'to'/ASM3/oracle/oradata/DEMO91/eoecwrk.dbf';
Set NewName for Datafile '/backups/DEMO91/eoeiapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eoeiapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eoewlrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eoewlrg.dbf';
Set NewName for Datafile '/backups/DEMO91/eoiulrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eoiulrg.dbf';
Set NewName for Datafile '/backups/DEMO91/eolarge.dbf'to'/ASM3/oracle/oradata/DEMO91/eolarge.dbf';
Set NewName for Datafile '/backups/DEMO91/eoltapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eoltapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eopplrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eopplrg.dbf';
Set NewName for Datafile '/backups/DEMO91/eotplrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eotplrg.dbf';
Set NewName for Datafile '/backups/DEMO91/epapp.dbf'to'/ASM3/oracle/oradata/DEMO91/epapp.dbf';
Set NewName for Datafile '/backups/DEMO91/erapp.dbf'to'/ASM3/oracle/oradata/DEMO91/erapp.dbf';
Set NewName for Datafile '/backups/DEMO91/erwork.dbf'to'/ASM3/oracle/oradata/DEMO91/erwork.dbf';
Set NewName for Datafile '/backups/DEMO91/faapp.dbf'to'/ASM3/oracle/oradata/DEMO91/faapp.dbf';
Set NewName for Datafile '/backups/DEMO91/falarge.dbf'to'/ASM3/oracle/oradata/DEMO91/falarge.dbf';
Set NewName for Datafile '/backups/DEMO91/giapp.dbf'to'/ASM3/oracle/oradata/DEMO91/giapp.dbf';
Set NewName for Datafile '/backups/DEMO91/gpdeapp.dbf'to'/ASM3/oracle/oradata/DEMO91/gpdeapp.dbf';
Set NewName for Datafile '/backups/DEMO91/hrapp2.dbf'to'/ASM3/oracle/oradata/DEMO91/hrapp2.dbf';
Set NewName for Datafile '/backups/DEMO91/hrapp3.dbf'to'/ASM3/oracle/oradata/DEMO91/hrapp3.dbf';
Set NewName for Datafile '/backups/DEMO91/hrapp6.dbf'to'/ASM3/oracle/oradata/DEMO91/hrapp6.dbf';
Set NewName for Datafile '/backups/DEMO91/hrlarg1.dbf'to'/ASM3/oracle/oradata/DEMO91/hrlarg1.dbf';
Set NewName for Datafile '/backups/DEMO91/hrslarge.dbf'to'/ASM3/oracle/oradata/DEMO91/hrslarge.dbf';
Set NewName for Datafile '/backups/DEMO91/htapp.dbf'to'/ASM3/oracle/oradata/DEMO91/htapp.dbf';
Set NewName for Datafile '/backups/DEMO91/inapp.dbf'to'/ASM3/oracle/oradata/DEMO91/inapp.dbf';
Set NewName for Datafile '/backups/DEMO91/pcapp.dbf'to'/ASM3/oracle/oradata/DEMO91/pcapp.dbf';
Set NewName for Datafile '/backups/DEMO91/piapp.dbf'to'/ASM3/oracle/oradata/DEMO91/piapp.dbf';
Set NewName for Datafile '/backups/DEMO91/pilarge.dbf'to'/ASM3/oracle/oradata/DEMO91/pilarge.dbf';
Set NewName for Datafile '/backups/DEMO91/poapp.dbf'to'/ASM3/oracle/oradata/DEMO91/poapp.dbf';
Set NewName for Datafile '/backups/DEMO91/psimgr.dbf'to'/ASM3/oracle/oradata/DEMO91/psimgr.dbf';
Set NewName for Datafile '/backups/DEMO91/psindex.dbf'to'/ASM3/oracle/oradata/DEMO91/psindex.dbf';
Set NewName for Datafile '/backups/DEMO91/ptamsg.dbf'to'/ASM3/oracle/oradata/DEMO91/ptamsg.dbf';
Set NewName for Datafile '/backups/DEMO91/ptappe.dbf'to'/ASM3/oracle/oradata/DEMO91/ptappe.dbf';
Set NewName for Datafile '/backups/DEMO91/ptlock.dbf'to'/ASM3/oracle/oradata/DEMO91/ptlock.dbf';
Set NewName for Datafile '/backups/DEMO91/ptprjwk.dbf'to'/ASM3/oracle/oradata/DEMO91/ptprjwk.dbf';
Set NewName for Datafile '/backups/DEMO91/pttree.dbf'to'/ASM3/oracle/oradata/DEMO91/pttree.dbf';
Set NewName for Datafile '/backups/DEMO91/py0lrg.dbf'to'/ASM3/oracle/oradata/DEMO91/py0lrg.dbf';
Set NewName for Datafile '/backups/DEMO91/pylarge.dbf'to'/ASM3/oracle/oradata/DEMO91/pylarge.dbf';
Set NewName for Datafile '/backups/DEMO91/pywork.dbf'to'/ASM3/oracle/oradata/DEMO91/pywork.dbf';
Set NewName for Datafile '/backups/DEMO91/saapp.dbf'to'/ASM3/oracle/oradata/DEMO91/saapp.dbf';
Set NewName for Datafile '/backups/DEMO91/srapp.dbf'to'/ASM3/oracle/oradata/DEMO91/srapp.dbf';
Set NewName for Datafile '/backups/DEMO91/stlarge.dbf'to'/ASM3/oracle/oradata/DEMO91/stlarge.dbf';
Set NewName for Datafile '/backups/DEMO91/tlapp.dbf'to'/ASM3/oracle/oradata/DEMO91/tlapp.dbf';
Set NewName for Datafile '/backups/DEMO91/waapp.dbf'to'/ASM3/oracle/oradata/DEMO91/waapp.dbf';
Set NewName for Datafile '/backups/DEMO91/system01.dbf'to'/ASM3/oracle/oradata/DEMO91/system01.dbf';
Set NewName for Datafile '/backups/DEMO91/psundots01.dbf'to'/ASM3/oracle/oradata/DEMO91/psundots01.dbf';
Set NewName for Datafile '/backups/DEMO91/aaapp.dbf'to'/ASM3/oracle/oradata/DEMO91/aaapp.dbf';
Set NewName for Datafile '/backups/DEMO91/aalarge.dbf'to'/ASM3/oracle/oradata/DEMO91/aalarge.dbf';
Set NewName for Datafile '/backups/DEMO91/bdapp.dbf'to'/ASM3/oracle/oradata/DEMO91/bdapp.dbf';
Set NewName for Datafile '/backups/DEMO91/ccapp.dbf'to'/ASM3/oracle/oradata/DEMO91/ccapp.dbf';
Set NewName for Datafile '/backups/DEMO91/coapp.dbf'to'/ASM3/oracle/oradata/DEMO91/coapp.dbf';
Set NewName for Datafile '/backups/DEMO91/cuaudit.dbf'to'/ASM3/oracle/oradata/DEMO91/cuaudit.dbf';
Set NewName for Datafile '/backups/DEMO91/cularg2.dbf'to'/ASM3/oracle/oradata/DEMO91/cularg2.dbf';
Set NewName for Datafile '/backups/DEMO91/cularge.dbf'to'/ASM3/oracle/oradata/DEMO91/cularge.dbf';
Set NewName for Datafile '/backups/DEMO91/diapp.dbf'to'/ASM3/oracle/oradata/DEMO91/diapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eoapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eoapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eocmlrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eocmlrg.dbf';
Set NewName for Datafile '/backups/DEMO91/eocuapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eocuapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eodslrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eodslrg.dbf';
Set NewName for Datafile '/backups/DEMO91/eoeclrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eoeclrg.dbf';
Set NewName for Datafile '/backups/DEMO91/eoeilrg.dbf'to'/ASM3/oracle/oradata/DEMO91/eoeilrg.dbf';
Set NewName for Datafile '/backups/DEMO91/eoewapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eoewapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eoewwrk.dbf'to'/ASM3/oracle/oradata/DEMO91/eoewwrk.dbf';
Set NewName for Datafile '/backups/DEMO91/eoiuapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eoiuapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eoiuwrk.dbf'to'/ASM3/oracle/oradata/DEMO91/eoiuwrk.dbf';
Set NewName for Datafile '/backups/DEMO91/eoppapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eoppapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eotpapp.dbf'to'/ASM3/oracle/oradata/DEMO91/eotpapp.dbf';
Set NewName for Datafile '/backups/DEMO91/eplarge.dbf'to'/ASM3/oracle/oradata/DEMO91/eplarge.dbf';
Set NewName for Datafile '/backups/DEMO91/erlarge.dbf'to'/ASM3/oracle/oradata/DEMO91/erlarge.dbf';
Set NewName for Datafile '/backups/DEMO91/fgapp.dbf'to'/ASM3/oracle/oradata/DEMO91/fgapp.dbf';
Set NewName for Datafile '/backups/DEMO91/fglarge.dbf'to'/ASM3/oracle/oradata/DEMO91/fglarge.dbf';
Set NewName for Datafile '/backups/DEMO91/fsapp.dbf'to'/ASM3/oracle/oradata/DEMO91/fsapp.dbf';
Set NewName for Datafile '/backups/DEMO91/gpapp.dbf'to'/ASM3/oracle/oradata/DEMO91/gpapp.dbf';
Set NewName for Datafile '/backups/DEMO91/hpapp.dbf'to'/ASM3/oracle/oradata/DEMO91/hpapp.dbf';
Set NewName for Datafile '/backups/DEMO91/hrapp.dbf'to'/ASM3/oracle/oradata/DEMO91/hrapp.dbf';
Set NewName for Datafile '/backups/DEMO91/hrapp1.dbf'to'/ASM3/oracle/oradata/DEMO91/hrapp1.dbf';
Set NewName for Datafile '/backups/DEMO91/hrapp4.dbf'to'/ASM3/oracle/oradata/DEMO91/hrapp4.dbf';
Set NewName for Datafile '/backups/DEMO91/hrapp5.dbf'to'/ASM3/oracle/oradata/DEMO91/hrapp5.dbf';
Set NewName for Datafile '/backups/DEMO91/hrapp7.dbf'to'/ASM3/oracle/oradata/DEMO91/hrapp7.dbf';
Set NewName for Datafile '/backups/DEMO91/hrimage.dbf'to'/ASM3/oracle/oradata/DEMO91/hrimage.dbf';
Set NewName for Datafile '/backups/DEMO91/hrlarge.dbf'to'/ASM3/oracle/oradata/DEMO91/hrlarge.dbf';
Set NewName for Datafile '/backups/DEMO91/hrsapp.dbf'to'/ASM3/oracle/oradata/DEMO91/hrsapp.dbf';
Set NewName for Datafile '/backups/DEMO91/hrsarch.dbf'to'/ASM3/oracle/oradata/DEMO91/hrsarch.dbf';
Set NewName for Datafile '/backups/DEMO91/hrswork.dbf'to'/ASM3/oracle/oradata/DEMO91/hrswork.dbf';
Set NewName for Datafile '/backups/DEMO91/hrwork.dbf'to'/ASM3/oracle/oradata/DEMO91/hrwork.dbf';
Set NewName for Datafile '/backups/DEMO91/paapp.dbf'to'/ASM3/oracle/oradata/DEMO91/paapp.dbf';
Set NewName for Datafile '/backups/DEMO91/palarge.dbf'to'/ASM3/oracle/oradata/DEMO91/palarge.dbf';
Set NewName for Datafile '/backups/DEMO91/pclarge.dbf'to'/ASM3/oracle/oradata/DEMO91/pclarge.dbf';
Set NewName for Datafile '/backups/DEMO91/piwork.dbf'to'/ASM3/oracle/oradata/DEMO91/piwork.dbf';
Set NewName for Datafile '/backups/DEMO91/psimage.dbf'to'/ASM3/oracle/oradata/DEMO91/psimage.dbf';
Set NewName for Datafile '/backups/DEMO91/ptapp.dbf'to'/ASM3/oracle/oradata/DEMO91/ptapp.dbf';
Set NewName for Datafile '/backups/DEMO91/ptaudit.dbf'to'/ASM3/oracle/oradata/DEMO91/ptaudit.dbf';
Set NewName for Datafile '/backups/DEMO91/ptcmstar.dbf'to'/ASM3/oracle/oradata/DEMO91/ptcmstar.dbf';
Set NewName for Datafile '/backups/DEMO91/ptprc.dbf'to'/ASM3/oracle/oradata/DEMO91/ptprc.dbf';
Set NewName for Datafile '/backups/DEMO91/ptrpts.dbf'to'/ASM3/oracle/oradata/DEMO91/ptrpts.dbf';
Set NewName for Datafile '/backups/DEMO91/pttbl.dbf'to'/ASM3/oracle/oradata/DEMO91/pttbl.dbf';
Set NewName for Datafile '/backups/DEMO91/pttlrg.dbf'to'/ASM3/oracle/oradata/DEMO91/pttlrg.dbf';
Set NewName for Datafile '/backups/DEMO91/ptwork.dbf'to'/ASM3/oracle/oradata/DEMO91/ptwork.dbf';
Set NewName for Datafile '/backups/DEMO91/pvapp.dbf'to'/ASM3/oracle/oradata/DEMO91/pvapp.dbf';
Set NewName for Datafile '/backups/DEMO91/pyapp.dbf'to'/ASM3/oracle/oradata/DEMO91/pyapp.dbf';
Set NewName for Datafile '/backups/DEMO91/sacapp.dbf'to'/ASM3/oracle/oradata/DEMO91/sacapp.dbf';
Set NewName for Datafile '/backups/DEMO91/salarge.dbf'to'/ASM3/oracle/oradata/DEMO91/salarge.dbf';
Set NewName for Datafile '/backups/DEMO91/stapp.dbf'to'/ASM3/oracle/oradata/DEMO91/stapp.dbf';
Set NewName for Datafile '/backups/DEMO91/stwork.dbf'to'/ASM3/oracle/oradata/DEMO91/stwork.dbf';
Set NewName for Datafile '/backups/DEMO91/tllarge.dbf'to'/ASM3/oracle/oradata/DEMO91/tllarge.dbf';
Set NewName for Datafile '/backups/DEMO91/tlwork.dbf'to'/ASM3/oracle/oradata/DEMO91/tlwork.dbf';
Restore Database;
Switch Datafile all;ß to update datafiles location  in Controlfile.
}

Now check the presence of DBF’s on said folder:
[oracle@PSLinux DEMO91]$ ls -tlr *.dbf
-rw-rw---- 1 oracle oracle    2105344 Sep  6 05:57 waapp.dbf
-rw-rw---- 1 oracle oracle  419438592 Sep  6 05:57 tlwork.dbf
-rw-rw---- 1 oracle oracle   41951232 Sep  6 05:57 tllarge.dbf
-rw-rw---- 1 oracle oracle  104865792 Sep  6 05:57 tlapp.dbf
-rw-rw---- 1 oracle oracle  732962816 Sep  6 05:57 system01.dbf
-rw-rw---- 1 oracle oracle  579870720 Sep  6 05:57 sysaux01.dbf
-rw-rw---- 1 oracle oracle   17833984 Sep  6 05:57 stwork.dbf
-rw-rw---- 1 oracle oracle   13639680 Sep  6 05:57 stlarge.dbf
-rw-rw---- 1 oracle oracle   33562624 Sep  6 05:57 stapp.dbf
-rw-rw---- 1 oracle oracle  158343168 Sep  6 05:57 srapp.dbf
-rw-rw---- 1 oracle oracle    9445376 Sep  6 05:57 salarge.dbf
-rw-rw---- 1 oracle oracle    5251072 Sep  6 05:57 sacapp.dbf
-rw-rw---- 1 oracle oracle  314580992 Sep  6 05:57 saapp.dbf
-rw-rw---- 1 oracle oracle   31465472 Sep  6 05:57 pywork.dbf
-rw-rw---- 1 oracle oracle    3153920 Sep  6 05:57 pylarge.dbf
-rw-rw---- 1 oracle oracle  115351552 Sep  6 05:57 pyapp.dbf
-rw-rw---- 1 oracle oracle  134225920 Sep  6 05:57 py0lrg.dbf
-rw-rw---- 1 oracle oracle    4202496 Sep  6 05:57 pvapp.dbf
-rw-rw---- 1 oracle oracle   12591104 Sep  6 05:57 ptwork.dbf
-rw-rw---- 1 oracle oracle    7348224 Sep  6 05:57 pttree.dbf
-rw-rw---- 1 oracle oracle  794828800 Sep  6 05:57 pttlrg.dbf
-rw-rw---- 1 oracle oracle  314580992 Sep  6 05:57 pttbl.dbf
-rw-rw---- 1 oracle oracle    3153920 Sep  6 05:57 ptrpts.dbf
-rw-rw---- 1 oracle oracle   45096960 Sep  6 05:57 ptprjwk.dbf

As we can see,  All files are re-stored successfully.  New Step is to recover the database.

RMAN> Run
2> {
3> Set Until Scn 21089303;
4> Recover database;
5> }

executing command: SET until clause

Starting recover at 06-SEP-12
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=68
channel ORA_DISK_1: reading from backup piece /ASM3/oracle/RMAN_BKUP/RMAN_BKP_04nk287k_1_1.bkp
channel ORA_DISK_1: piece handle=/ASM3/oracle/RMAN_BKUP/RMAN_BKP_04nk287k_1_1.bkp tag=TAG20120831T213028
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/Soft/oracle/product/11.2.0/dbhome_1/dbs/arch1_68_791471444.dbf thread=1 sequence=68
media recovery complete, elapsed time: 00:00:01
Finished recover at 06-SEP-12


And now, All we need to open database with ResetLog option.

RMAN> Alter Database Open Resetlogs;

And we are ready to our new born database.

Any comment ,suggestion, correction  is most welcome.

No comments:

Post a Comment