How to backup Oracle database via NetBackup for Oracle shell script

How to backup Oracle database via NetBackup for Oracle shell script

Article: 100038305
Last Published: 2019-07-05
Ratings: 26 6
Product(s): NetBackup

Description

Configuring Sample RMAN Script :

The NetBackup provides sample scripts at following location:-

UNIX/Linux: /usr/openv/netbackup/ext/db_ext/oracle/samples/rman
Windows: install_path\NetBackup\dbext\oracle\samples\rman

There are several scripts for different purpose. In order to take the whole database backup we can use following script :-

- UNIX and Linux: hot_database_backup.sh
- Windows: hot_database_backup.cmd

These Scripts are used for both full backups and incremental backups. When a schedule runs, NetBackup sets environment variables that the script uses to perform the backup. With the proper schedules, you can use this script to run a backup every week on Friday night and an incremental backup each night for the rest of the week automatically.

In order to configure the script, We need following environmental variables :

1. ORACLE_HOME=/db/oracle/product/ora102
2. ORACLE_SID=ora102
3. ORACLE_USER=ora102
4. TARGET_CONNECT_STR=sys/manager

Note : These are the default variable in the script.

Apart from these variables we also need to specify the "Send Parameters" in the backup script. These parameters are as mentioned below :-

SEND 'NB_ORA_SERV=<master server name>,NB_ORA_CLIENT=<oracle server name>,NB_ORA_POLICY= backup policy name';

We need to add the 'Send Parameter' in the backup script between "Allocation Channel & Backup parameter", For example :-

RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
Add the send parameter line
BACKUP

# backup all archive logs
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
Add the send parameter line
BACKUP

ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
Add the send parameter line
BACKUP
    # recommended format
    FORMAT 'cntrl_%s_%p_%t'
    CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}

Note :-
1. We have to specify this parameter for every backup (i.e database, Archive log and Control file).
2. In case of Unix Platform, send parameters values (i.e Master server name, Client name & Policy name) is case sensitive. We must use the same case in backup policy.
3. We can also add & modify the parameters as per the environment requirements.

Configuring Backup Policy :

After configuring the backup script, we need to create the Oracle backup policy via Netbackup Administration console and specify the required parameters. For Example Target STU, Schedule, Retentions, Client name and Selection list.

Specify the full path name to the file that contains the script. For example:-

UNIX/Linux: /oracle/scripts/db_full_backup.sh
Windows: N:\oracle\scripts\db_full_backup.cmd

Now we can try by executing the backup job. 

Additional Information :

Before running the backup from Netbackup we need to make sure that Netbackup library is linked with Oracle.

We can run following command from RMAN prompt to check the linking.

RMAN> run
2> {
3> allocate channel c1 type 'SBT_TAPE';
4> release channel c1;
5> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=48 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 7.6 (2013111313)

released channel: c1

If the library is linked we will receive above output otherwise it may return below mentioned error :-

RMAN-03009: failure of allocate command on ch00 channel at 06/18/2014 08:36:11
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27211: Failed to load Media Management Library
Additional information: 2

If the Library is not linked, run following command on Netbackup client.

Browse to "installpath/netbackup/bin" or "/usr/openv/netbackup/bin"

[root@dbclient1 bin]# ./oracle_link
Wed Jun 18 04:52:26 EDT 2014
All Oracle instances should be shutdown before running this script.

Please log into the Unix system as the Oracle owner for running this script

Do you want to continue? (y/n) [n]

NOTE : We can ignore the above prompt and continue by selecting 'Yes'.

Was this content helpful?