RMAN – Veritas NetBackup Integration
RMAN – Veritas NetBackup Integration
I just recently got RMAN working with NetBackup. I have been asked to document this at work . Coincidently it makes for a great blog post!
#1. It is very important that you document things and how they are done so that other people can learn how to do them, know how it is done, and you can have a standard based off of this. It also gives you a baseline to improve upon. If you don’t believe me, read the book “The Goal”.
First, let me explain why we used RMAN and then why we linked it with Veritas. RMAN gives you so much flexibility and control of your backups. It might seem mundane at first, but once you get into the thick of it, you realize how powerful it is. There is an interface to RMAN through database control / grid control but I think Oracle still could improve greatly upon it. They leave many options out, but if the goal is simplicity and to get someone to do it, it is very powerful in that regard. I guess something is better than nothing, but really it’s pretty good but could be much better. How’s that?
RMAN also checks for corrupted blocks and can assist you with recovering them. It can keep track of block changes through a tracking file. This way it does not have to scan every block to see if it has changed. Even more powerful, if you have not compressed your backups, you can merge your level 1 and your level 0 to create a new level 0 backup. This can greatly speed up recovery times. I could go on and on but RMAN is a very powerful utility. I will blog more about it later.
Second, why did we want to link it with Veritas Netbackup? Well Veritas Netbackup is the corporate standard. You could just as well link it with EMC Networker and Tivoli Storage manager and any other backup vendor that makes a library to link RMAN with the MML. Before, we would have to have the backup person pull our Oracle backups off disk or we would execute a script after they went to disk. The problem is when the system crashes and we have to wake our backup person in the middle of the night to restore our files. If we find out it is the wrong one, we wake him up again. Recoveries take longer and the company loses money. By integrating RMAN with the Veritas Backup Agent we can now restore without having to wakeup our Backup Admin. Why? Because RMAN talks directly with Veritas when it backs up so that it is able to tell Veritas what it needs when it is time to recover.
Now keep in mind this combination is very powerful. My simple example does not do it justice : ).
First, you have to have NetBackup and the Oracle Agent installed on your server. You also need to have your Backup Admin enter the key into the Master Server so it will allow you to do this sort of backup. He will also have to configure the bp.conf file located in the default install directory for Netbackup which is /usr/openv/netbackup. He will also need to configure a backup policy that is of the Oracle type and assign it to the client.
Once this is done, you will want to check connectivity from the server by issuing /usr/openv/netbackup/bin/bpclntcmd -pn
Next, verify the version /usr/openv/netbackup/bin/bplntcmd -sv
Next, check to make sure the NetBackup communication daemons are running or it won’t work:
netstat -a | grep bpcd
netstat -a | grep vnetd
After that is done, shutdown your Oracle instance then as the Oracle user run /usr/openv/netbackup/bin/oracle_link to automatically link the ORACLE_HOME/lib/libobk.so to the proper libraries in the NetBackup directory.
Once that is done startup your instance and set your ORACLE_HOME and ORACLE_SID if it is not set and issue the following commands:
rman target /
RMAN> run
2> {
3> allocate channel t1 type 'SBT_TAPE';
4> backup database;
5> }
allocated channel: t1
channel t1: sid=138 devtype=SBT_TAPE
channel t1: VERITAS NetBackup for Oracle – Release 5.1 (2006030220) Starting backup at 24-MAY-07
channel t1: starting full datafile backupset
channel t1: specifying datafile(s) in backupset
input datafile fno=00005 name=/ora01/app/oracle/oradata/testdb/mgmt.dbf
input datafile fno=00001 name=/ora01/app/oracle/oradata/testdb/system01.dbf
input datafile fno=00003 name=/ora01/app/oracle/oradata/testdb/sysaux01.dbf
input datafile fno=00002 name=/ora01/app/oracle/oradata/testdb/undotbs01.dbf
input datafile fno=00006 name=/ora01/app/oracle/oradata/testdb/mgmt_ecm_depot1.dbf
input datafile fno=00007 name=/ora01/app/oracle/oradata/testdb/rman_data_01.dbf
input datafile fno=00004 name=/ora01/app/oracle/oradata/testdb/users01.dbf
channel t1: starting piece 1 at 24-MAY-07
channel t1: finished piece 1 at 24-MAY-07
piece handle=03iihe1l_1_1 tag=TAG20070524T134629 comment=API Version 2.0,MMS Version 5.0.0.0
channel t1: backup set complete, elapsed time: 00:07:05
channel t1: starting full datafile backupset
channel t1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel t1: starting piece 1 at 24-MAY-07
channel t1: finished piece 1 at 24-MAY-07
piece handle=04iiheeu_1_1 tag=TAG20070524T134629 comment=API Version 2.0,MMS Version 5.0.0.0
channel t1: backup set complete, elapsed time: 00:03:25
Finished backup at 24-MAY-07
released channel: t1
And folks that is about it. If you want to run in parallel, then just allocate more channels like this.
RMAN> run
2> {
3> allocate channel t1 type 'SBT_TAPE';
4> allocate channel t2 type 'SBT_TAPE';
5> backup database;
6> }
If you want to set this up by default then issue a show all command.
RMAN> show all
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128′; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/ora01/app/oracle/product/10.2.0/db_1/dbs/snapcf_gctest.f’; # default
Now issue
CONFIGURE DEFAULT DEVICE TYPE TO SBT_TAPE;
Now all your backups will go to tape by default. Just start up RMAN and issue backup database; The other thing I did not show but you should do is backup plus your archive logs: backup database plus archivelog;