Pages

Tuesday, July 15, 2014

Creating Primary/Normal database from Standby backup.



Assuming you have taken backup from standby database.  Now you need to create standalone database using standby backup

Step 1:
      Create init ( minimum required parameter )
              ----------------------------------------------------------------------------
              DB_NAME=MASTERDB                               # Database name of standby/primary
              DB_UNIQUE_NAME="MASTERDBSNGS"         # can be set for differentiation
              control_files='\<path><>.CTL'
               log_file_name_convert = '<your current standby REDO location >,< your new host location >' ( # optional )

              ----------------------------------------------------------------------------
 
Step 2:
       $ export ORACLE_SID=MASTERDBSNGS
       $ sqlplus / as sysdba
         sql> startup nomount;

Step 3:
In another session

           $ export ORACLE_SID=MASTERDBSNGS
           $ rman target /

         RMAN> restore controlfile from '<backup location\ctl.BKP';
         RMAN> alter database mount;
         RMAN> catalog start with '< backup piece location>';

          RMAN      
          run {
                   allocate channel t1 type disk;
                   allocate channel t2 type disk;
                   set newname for datafile 1 to '<  new location\ DF name> ';
                   set newname for datafile 2 to '<  new location\ DF name> ';
                    ...
                   set until sequence 212;  # this is to set as per your requirement          
                   restore database;
                   switch datafile all;
                   recover database;
             }

Step 4:  alter database open resetlogs.
if log_file_name_convert is set at init , during database open, ORL will be created as per its value.

example: Init.ora
log_file_name_convert = '\ORADATA\MASTDBSNG\REDO\','\ORADATA\MASTDBSNGS\REDO\' 
else, at mount stage, you need to  rename the ORL location as below otherwise while " Alter database open resetlogs" throw file not found error

           @ mount stage
            SQL> alter database rename file '<old file location and name>' to '<new location and name>';
            SQL> alter database open resetlogs;

No comments:

Post a Comment