Oracle RMAN full backup script for EMC NetWorker

April 6, 2013 by 11 Comments 

In this article I’ll share an RMAN script to backup the entire Oracle database including archived redo logs to tape library using EMC NetWorker. Before looking into the script see my notes below:

– Read about Oracle Recovery Manager (RMAN) concepts
– Script should work for Oracle database 10g and 11g
Oracle database name = ORCL
– I use 2 RMAN channels to speed up the backup
– I backup intentionally control file manually and automatically
– I limit the size of backup sets by number of files per set and size of a backup set
– PARMS section includes instructions for EMC NetWorker server
– After the backup I allocate a maintenance channel crosschecking the backups
– I do not use backup compression in RMAN script, since it’s done on NetWorker server
– This script is independent from RMAN configuration parameters
– The script can be scheduled by EMC NetWorker server daily

# Last update: 18-Mar-2013
#
connect target /
sql 'alter system archive log current';
sql "alter session set nls_date_format=''dd.mm.yyyy hh24:mi:ss''";
RUN
{
configure default device type to sbt_tape;
configure controlfile autobackup on;
set command id to 'ORCLOnlineBackupFull';
ALLOCATE CHANNEL c1 DEVICE TYPE sbt_tape parms 'ENV=(NSR_SERVER=nsrserver1,NSR_DATA_VOLUME_POOL=OracleProd,NSR_GROUP=Oracle_Full,NSR_CLIENT=MyOracleHost)';
ALLOCATE CHANNEL c2 DEVICE TYPE sbt_tape parms 'ENV=(NSR_SERVER=nsrserver1,NSR_DATA_VOLUME_POOL=OracleProd,NSR_GROUP=Oracle_Full,NSR_CLIENT=MyOracleHost)';
backup full database tag ORCL_FULL format '%d_%T_%s_%p_FULL' filesperset 5 maxsetsize 32G;
sql 'alter system archive log current';
backup tag ORCL_ARCHIVE format '%d_%T_%s_%p_ARCHIV' archivelog all delete all input filesperset 50 maxsetsize 20G;
backup tag ORCL_CONTROL current controlfile format '%d_%T_%s_%p_CONTROL';
release channel c1;
release channel c2;
}
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
allocate channel for maintenance device type SBT_TAPE;
crosscheck backup;
release channel;

I find also valuable the below RMAN backup summary report that gives you an idea what backup sets are created as a result of running that RMAN script.

RMAN> list backup summary;
List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
8982 B F A SBT_TAPE 05-APR-13 1 1 NO ORCL_FULL
8983 B F A SBT_TAPE 05-APR-13 1 1 NO ORCL_FULL
8984 B F A SBT_TAPE 05-APR-13 1 1 NO ORCL_FULL
8985 B F A SBT_TAPE 05-APR-13 1 1 NO ORCL_FULL
8986 B F A SBT_TAPE 05-APR-13 1 1 NO ORCL_FULL
8987 B F A SBT_TAPE 05-APR-13 1 1 NO TAG20130405T181009
8988 B A A SBT_TAPE 05-APR-13 1 1 NO ORCL_ARCHIV
8989 B A A SBT_TAPE 05-APR-13 1 1 NO ORCL_ARCHIV
8990 B F A SBT_TAPE 05-APR-13 1 1 NO ORCL_CONTROL
8991 B F A SBT_TAPE 05-APR-13 1 1 NO TAG20130405T181129

I encourage readers to share / comment own commands and tips on the similar RMAN full backup script in this post. And I’ll continue with more RMAN scripts in the next articles.

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

Comments

11 Responses to “Oracle RMAN full backup script for EMC NetWorker”
  1. Karen Clark says:

    Can you provide a script to recover the db using this backupset?

  2. Dave says:

    Hi Kirill,

    Thanks for the information. it was good to know. How about RMAN restores in networker i mean the process involved.

    Regards,
    D

  3. Raghav says:

    First of all i liked your post . Thanks for sharing .
    Iam relatively new to RMAN . I have few basic queries . Your input is much appreciated .

    1. What is the purpose to include “Files per set” ? How does it contribute to backup optimization ? On what basis , the value of 5 was determined ? Kindly share for our knowledge.
    2. What is the significance of “maxsetsize” ? How does it contribute to backup optimization ? On what basis , the value of 5 was determined ? Kindly share for our knowledge.

    thank you .

  4. Raj Gupta says:

    Hi Kirill ;
    Thanks for sharing wonderful details related to RMAN backup suing networker. I would request you to please share the recovery script; If my DB have an issue.

    Like here in allocate channel we have some parameter related to Backup server and Networker stuff- What we have to set when we have recover from same from tap drive.

    -(NSR_SERVER=nsrserver1,NSR_DATA_VOLUME_POOL=OracleProd,NSR_GROUP=Oracle_Full,NSR_CLIENT=Oracle Host

    Please confirm about this above value.

    Thnaks.
    Raj Gupta

  5. Kirill Loifman says:

    “Files per set” and “maxsetsize” are 2 parameters to ensure backup sets are not too big.
    There are no perfect values for them since they are depend on your DB size, performance of your backup storage and SLAs.
    You have to play with them to reach your ultimate goal
    — Kirill

  6. jan Gerrit says:

    Hi

    is this script also usable with Networker V9 ? Oracle 10g is not supported with the NMDA plugin and I am looking for a way to backup my 10g database with networker 9 to data domain

    Jan Gerrit

  7. Kirill Loifman says:

    just try it, but 10g is not supported, that is even more important.
    — Kirill

  8. Rathan says:

    I have used this script and I get below error

    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03009: failure of backup command on CH2 channel at 02/18/2017 23:13:43
    ORA-19506: failed to create sequential file, name=”MSAFSAND_936314021_3399_DBF”, parms=””
    ORA-27028: skgfqcre: sbtbackup returned error
    Can only archive data to archive pools. (0:5:6)

    please help !!!

  9. Stuart Barkley says:

    Hi,
    I am new to Networker. I used TSM for many years. I am faced with a script with these sort of connections in there:
    “connect target sys/syspw@dbconnector”

    Problem is trying to get rid of the passwords. This means also getting rid of the tns connector.
    The script is obviously run on each db server but how do you set up the db env (calling oraenv?) before your script is run.
    I see you use “connect target /”. How did you setup the env before your script was called?
    Is this possible from Networker? Or is there a way to call a shell script directly instead of an RMAN command file?

    Thanks for your help if you (or anyone else) knows the answer…

  10. Kirill Loifman says:

    The Networker calls a script on the server (this is our way).
    To be able to avoid DB password, create RMAN DB user and grant system role to it. On 12c better new SYSBACKUP role.
    https://docs.oracle.com/database/121/DBSEG/authorization.htm#GUID-BF12E37F-4606-42BB-B8B6-4CDC5A870EE7

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