Tuesday, January 28, 2014

Restoring rman backup witout source database and catalog database from tape

Restoring Rman backup without source database connection and catalog database connection from tape


If we lost Source database and the catalog database and left out with only the tape backup ..then we need to restore the database from the tape  ..Follow the below Steps to Restore the database the.. for restoring in the new host configure the MML [Data Protector] with the new host ie install the dp client in the new host and make sure the connectivity is established

Step 1 Install the New database binaries [software only installation ] in the new Host

Install the database in the new server as the software only install the same database version [binaries should be installed] in the same o/s architecture .. Once the database is Installed Create the new listener and service[tnsname's] create the Pfile with the necessary parameter's as same as the original database [if original database is Rac and the restoring database is non rac then change the Rac parameter's in the pfile] and make the necessary changes like log_file_name_covert and db_file_name_convert in the pfile
we can create the pfile as we details of the previous database .. or else you can restore the spfile from the backup and use it  with the necessary modification

Step 2 Start the database in the No mount stage

Start the database in the No mount stage
syntax
startup pfile='<location of the pfile>' nomount 

SQL> startup pfile='/prod01/app/oraprod/product/11.2.0/dbhome_1/dbs/initOMPROD.ora' nomount
ORACLE instance started.

Total System Global Area 1.0689E+10 bytes
Fixed Size                  2192008 bytes
Variable Size             369102200 bytes
Database Buffers         1.0301E+10 bytes
Redo Buffers               16969728 bytes
SQL>

create the database password file orapw<sid>
Once the database is started in the no mount stage first we need to restore the control file first and the start the restore of the database

Step 3 Check the backup in the data Protector

Login to the Data Protector or any of the MML software's  used and check the backup piece's for the tape library


You can find the backup details in the internal database ---->sessions----->and the backup details .. you can find the message file related to this file

Check the channels in the backup we need to use the same channels in the restore command 

Step 4 Restore the Control file from the backup piece 

Locate the control file in the backup and then restore the control file from the  backup piece
start up the database in the no mount stage and Connect the rman as target 
Here we should not connect with catalog or auxiliary  because we don't have source or catalog database

Syntax
run
{
 allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=<sbt_location>
set until time "to_date(<date>,'YYYY-MM-DD HH24:MI:SS')";
restore controlfile from <backup Piece of the Control_file>
}

Legends

Sbt_location = as same as the location parameter which is specified in the Dp while taking the backup
Set until time = specify the time until which the database is to be restored
Backup piece of control file  = check the backup piece name from the Data Protector backup

RMAN> run
2> {
3> allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=OMPROD,OB2BARLIST=DB01New)';
4> set until time "to_date('2013-10-07:1:44:00','YYYY-MM-DD HH24:MI:SS')";
5> restore controlfile from 'c-3864922897-20131008-00';
6> }


using target database control file instead of recovery catalog
allocated channel: dev_0
channel dev_0: SID=756 device type=SBT_TAPE
channel dev_0: Data Protector A.07.00/72
executing command: SET until clause
Starting restore at 06-JAN-14
channel dev_0: restoring control file
channel dev_0: restore complete, elapsed time: 00:29:37
output file name=/u02/app/oracle/oradata/controlfile01.ctl
output file name=/u02/app/oracle/oradata/controlfile02.ctl
Finished restore at 06-JAN-14
released channel: dev_0


Step 5 Restore the database

For restoration we need to Mount the database Once the restoration of the control file  is complete then we need to mount the database
After mounting  the database start the restore script

Run
{
allocate channel<channel_name> type 'sbt_tape' parms 'SBT_LIBRARY=<location of the sbt_tape>
set newname for datafile  <filenumber>  to '<restoration path>'
---
---
Set newname for datafile <last_file_number> to '<restoration_path>'
Set until time "to_date( date ,date format)
restore database;
recover database;
}

Legends
location of the sbt_tape=  path to the Sbt tape library
filenumber=datafile number
lastfilenumber=the last datafile number [we need to specify the set new name command for all the datafile's in the backup you can check the data files in the back by check the messages tab in the data protector ]
restoration path =The path where the data file is going to be restored

Run
{
allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV(OB2BARTYPE=Oracle8,OB2APPNAME=OMPROD,OB2BARLIST=DB01New)';
set newname for datafile    1    to                     '/u01/oradata/<filename>;
----
----
----
-----
set newname for datafile    82   to                     '/u01/oradata/<filename>;
set until time "to_date('2013-10-07:1:44:00','YYYY-MM-DD HH24:MI:SS')";
restore database;
recover database;
}

Once the restore is completed  then the recover command will give error due to the patch of the data file in the control file is different [it will point to the original database data file's path in the control file ]

channel dev_0: restored backup piece 1
channel dev_0: restore complete, elapsed time: 02:01:43
Finished restore at 27-JAN-14

Starting recover at 27-JAN-14

starting media recovery
media recovery failed
released channel: dev_0
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/27/2014 05:21:44
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed
 start until time 'OCT 07 2013 01:44:00' using backup controlfile
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 1: '+DATA/omprod/datafile/system.316.825482365'
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '+DATA/omprod/datafile/system.316.825482365'

We are getting the above error due to the o control file has it's previous database [source database]data file path [as the original database is rac with asm]




So we need to recreate the control file with the correct path





Step  6 Recreate the control file



Trace the control file to create the control file script

alter database backup control file to trace


it will Create the trace file which contains script to recreate the control file change the path  of the data file's and the log file to recover  the database

CREATE CONTROLFILE REUSE DATABASE "OMPROD" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 1024
    MAXLOGMEMBERS 5
    MAXDATAFILES 512
    MAXINSTANCES 8
    MAXLOGHISTORY 7303
LOGFILE
  GROUP 1 (
    '/u01/oradata/group_1.342.825482805.log',
    '/u01/oradata/group_1.261.825482807.log'
  ) SIZE 500M BLOCKSIZE 1024,
  GROUP 2 (
    '/u01/oradata/group_2.343.825482811.log',
    '/u01/oradata/group_2.262.825482813.log'
  ) SIZE 500M BLOCKSIZE 1024,
  GROUP 3 (
    '/u01/oradata/group_3.340.825482819.log',
    '/u01/oradata/group_3.257.825482823.log'
  ) SIZE 500M BLOCKSIZE 1024,
  GROUP 4 (
    '/u01/oradata/group_4.341.825482825.log',
    '/u01/oradata/group_4.258.825482829.log'
  ) SIZE 500M BLOCKSIZE 1024
-- STANDBY LOGFILE
DATAFILE
'/u01/oradata/<file_name>.dbf',
  '/u01/oradata/<file_name>.dbf',
 ------
------
------
/u01/oradata/<file_name>.dbf'
CHARACTER SET UTF8
;
Modify the control file creation script and recreate the control file  before creating the controlfile we need to shutdown the database and startup nomount the database ....
Once the database is started in the nomount stage run the controlfile creation script to create the controlfile ..Once the contolfile is created the database is will in mount stage

Step 7 Catalog the archivelog backup Piece   

We need to catalog the archivelog backup piece for restoring the  necessary archive log

We need to Configure two Parameter's 

CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=OMPROD,OB2BARLIST=DB01New)';
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE'

CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE '<name of backup piece contains the necessary archive log in tape >

RMAN> CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 'DB01-New<OMPROD_784:828148601:1>.dbf';

allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=506 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Data Protector A.07.00/72
cataloged backup piece
backup piece handle=DB01-New<OMPROD_784:828148601:1>.dbf RECID=1 STAMP=837986306


if the necessary archive log is in one or more files then we need to catalog the file one by one catalog one backup file and then run the recover command .. the recover command will restore the archivelog in the default archivelog location and still it needs the more archivelog then it will error out again ..with the new archivelog number which is necessary so now we need to find the new archivelog number file and catalog it and re run the recover command ..

Step 8 Recover the database

Run the recover command after allocating the channel
RMAN> run
2> {
3> allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=OMPROD,OB2BARLIST=DB01New)';
4> recover database until time "to_date('2013-10-07:1:44:00','YYYY-MM-DD HH24:MI:SS')";
5> }

released channel: ORA_SBT_TAPE_1
allocated channel: dev_0
channel dev_0: SID=506 device type=SBT_TAPE
channel dev_0: Data Protector A.07.00/72

Starting recover at 27-JAN-14

starting media recovery

archived log for thread 2 with sequence 1014 is already on disk as file /prod01/app/oraprod/fast_recovery_area/OMPROD/archivelog/2014_01_27/o1_mf_2_1014_9gf7zs4w_.arc
channel dev_0: starting archived log restore to default destination
channel dev_0: restoring archived log
archived log thread=1 sequence=786
channel dev_0: restoring archived log
archived log thread=2 sequence=1015
channel dev_0: reading from backup piece DB01-New<OMPROD_791:828236299:1>.dbf
channel dev_0: piece handle=DB01-New<OMPROD_791:828236299:1>.dbf tag=TAG20131008T013818
channel dev_0: restored backup piece 1
channel dev_0: restore complete, elapsed time: 00:06:06
archived log file name=/prod01/app/oraprod/fast_recovery_area/OMPROD/archivelog/2014_01_27/o1_mf_1_786_9gf97ylf_.arc thread=1 sequence=786
archived log file name=/prod01/app/oraprod/fast_recovery_area/OMPROD/archivelog/2014_01_27/o1_mf_2_1014_9gf7zs4w_.arc thread=2 sequence=1014
archived log file name=/prod01/app/oraprod/fast_recovery_area/OMPROD/archivelog/2014_01_27/o1_mf_2_1015_9gf97ymf_.arc thread=2 sequence=1015
channel default: deleting archived log(s)
archived log file name=/prod01/app/oraprod/fast_recovery_area/OMPROD/archivelog/2014_01_27/o1_mf_1_786_9gf97ylf_.arc RECID=4 STAMP=837988248
channel default: deleting archived log(s)
archived log file name=/prod01/app/oraprod/fast_recovery_area/OMPROD/archivelog/2014_01_27/o1_mf_2_1015_9gf97ymf_.arc RECID=3 STAMP=837988247
media recovery complete, elapsed time: 00:00:13
Finished recover at 27-JAN-14
released channel: dev_0


Once the recover command is complete then we need to  open the database with the reset log's .. the log files which is specified in the control file will be create .. before opening of the database by the rest log's command 

SQL> alter database open resetlogs;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE


We have not create the temp table space so we will find the error in the archive log for the temp table space
We need to create the new temp table space and assign as the default temp table space and drop the Previous table space  

For the regular Cloning activities we can follow the duplicate the database when the catalog and source database are available but when both are not available only the tape backup is aaliable then follow the above process  
you might get the below error's in the alert log while this Process  of restoration






1 comment:

  1. Oracle Fusion Applications: Restoring Rman Backup Witout Source Database And Catalog Database From Tape >>>>> Download Now

    >>>>> Download Full

    Oracle Fusion Applications: Restoring Rman Backup Witout Source Database And Catalog Database From Tape >>>>> Download LINK

    >>>>> Download Now

    Oracle Fusion Applications: Restoring Rman Backup Witout Source Database And Catalog Database From Tape >>>>> Download Full

    >>>>> Download LINK bD

    ReplyDelete