©2015 - 2022 Chad’s Technoworks. Disclaimer and Terms of Use

Chad’s TechnoWorks My Journal On Technology

Information Technology

NETBACKUP FOR ORACLE RMAN

Netbackup is a media management software for backup.


The following guidelines has these assumptions:

               atlantic = hostname of the database server

               nbmaster = hostname of Netbackup Master Server

               nbmedia  = hostname of Netbackup Media Server


STEP 1: Verify the NB Client version.

$ cat /usr/openv/netbackup/bin/version

NetBackup-Solaris10 7.5.0.6


Once version is determined, read the release notes for supported database versions and

check if your database is covered.


Check for NetBackup agent for your database if exist:

ls -l /usr/openv/netbackup/ext/db_ext

or,

ls -l /usr/openv/netbackup/dbext


You should see the folders belonging to your kind of database - db2, oracle, etc.


STEP 2: Link the Oracle database backup library file to NetBackup.


Ensure that all database instance running on the ORACLE_HOME you would like to link with Netbackup

had been shutdown before proceeding with this step.

 

Go to the NB client directory: /usr/openv/netbackup/bin

Run the linking script: oracle_link

This will link the existing backup library of oracle to the netbackup library.


AIX:

ln -s ${LIBOBK_PATH}/libobk.a64 ${O_HOME}/lib/libobk.a ;


HP IA64:

ln -s ${LIBOBK_PATH}/libobk.so ${O_HOME}/lib/libobk.so ;


HP PA-RISK:

ln -s ${LIBOBK_PATH}/libobk.sl64 ${O_HOME}/lib/libobk.sl ;


Solaris Sparc:

ln -s ${LIBOBK_PATH}/libobk.so64.1 ${O_HOME}/lib/libobk.so ;


Solaris x64

ln -s ${LIBOBK_PATH}/libobk.so.1 ${O_HOME}/lib/libobk.so ;


RedHat Linux x64

ln -s ${LIBOBK_PATH}/libobk.so64 ${O_HOME}/lib/libobk.so ;


An output log is generated located at /tmp/make_trace.

 


STEP 3: Ensure that the Netbackup Client configuration has the correct entries.

Edit bp.conf


Sample entries:

$ cat /usr/openv/netbackup/bp.conf

SERVER = nbmaster.mydomain.com

MEDIA_SERVER = nbmedia.mydomain.com

CLIENT_NAME = atlantic

CONNECT_OPTIONS = localhost 1 0 2



STEP 4: Create your RMan script.

Copy the NB template rman scripts and modify it as your main Rman NB script.

Location: /usr/openv/netbackup/ext/db_ext/oracle/samples/rman

Sample Scripts:

cold_database_backup.sh

cold_duplex_database_backup_full.sh

database_restore.sh

hot_database_backup.sh

hot_database_backup_proxy.sh

hot_tablespace_backup.sh

hot_tablespace_backup_proxy.sh

pit_database_restore.sh


The common template being used are the cold_database_backup.sh, hot_database_backup.sh and database_restore.sh.

You need to set the following variables in the script:


ORACLE_HOME=your Oracle home

ORACLE_SID=your SID

ORACLE_USER=oracle

TARGET_CONNECT_STR=/


A NetBackup Policy and Schedule has to exist to run any rman script.

For understanding the basics of Policies and Sched, check the Symantec FAQ


You have to advise your storage team on what policy settings should be, especially in particular to

retention period and schedule.

Sample policy and sched:

NETBACKUP CONFIG        VALUE

=====================   ==================

POLICY NAME             ORASID123_POLICY

SCHEDULE 1 NAME         WEEKLY

SCHEDULE 1 RETENTION    2 YEARS

SCHEDULE 2 NAME         DAILY

SCHEDULE 2 RETENTION    2 WEEKS



The essential NB_ORA variables need to set for your rman script. In my case, I had to set the following values:


NB_ORA_CLIENT=your host server             

NB_ORA_SERV=your net backup master server

NB_ORA_POLICY=name of the NB policy

NB_ORA_SCHED=the NB schedule name


Use the above media parameters to send in your rman script.



TO BACKUP ORACLE DATABASE


EXAMPLE 1: Using NOCATALOG, backup history stored on control file.


rman target /


RMAN> spool log to /home/oracle/ORASID123_full_backup.log

RMAN> show all;

RMAN> run {

allocate channel ch1 type 'SBT_TAPE';

# Set NETBACKUP configuration via Netbackup Master server

send 'NB_ORA_CLIENT=atlantic, NB_ORA_SERV=nbmaster.mydomain.com, NB_ORA_POLICY=ORASID123_POLICY, NB_ORA_SCHED=WEEKLY';

backup as backupset filesperset 10 tag full_db_backup format 'full_db_ORASID123_t%t_s%s_p%p.rman' database plus archivelog;

release channel ch1;

allocate channel ch1 type DISK;

backup tag full_db_ctlfile format '/my_oracle_base/admin/ORASID123/ctlORASID123_bak.ctl' current controlfile;

release channel ch1;

}

RMAN> sql 'alter database backup controlfile to trace';




EXAMPLE 2: using the hot backup with CATALOG


LEVEL 0


rman catalog RMAN/RMAN11204@CATDB1 target /


RMAN> spool log to /home/oracle/ORASID123_full_backup.log

RMAN> show all;

RMAN> run {

allocate channel ch1 type 'SBT_TAPE';

# Set NETBACKUP configuration via Netbackup Master server

send 'NB_ORA_CLIENT=atlantic,NB_ORA_SERV=nbmaster.mydomain.com,NB_ORA_POLICY=ORASID123_POLICY,NB_ORA_SCHED=WEEKLY';

backup incremental level 0 format 'level0_%d_date%T_s%s_p%p_time%t' database include current controlfile;

sql "alter system archive log current";

# Backup Archive Logs

backup format 'level0_arc_%d_date%T_s%s_p%p_time%t' archivelog all;

# Cleanup all expired backups and archivelogs

crosscheck backup;

delete noprompt expired backup;

crosscheck archivelog all;

delete noprompt expired archivelog all;


# Delete archive log which are backed up to tape and are older than 7 days from disk

delete noprompt archivelog all backed up 1 times to device type sbt completed before 'sysdate-7';


# Release Channel

release channel ch1;

}


LEVEL 1 CUMMULATIVE


rman catalog RMAN/RMAN11204@CATDB1 target /


RMAN> spool log to /home/oracle/ORASID123_full_backup.log

RMAN> show all;

RMAN> run {

allocate channel ch1 type 'SBT_TAPE';

# Set NETBACKUP configuration via Netbackup Master server

send 'NB_ORA_CLIENT=atlantic,NB_ORA_SERV=nbmaster.mydomain.com,NB_ORA_POLICY=ORASID123_POLICY,NB_ORA_SCHED=DAILY';

backup incremental level 1 cumulative format 'level1c_%d_date%T_s%s_p%p_time%t' database include current controlfile;

sql "alter system archive log current";

# Backup Archive Logs

backup format 'level1c_arc_%d_date%T_s%s_p%p_time%t' archivelog all;

# Cleanup all expired backups and archivelogs

crosscheck backup;

delete noprompt expired backup;

crosscheck archivelog all;

delete noprompt expired archivelog all;


# Delete archive log which are backed up to tape and are older than 7 days from disk

delete noprompt archivelog all backed up 1 times to device type sbt completed before 'sysdate-7';


# Release Channel

release channel ch1;

}





TO RESTORE ORACLE DATABASE


Since our sample hot backup had two separate media for WEEKLY and DAILY Netbackup sched, we will

allocate two separate channels.


Set your shell env variables:

 

ORACLE_SID=?

ORACLE_BASE=?

ORACLE_HOME=?


STEP 1. MOUNT THE DATABASE


sqlplus /nolog

SQL> connect / as sysdba

SQL> startup mount ;

SQL> exit


STEP 2. RECOVER THE DATABASE


$ rman catalog RMANADMIN/RMAN123@RCAT01 target /


Recovery Manager: Release 11.2.0.1.0 - Production on Thu Apr 11 20:32:01 2013


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORADB (DBID=2565746290, not open)

connected to recovery catalog database


RMAN>


RMAN> run {

# Allocate Netbackup channel

allocate channel ch1 type 'SBT_TAPE'

send 'NB_ORA_CLIENT=atlantic,NB_ORA_SERV=nbmaster.mydomain.com,NB_ORA_POLICY=ORASID123_POLICY,NB_ORA_SCHED=WEEKLY';

allocate channel ch2 type 'SBT_TAPE'

send 'NB_ORA_CLIENT=atlantic,NB_ORA_SERV=nbmaster.mydomain.com,NB_ORA_POLICY=ORASID123_POLICY,NB_ORA_SCHED=DAILY';

# Start Recovery

restore database;

recover database;

# Release Channel

release channel ch1;

release channel ch2;

}

RMAN> alter database open ;

RMAN> exit