Saturday, March 5, 2011

Oracle Secure Backup and Virtual Tape Drive

Setting up Oracle Secure Backup with a Open Source Virtual Tape Drive.

I wanted to test RMAN 11g features while backing up to tape. But i don't want to have to buy a physical tape drive. Thankfully Mark Harvey has created an Open Source Virtual Tape Drive.

http://sites.google.com/site/linuxvtl2

mhvtl once installed creates 2 Virtual Tape Libraries and 8 Virtual Tape Drives.
Each Virtual Tape Library contains serveral barcoded tapes which can be used in the Tape Drives for backup and recovery.

Here is what i did to install and configure OSB with mhvtl on OEL5.

Install Oracle Secure Backup:

Follow instructions from Oracle documentation

After the installation is complete we can start using the OSB webtool or ob command line. I started by using the webtool, but later i found the ob commands better.


Configure the Oracle user for OSB:

Browse to https://hostname/login.php and login and as admin.

Goto Configure > users > Add



Now edit the user to set up Pre-authorized Access.
Click on the new Oracle user and goto Edit then Preauthorized Access.



Now Check that your host has the mediaserver role.

Goto Configure > Hosts




Install Virtual Tape Drive (mhvtl):

Download the mhvtl files from http://sites.google.com/site/linuxvtl2/. to /tmp

mhvtl-2011-01-11.tgz
mhvtl-0.18-13.i586.rpm (32 bit)
mhvtl-0.18-13.src.rpm

Install the rpm's


[root@adminserver:/tmp]$ rpm -ivh mhvtl-0.18-13.i586.rpm

[root@adminserver:/tmp]$ rpm -ivh mhvtl-0.18-13.src.rpm



Copy the tgz file to /usr/src/redhat/SOURCES/ and extract to /usr/src/redhat/BUILD/


[root@adminserver:/tmp]$ mv mhvtl-2011-01-11.tgz /usr/src/redhat/SOURCES/

[root@adminserver:/tmp]$ cd /usr/src/redhat/BUILD/

[root@adminserver:/usr/src/redhat/BUILD/]$ tar xvfz ../SOURCES/mhvtl-2011-01-11.tgz



Now build/make the kernel, and start the package.



[root@adminserver:/usr/src/redhat/BUILD/]$ cd mhvtl-0.18/kernel

[root@kundun:/usr/src/redhat/BUILD/mhvtl-0.18/kernel]$ make

[root@kundun:/usr/src/redhat/BUILD/mhvtl-0.18/kernel]$ make install

[root@kundun:/usr/src/redhat/BUILD/mhvtl-0.18/kernel]$ /etc/init.d/mhvtl start



Check that its running...


[root@kundun:/usr/src/redhat/BUILD/mhvtl-0.18/kernel]$ps -ef | grep vtl
vtl 3674 1 0 10:24 ? 00:00:00 vtltape -q 11 -v
vtl 3679 1 0 10:24 ? 00:00:00 vtltape -q 12 -v
vtl 3684 1 0 10:24 ? 00:00:00 vtltape -q 13 -v
vtl 3692 1 0 10:24 ? 00:00:00 vtltape -q 14 -v
vtl 3697 1 0 10:24 ? 00:00:00 vtltape -q 31 -v
vtl 3719 1 0 10:24 ? 00:00:00 vtltape -q 32 -v
vtl 3727 1 0 10:24 ? 00:00:00 vtltape -q 33 -v
vtl 3765 1 0 10:24 ? 00:00:00 vtltape -q 34 -v
vtl 3979 1 0 10:24 ? 00:00:00 vtllibrary -q 10 -v
vtl 4048 1 0 10:24 ? 00:00:00 vtllibrary -q 30 -v
root 24057 5948 0 14:25 pts/2 00:00:00 grep vtl



Install the lsscsi package.

The lsscsi command lists information about SCSI devices in Linux.
This package can be downloaded from http://sg.danny.cz/scsi/lsscsi.html

Below we can see the scsi device that are present on the linux server.


[root@adminserver:~]$lsscsi -g
[0:0:0:0] disk ATA WDC WD1600BEVS-6 04.0 - /dev/sg0
[3:0:0:0] disk SAMSUNG HM321HI - /dev/sg1
[4:0:0:0] mediumx STK L700 550V - /dev/sg10
[4:0:1:0] tape IBM ULT3580-TD5 550V /dev/st0 /dev/sg2
[4:0:2:0] tape IBM ULT3580-TD5 550V /dev/st1 /dev/sg3
[4:0:3:0] tape IBM ULT3580-TD4 550V /dev/st2 /dev/sg4
[4:0:4:0] tape IBM ULT3580-TD4 550V /dev/st3 /dev/sg5
[4:0:8:0] mediumx SPECTRA PYTHON 550V - /dev/sg11
[4:0:9:0] tape IBM ULT3580-TD4 550V /dev/st4 /dev/sg6
[4:0:10:0] tape IBM ULT3580-TD4 550V /dev/st5 /dev/sg7
[4:0:11:0] tape IBM ULT3580-TD4 550V /dev/st6 /dev/sg8
[4:0:12:0] tape IBM ULT3580-TD4 550V /dev/st7 /dev/sg9



For more information about the virtual library and tape drives we can look at the /etc/mhvtl/device.conf file.

Below is a example of the device.conf file showing the details of a library and tape drive.



Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00
Vendor identification: STK
Product identification: L700
Product revision level: 550V
Unit serial number: XYZZY_A
NAA: 10:22:33:44:ab:00:00:00

Drive: 11 CHANNEL: 00 TARGET: 01 LUN: 00
Library ID: 10 Slot: 01
Vendor identification: IBM
Product identification: ULT3580-TD5
Product revision level: 550V
Unit serial number: XYZZY_A1
NAA: 10:22:33:44:ab:00:01:00
Compression: factor 1 enabled 1
READ_ONLY: LTO_2
READ_ONLY: LTO_3
READ_WRITE: LTO_4
READ_WRITE: LTO_5
WORM: LTO_4
WORM: LTO_5
ENCRYPTION: LTO_4
ENCRYPTION: LTO_5



Configure the virtual libraries and tape drives with OSB:

Switching back to OSB, we navigate to Configure > Devices. Now click 'add' and we can add the device below. The details for the device i got from the /etc/mhvtl/device.conf file.



After adding the library, we need to attach the library to a raw device. If we click on the 'attachment' button we can specify the raw device. The details for the raw device were found using the lsscsi package (lsscsi -g).



To add a tape drive, navigate to configure > Device > add.



Don't forget to define the attachment for the tape drive.





******************************************
keywords:
******************************************
rdbms version:
******************************************

2 comments:

Anonymous said...

...fail: unexpired backup pieces are overwriten (volume relabeled) after tape is unloaded + loaded for writing

temmah said...

...pass

Check the Oracle forums, I saw something on this in the forums when i was doing the install.