Oracle RMAN recovery script for EMC NetWorker

June 27, 2016 by 4 Comments 

In this article I’ll share an Oracle RMAN script to do restore and recovery an Oracle database from tape library using EMC NetWorker. Apply this RMAN template to different recovery situations you might have. Before looking into the RMAN script see my notes below:

– Read about Oracle Recovery Manager (RMAN) concepts
– Look at the corresponding RMAN backup script for NetWorker
– The recovery script should work for Oracle database 11g, 12c (maybe 10g)
Oracle database name = ORCL
– I use 2 RMAN channels to speed up the recovery of database
– Recovery of spfile and/or control file is optional and depends on your recovery situation
– PARMS section includes instructions for EMC NetWorker server (depends on Networker server configuration)
– Choose appropriate database recovery scenario (by default -> compete DB recovery; I commented 3 options for incomplete DB recovery scenario)
– This script is independent from RMAN configuration parameters

# Last update: 18-Mar-2015

# Restore database spfile (ONLY if required!)
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt_tape parms ‘ENV=(NSR_SERVER=nsrserver1,NSR_DATA_VOLUME_POOL=OracleProd,NSR_CLIENT=MyOracleHost,NSR_FXBUSY_RETRIES=10)’;
restore spfile to ‘/opt/oracle/oradata/ORCL/spfileORCL.ora’ from ‘c-3336676360-20160526-01’;
release channel c1;
}

# Restore all control files (ONLY if required!)
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt_tape parms ‘ENV=(NSR_SERVER=nsrserver1,NSR_DATA_VOLUME_POOL=OracleProd,NSR_CLIENT=MyOracleHost,NSR_FXBUSY_RETRIES=10)’;
restore controlfile;
release channel c1;
}

# Restore and recover database (3 options commented for incomplete recovery scenario -> ‘alter database open resetlogs’ required before opening the DB)
RUN
{
#SET UNTIL logseq 2652;
#SET UNTIL time “to_date(‘30.10.2013 22:00′,’dd.mm.yyyy hh24:mi’)”;
#SET UNTIL SCN 46352283
allocate channel c1 type ‘sbt_tape’ parms ‘ENV=(NSR_SERVER=nsrserver1,NSR_DATA_VOLUME_POOL=OracleDZDD01,NSR_CLIENT=MyOracleHost,NSR_FXBUSY_RETRIES=10)’;
allocate channel c2 type ‘sbt_tape’ parms ‘ENV=(NSR_SERVER=nsrserver1,NSR_DATA_VOLUME_POOL=OracleDZDD01,NSR_CLIENT=MyOracleHost,NSR_FXBUSY_RETRIES=10)’;
set autolocate off;
restore database;
recover database;
release channel c1;
release channel c2;
}

Enjoyed this article? Please share it with others using the social site of your choice:

Comments

4 Responses to “Oracle RMAN recovery script for EMC NetWorker”
  1. You marked this script as updated 2015 and the export script 2013. They do not seem to be working with the same parameters. What am I missing?

  2. Sheldon says:

    Hi Kirill,

    I know it has been a few years since you posted this, but perhaps you can help me. I have been at my current work site for a year and recently started checking backups and restore. We use Networker that calls an RMAN script. I have successfully restored from the last backup using
    ALLOCATE CHANNEL T1 TYPE SBT SEND ‘NSR_ENV=(NSR_SERVER=”????”,NSR_CLIENT=”????”)’;
    RESTORE CONTROLFILE FROM AUTOBACKUP;
    and from other previous backups with
    ALLOCATE CHANNEL T1 TYPE SBT SEND ‘NSR_ENV=(NSR_SERVER=”????”,NSR_CLIENT=”????”)’;
    RESTORE CONTROLFILE FROM …
    RESTORE DATABASE;
    RECOVER DATABASE;
    However, attempts to RESTORE with SET UNTIL results in Networker not finding the archivelogs.
    I tried RESTORE ARCHIVELOG FROM SEQUENCE …
    but still, Networker cannot find the archivelogs. Any archivelogs generated after the BACKUP CONTROLFILE was created are inaccessible. I have not found anybody using Networker and RMAN that has restored and rolled forward archivelogs until a specific time or SCN. Our Networker support suggested implementing an RMAN catalog but I do not want to do that.
    Have you restored UNTIL TIME or SCN from Networker/RMAN without catalog?

  3. Kirill Loifman says:

    Yes, it should definatelly work. First ensure not only your backup pieces available on the Networker but also that your control file of your DB still have the information about them. I recommend always extend the retention period of the backup metadata in the control file. I think by default its 7 days or so. Just do the following on your DB:
    alter system set control_file_record_keep_time=30 scope=both;

  4. Kirill Loifman says:

    NSR_ parameters can differ from version to version of the Networker. Please check your Networker documentation

Add a Comment

We welcome thoughtful and constructive comments from readers.
If you want your own picture to show with your comment?
Go get a Globally Recognized Avatar!

DBMS Blog Updates : Subscribe RSS RSS: Subscribe to Articles · Subscribe to Comments Subscribe RSS Receive site updates via email