Skip to content

MHVTL Virtual Tape Library (VTL) hands-on

Preamble

Almost all DBAs of my company are using IBM Tivoli Storage Manager (TSM) to backup their Oracle database directly on tape to, obviously, save a bit of expensive disk space… Recently I was discussing with one DBA about the loss of all control files with no recovery catalog. Yes the CATALOG command does not allow to catalog from tape !! The DBA was struggling to restore the database, that is also an exercise if you want to restore a production database backup to create a test database…

It was time for me to do something I have delayed for long: create a complete test environment with a Virtual Tape Library (VTL). A post on testing multiple recovery scenario will come later.

I have seen three main products:

  • MHVTL (open source)
  • Quadstor (free)
  • StarWind free VTL (free)

I had issue install Quadstor on OEL 9 and I did not want to put my email address to get StarWind free VTL (free) and as MHVTL is open source I have decided to go with it !

MHVTL emulates a tape library and tape drives, presenting them to your system as SCSI devices without physical tape hardware (for testing obviously).

Oracle RMAN (Recovery Manager) needs a Media Management Layer (MML) to communicate with a tape library while RAMN can back up to disk with nothing more.

Oracle Secure Backup (OSB) is Oracle’s own MML but other suppliers like Symantec NetBackup or IBM Tivoli Storage Manager provide their own proprietary MML.

My testing has been done with Oracle Enterprise edition 19c (19.28). In fact a container and an unique pluggable database. All running on Oracle Linux 9.6 in a Virtual Machine (Virtualbox) with 4 cores and 8GB of memory (server02.domain.com). Oracle Secure Backup is version 19.1.0.0.0.

MHVTL

Installation

Solve the mhvtl pre-requisites:

dnf install kernel-devel kernel-uek-devel lsscsi sg3_utils zlib lzo mtx mt-st

For the mhvtl GUI interface:

dnf install php

Download a zip of the project or git clone inside /tmp, for me and start by building the kernel module:

[root@server02 tmp]# unzip mhvtl-master.zip
[root@server02 tmp]# cd mhvtl-master/kernel/
[root@server02 kernel]# make
./config.sh
make -C /lib/modules/5.15.0-312.187.5.1.el9uek.x86_64/build M=/root/mhvtl-master/kernel modules
make[1]: Entering directory '/usr/src/kernels/5.15.0-312.187.5.1.el9uek.x86_64'
  CC [M]  /root/mhvtl-master/kernel/mhvtl.o
  MODPOST /root/mhvtl-master/kernel/Module.symvers
  CC [M]  /root/mhvtl-master/kernel/mhvtl.mod.o
  LD [M]  /root/mhvtl-master/kernel/mhvtl.ko
  BTF [M] /root/mhvtl-master/kernel/mhvtl.ko
Skipping BTF generation for /root/mhvtl-master/kernel/mhvtl.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/kernels/5.15.0-312.187.5.1.el9uek.x86_64'
[root@server02 kernel]# make install
install -o root -g root -m 644 mhvtl.ko /lib/modules/5.15.0-310.184.5.2.el9uek.x86_64/kernel/drivers/scsi/; \
depmod -a; \
if [ -f "/etc/modprobe.d/unsupported-modules" ]; then \
        sed -i 's/^allow_unsupported_modules 0/allow_unsupported_modules 1/' /etc/modprobe.d/unsupported-modules; \
fi
.
.
.

Do the same for the product itself:

cd /tmp/mhvtl-master
make
make install

Start the service and enable autostart:

[root@server02 ~]# systemctl daemon-reload
[root@server02 ~]# systemctl start mhvtl.target
[root@server02 ~]# systemctl enable mhvtl.target
[root@server02 ~]# systemctl status mhvtl.target
● mhvtl.target - mhvtl service allowing to start/stop all vtltape@.service and vtllibrary@.service instances at once
     Loaded: loaded (/usr/lib/systemd/system/mhvtl.target; disabled; preset: disabled)
     Active: active since Tue 2025-07-29 12:20:24 CEST; 5s ago
      Until: Tue 2025-07-29 12:20:24 CEST; 5s ago
       Docs: man:man:vtltape(1)
             man:man:vtllibrary(1)

Jul 29 12:20:24 server02 systemd[1]: Reached target mhvtl service allowing to start/stop all vtltape@.service and vtllibrary@.service instances at once.

The default configuration is:

[root@server02 ~]# lsscsi -g
[1:0:0:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr0   /dev/sg0
[2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda   /dev/sg1
[3:0:0:0]    mediumx STK      L700             0107  /dev/sch1  /dev/sg11
[3:0:1:0]    tape    IBM      ULT3580-TD8      0107  /dev/st1   /dev/sg3
[3:0:2:0]    tape    IBM      ULT3580-TD8      0107  /dev/st4   /dev/sg7
[3:0:3:0]    tape    IBM      ULT3580-TD6      0107  /dev/st2   /dev/sg4
[3:0:4:0]    tape    IBM      ULT3580-TD6      0107  /dev/st0   /dev/sg6
[3:0:8:0]    mediumx STK      L80              0107  /dev/sch0  /dev/sg2
[3:0:9:0]    tape    STK      T10000B          0107  /dev/st7   /dev/sg10
[3:0:10:0]   tape    STK      T10000B          0107  /dev/st5   /dev/sg8
[3:0:11:0]   tape    STK      T10000B          0107  /dev/st3   /dev/sg5
[3:0:12:0]   tape    STK      T10000B          0107  /dev/st6   /dev/sg9

Get a more detailed status of one of the two default virtual tape libraries:

[root@server02 ~]# mtx -f /dev/sg2 status
  Storage Changer /dev/sg11:4 Drives, 43 Slots ( 4 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
      Storage Element 1:Full :VolumeTag=E01001L8
      Storage Element 2:Full :VolumeTag=E01002L8
      Storage Element 3:Full :VolumeTag=E01003L8
      Storage Element 4:Full :VolumeTag=E01004L8
      Storage Element 5:Full :VolumeTag=E01005L8
      Storage Element 6:Full :VolumeTag=E01006L8
      Storage Element 7:Full :VolumeTag=E01007L8
      Storage Element 8:Full :VolumeTag=E01008L8
      Storage Element 9:Full :VolumeTag=E01009L8
      Storage Element 10:Full :VolumeTag=E01010L8
      Storage Element 11:Full :VolumeTag=E01011L8
      Storage Element 12:Full :VolumeTag=E01012L8
      Storage Element 13:Full :VolumeTag=E01013L8
      Storage Element 14:Full :VolumeTag=E01014L8
      Storage Element 15:Full :VolumeTag=E01015L8
      Storage Element 16:Full :VolumeTag=E01016L8
      Storage Element 17:Full :VolumeTag=E01017L8
      Storage Element 18:Full :VolumeTag=E01018L8
      Storage Element 19:Full :VolumeTag=E01019L8
      Storage Element 20:Full :VolumeTag=E01020L8
      Storage Element 21:Empty
      Storage Element 22:Full :VolumeTag=CLN101L8
      Storage Element 23:Full :VolumeTag=CLN102L6
      Storage Element 24:Empty
      Storage Element 25:Empty
      Storage Element 26:Empty
      Storage Element 27:Empty
      Storage Element 28:Empty
      Storage Element 29:Empty
      Storage Element 30:Full :VolumeTag=F01030L6
      Storage Element 31:Full :VolumeTag=F01031L6
      Storage Element 32:Full :VolumeTag=F01032L6
      Storage Element 33:Full :VolumeTag=F01033L6
      Storage Element 34:Full :VolumeTag=F01034L6
      Storage Element 35:Full :VolumeTag=F01035L6
      Storage Element 36:Full :VolumeTag=F01036L6
      Storage Element 37:Full :VolumeTag=F01037L6
      Storage Element 38:Full :VolumeTag=F01038L6
      Storage Element 39:Full :VolumeTag=F01039L6
      Storage Element 40 IMPORT/EXPORT:Empty
      Storage Element 41 IMPORT/EXPORT:Empty
      Storage Element 42 IMPORT/EXPORT:Empty
      Storage Element 43 IMPORT/EXPORT:Empty

For the web interface do the following:

cd /var/www/html
unzip /tmp/mhvtl-gui-master.zip
mv mhvtl-gui-master mhvtl

Edit /etc/httpd/conf/httpd.conf file and add the following:

Alias /mhvtl "/var/www/html/mhvtl"
< Directory "/var/www/html/mhvtl">
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
< /Directory>

Start the service and enable autostart:

systemctl enable httpd
systemctl start httpd

To be able to execute powerful command the web GUI will also ask for a /etc/sudoers configuration. Up to you to decide if it is secure or not:

apache ALL=(ALL) NOPASSWD: ALL

The default password is mhvtl:

mhvtl01
mhvtl01

Testing

Before going further it’s a good idea to perform a test. I have this iscsi configuration:

[root@server02 ~]# lsscsi --generic
[1:0:0:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr0   /dev/sg0
[2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda   /dev/sg1
[3:0:0:0]    mediumx STK      L700             0107  /dev/sch0  /dev/sg6
[3:0:1:0]    tape    IBM      ULT3580-TD8      0107  /dev/st2   /dev/sg5
[3:0:2:0]    tape    IBM      ULT3580-TD8      0107  /dev/st3   /dev/sg4
[3:0:3:0]    tape    IBM      ULT3580-TD6      0107  /dev/st1   /dev/sg3
[3:0:4:0]    tape    IBM      ULT3580-TD6      0107  /dev/st0   /dev/sg2

Get the status of your virtual tape library with mtx command:

[root@server02 ~]# mtx -f /dev/sg6 status
  Storage Changer /dev/sg6:4 Drives, 43 Slots ( 4 Import/Export )
Data Transfer Element 0:Empty
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
      Storage Element 1:Full :VolumeTag=E01001L8
      Storage Element 2:Full :VolumeTag=E01002L8
      Storage Element 3:Full :VolumeTag=E01003L8
      Storage Element 4:Full :VolumeTag=E01004L8
      Storage Element 5:Full :VolumeTag=E01005L8
      Storage Element 6:Full :VolumeTag=E01006L8
      Storage Element 7:Full :VolumeTag=E01007L8
      Storage Element 8:Full :VolumeTag=E01008L8
      Storage Element 9:Full :VolumeTag=E01009L8
      Storage Element 10:Full :VolumeTag=E01010L8
      Storage Element 11:Full :VolumeTag=E01011L8
      Storage Element 12:Full :VolumeTag=E01012L8
      Storage Element 13:Full :VolumeTag=E01013L8
      Storage Element 14:Full :VolumeTag=E01014L8
      Storage Element 15:Full :VolumeTag=E01015L8
      Storage Element 16:Full :VolumeTag=E01016L8
      Storage Element 17:Full :VolumeTag=E01017L8
      Storage Element 18:Full :VolumeTag=E01018L8
      Storage Element 19:Full :VolumeTag=E01019L8
      Storage Element 20:Full :VolumeTag=E01020L8
      Storage Element 21:Empty
      Storage Element 22:Full :VolumeTag=CLN101L8
      Storage Element 23:Full :VolumeTag=CLN102L6
      Storage Element 24:Empty
      Storage Element 25:Empty
      Storage Element 26:Empty
      Storage Element 27:Empty
      Storage Element 28:Empty
      Storage Element 29:Empty
      Storage Element 30:Full :VolumeTag=F01030L6
      Storage Element 31:Full :VolumeTag=F01031L6
      Storage Element 32:Full :VolumeTag=F01032L6
      Storage Element 33:Full :VolumeTag=F01033L6
      Storage Element 34:Full :VolumeTag=F01034L6
      Storage Element 35:Full :VolumeTag=F01035L6
      Storage Element 36:Full :VolumeTag=F01036L6
      Storage Element 37:Full :VolumeTag=F01037L6
      Storage Element 38:Full :VolumeTag=F01038L6
      Storage Element 39:Full :VolumeTag=F01039L6
      Storage Element 40 IMPORT/EXPORT:Empty
      Storage Element 41 IMPORT/EXPORT:Empty
      Storage Element 42 IMPORT/EXPORT:Empty
      Storage Element 43 IMPORT/EXPORT:Empty

Load storage element 1 in drive 0:

[root@server02 ~]# mtx -f /dev/sg6 load 1 0
Loading media from Storage Element 1 into drive 0...done
[root@server02 ~]# mtx -f /dev/sg6 status
  Storage Changer /dev/sg6:4 Drives, 43 Slots ( 4 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag = E01001L8
Data Transfer Element 1:Empty
Data Transfer Element 2:Empty
Data Transfer Element 3:Empty
      Storage Element 1:Empty
      Storage Element 2:Full :VolumeTag=E01002L8
      Storage Element 3:Full :VolumeTag=E01003L8
      Storage Element 4:Full :VolumeTag=E01004L8
      Storage Element 5:Full :VolumeTag=E01005L8
      Storage Element 6:Full :VolumeTag=E01006L8
      Storage Element 7:Full :VolumeTag=E01007L8
      Storage Element 8:Full :VolumeTag=E01008L8
      Storage Element 9:Full :VolumeTag=E01009L8
      Storage Element 10:Full :VolumeTag=E01010L8
      Storage Element 11:Full :VolumeTag=E01011L8
      Storage Element 12:Full :VolumeTag=E01012L8
      Storage Element 13:Full :VolumeTag=E01013L8
      Storage Element 14:Full :VolumeTag=E01014L8
      Storage Element 15:Full :VolumeTag=E01015L8
      Storage Element 16:Full :VolumeTag=E01016L8
      Storage Element 17:Full :VolumeTag=E01017L8
      Storage Element 18:Full :VolumeTag=E01018L8
      Storage Element 19:Full :VolumeTag=E01019L8
      Storage Element 20:Full :VolumeTag=E01020L8
      Storage Element 21:Empty
      Storage Element 22:Full :VolumeTag=CLN101L8
      Storage Element 23:Full :VolumeTag=CLN102L6
      Storage Element 24:Empty
      Storage Element 25:Empty
      Storage Element 26:Empty
      Storage Element 27:Empty
      Storage Element 28:Empty
      Storage Element 29:Empty
      Storage Element 30:Full :VolumeTag=F01030L6
      Storage Element 31:Full :VolumeTag=F01031L6
      Storage Element 32:Full :VolumeTag=F01032L6
      Storage Element 33:Full :VolumeTag=F01033L6
      Storage Element 34:Full :VolumeTag=F01034L6
      Storage Element 35:Full :VolumeTag=F01035L6
      Storage Element 36:Full :VolumeTag=F01036L6
      Storage Element 37:Full :VolumeTag=F01037L6
      Storage Element 38:Full :VolumeTag=F01038L6
      Storage Element 39:Full :VolumeTag=F01039L6
      Storage Element 40 IMPORT/EXPORT:Empty
      Storage Element 41 IMPORT/EXPORT:Empty
      Storage Element 42 IMPORT/EXPORT:Empty
      Storage Element 43 IMPORT/EXPORT:Empty

You can also use mt and work at drive level but it is a little bit less user friendly:

[root@server02 ~]# mt -f /dev/st7 load
[root@server02 ~]# mt -f /dev/st7 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x4a (SDLT600, T10000A).
Soft error count since last status=0
General status bits on (41010000):
 BOT ONLINE IM_REP_EN
[root@server02 ~]# mt -f /dev/st7 rewind

Now let’s create a big file and backup it:

[root@server02 ~]# dd if=/dev/urandom of=/tmp/bigfile bs=10M count=10
10+0 records in
10+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.297349 s, 353 MB/s
[root@server02 ~]# ll /tmp/bigfile
-rw-r--r-- 1 root root 104857600 Jul 30 10:14 /tmp/bigfile
[root@server02 ~]# tar cvf /dev/st7 /tmp/bigfile
tar: Removing leading `/' from member names
/tmp/bigfile
[root@server02 ~]# tar tvf /dev/st7
-rw-r--r-- root/root 104857600 2025-07-30 10:14 tmp/bigfile
[root@server02 ~]# mt -f /dev/st7 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x4a (SDLT600, T10000A).
Soft error count since last status=0
General status bits on (41010000):
 BOT ONLINE IM_REP_EN
[root@server02 ~]# mt -f /dev/st7 erase fast
[root@server02 ~]# tar tvf /dev/st7
tar: /dev/st7: Cannot read: Input/output error
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now

Manage disk space before / is full

By default all virtual tapes will be located in /opt/mhvtl and so under mount point / that is quite important for a Linux system:

[root@server02 ~]# cat /etc/mhvtl/mhvtl.conf
#
# mhvtl.conf
#

# Home directory for tape emulation files
MHVTL_HOME_PATH=/opt/mhvtl

# Default media capacity (500 M)
CAPACITY=500

# Set default verbosity [0|1|2|3]
VERBOSE=1

# Set kernel module debugging [0|1]
VTL_DEBUG=0

# vtltape and vtllibrary debugging [Blank or -d]
#DAEMON_DEBUG=-d

I have created a dedicated FS:

[root@server02 ~]# lvcreate -L 20g -n lvol02 vg00
[root@server02 ~]# mkfs -t xfs /dev/vg00/lvol02
[root@server02 ~]# mkdir /mhvtl

Change MHVTL_HOME_PATH in /etc/mhvtl/mhvtl.conf and /etc/mhvtl/device.conf and restart mhvtl with::

systemctl restart mhvtl.target

Remark:
I had a kernel panic and had to reboot, but not sure it would be only me…

I have also been obliged to move all tape dev files from /opt/mhvtl to /mhvtl with mv command…

You can also use mktape:

[root@server02 ~]# mktape -C /etc/mhvtl -H /mhvtl -l 10 -m E01021L8 -s 500 -t data -d AIT1

This is also an option to add a virtual tape to, for example, Storage Element 21 that is empty by default. Once the mktape command has been issued then modify (my library number is 10) /etc/mhvtl/library-contents.10 and add your new tape:

Slot 21: E01021L8

Then mtx -f /dev/sg6 inventory to update the library contents…

If you want to create a bunch of virtual tape you can also use a script like:

for i in $(seq 10 40); do mktape -C /etc/mhvtl -H /mhvtl -l 10 -m F010${i}L6 -s 1000 -t data -d LTO6; done
for i in $(seq 1 9); do mktape -C /etc/mhvtl -H /mhvtl -l 10 -m F0100${i}L6 -s 1000 -t data -d LTO6; done

My MHVTL final configuration

Finalize your MHVTL configuration before going to OSB because the iscsi device numbers will change and you will have to re-perform your OSB configuration.

My mhvtl.conf file:

#
# mhvtl.conf
#

# Home directory for tape emulation files
#MHVTL_HOME_PATH=/opt/mhvtl
MHVTL_HOME_PATH=/mhvtl

# Default media capacity (500 M)
#CAPACITY=500
CAPACITY=1000

# Set default verbosity [0|1|2|3]
VERBOSE=1

# Set kernel module debugging [0|1]
VTL_DEBUG=0

# vtltape and vtllibrary debugging [Blank or -d]
#DAEMON_DEBUG=-d

My device.conf configuration (by default I had a mix of different drives type) and a ULT3580-TD8 drive that is not available in graphical interface (?!):

VERSION: 5

Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00
 Vendor identification: STK
 Product identification: L700
 Unit serial number: XYZZY_A
 NAA: 10:22:33:44:ab:00:00:00
 Home directory: /mhvtl
 PERSIST: False
 Backoff: 400
# fifo: /var/tmp/mhvtl

Drive: 11 CHANNEL: 00 TARGET: 01 LUN: 00
 Library ID: 10 Slot: 01
 Vendor identification: IBM
 Product identification: ULT3580-TD6
#Product revision level: 2160
 Unit serial number: XYZZY_A1
 NAA: 10:22:33:44:ab:00:01:00
 Compression: factor 1 enabled 1
 Compression type: lzo
 Backoff: 400
# fifo: /var/tmp/mhvtl

Drive: 12 CHANNEL: 00 TARGET: 02 LUN: 00
 Library ID: 10 Slot: 02
 Vendor identification: IBM
 Product identification: ULT3580-TD6
#Product revision level: 2160
 Unit serial number: XYZZY_A2
 NAA: 10:22:33:44:ab:00:02:00
 Compression: factor 1 enabled 1
 Compression type: lzo
 Backoff: 400
# fifo: /var/tmp/mhvtl

Drive: 13 CHANNEL: 00 TARGET: 03 LUN: 00
 Library ID: 10 Slot: 03
 Vendor identification: IBM
 Product identification: ULT3580-TD6
#Product revision level: 2160
 Unit serial number: XYZZY_A3
 NAA: 10:22:33:44:ab:00:03:00
 Compression: factor 1 enabled 1
 Compression type: lzo
 Backoff: 400
# fifo: /var/tmp/mhvtl

Drive: 14 CHANNEL: 00 TARGET: 04 LUN: 00
 Library ID: 10 Slot: 04
 Vendor identification: IBM
 Product identification: ULT3580-TD6
#Product revision level: 2160
 Unit serial number: XYZZY_A4
 NAA: 10:22:33:44:ab:00:04:00
 Compression: factor 1 enabled 1
 Compression type: lzo
 Backoff: 400
# fifo: /var/tmp/mhvtl

My library_contents.10:

VERSION: 2

Drive 1:
Drive 2:
Drive 3:
Drive 4:

Picker 1:

MAP 1:
MAP 2:
MAP 3:
MAP 4:

# Slot 1 - ?, no gaps
# Slot N: [barcode]
# [barcode]
# a barcode is comprised of three fields: [Leading] [identifier] [Trailing]
# Leading "CLN" -- cleaning tape
# Leading "W" -- WORM tape
# Leading "NOBAR" -- will appear to have no barcode
# If the barcode is at least 8 character long, then the last two characters are Trailing
# Trailing "S3" - SDLT600
# Trailing "X4" - AIT-4
# Trailing "L1" - LTO 1, "L2" - LTO 2, "L3" - LTO 3, "L4" - LTO 4, "L5" - LTO 5
# Trailing "LT" - LTO 3 WORM, "LU" -  LTO 4 WORM, "LV" - LTO 5 WORM
# Trailing "L6" - LTO 6, "LW" - LTO 6 WORM
# Trailing "TA" - T10000+
# Trailing "TZ" - 9840A, "TY" - 9840B, "TX" - 9840C, "TW" - 9840D
# Trailing "TV" - 9940A, "TU" - 9940B
# Trailing "JA" - 3592+
# Trailing "JB" - 3592E05+
# Trailing "JC" - 3592E06+
# Trailing "JK" - 3592E07+
# Trailing "JW" - WORM 3592+
# Trailing "JX" - WORM 3592E05+ & 3592E06
# Trailing "JY" - WORM 3592E07+
# Trailing "D7" - DLT7000 media (DLT IV)
#
Slot 1: F01001L6
Slot 2: F01002L6
Slot 3: F01003L6
Slot 4: F01004L6
Slot 5: F01005L6
Slot 6: F01006L6
Slot 7: F01007L6
Slot 8: F01008L6
Slot 9: F01009L6
Slot 10: F01010L6
Slot 11: F01011L6
Slot 12: F01012L6
Slot 13: F01013L6
Slot 14: F01014L6
Slot 15: F01015L6
Slot 16: F01016L6
Slot 17: F01017L6
Slot 18: F01018L6
Slot 19: F01019L6
Slot 20: F01020L6
Slot 21: F01021L6
Slot 22: F01022L6
Slot 23: F01023L6
Slot 24: F01024L6
Slot 25: F01025L6
Slot 26: F01026L6
Slot 27: F01027L6
Slot 28: F01028L6
Slot 29: F01029L6
Slot 30: F01030L6
Slot 31: F01031L6
Slot 32: F01032L6
Slot 33: F01033L6
Slot 34: F01034L6
Slot 35: F01035L6
Slot 36: F01036L6
Slot 37: F01037L6
Slot 38: F01038L6
Slot 39: F01039L6
Slot 40: F01040L6

All the other files can be deleted from /etc/mhvtl directory…

Oracle Secure Backup (OSB)

Purge the pre-requisites with (the oracle-database-preinstall-19c package is because one requirement is inside and also because my server will also host my test 19c database):

dnf install sg3_utils sg3_utils-libs csh oracle-database-preinstall-19c

I have unzip OSB in /tmp and installed it with:

[root@server02 ~]# mkdir -p /usr/local/oracle/backup
[root@server02 ~]# cd /usr/local/oracle/backup
[root@server02 backup]# /tmp/osb_19.1.0.0.0_linux.x64_cdrom240520/setup --securepath

Welcome to Oracle's setup program for Oracle Secure Backup.  This
program loads Oracle Secure Backup software to a filesystem directory
of your choosing.

This installation contains Oracle Secure Backup version 19.1.0.0.0.

Please wait a moment while I learn about this host... done.
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

Choose from one of the following options. The option you choose defines
the software components to be installed.

Configuration of this host is required after installation is complete.
You can install the software on this host in one of the following ways:

    (a) administrative server and client
    (b) client

If you are not sure which option to choose, please refer to the Oracle
Secure Backup Installation Guide. (a or b) [a]?

-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
Loading Oracle Secure Backup installation tools... done.

-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
Loading Oracle Secure Backup software... done.

-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
Loading of Oracle Secure Backup software is complete.



You should now enter an email address for the Oracle Secure Backup 'admin'
user. Oracle Secure Backup uses this email address to send job summary
reports and to notify the user when a job requires input. If you leave this
blank, you can set it later using the obtool's 'chuser' command.

Please enter the admin email address:

Do you want to change any advanced settings? (y or n) [n]:

The keystore password must be known and safeguarded by
the Oracle Secure Backup Administrator.  In the event of
a disaster, the keystore password is required for
recovering your Oracle Secure Backup Administrative
Server.  Oracle Secure Backup cannot be prompted to
retrieve the password.

Please enter keystore password:
Re-type password for verification:
Please enter admin password:
Re-type password for verification:
Oracle Secure Backup was installed

You have, by default, a nice graphical interface at https://192.168.56.102 (self signed certificate so do the needful with your browser):

osb01
osb01

The graphical interface is a nice way to see what’s going on and what you would be able to do. But I have tried, as much as possible, to use obtool command. Add your server to mediaserver role and perform a discovery:

ob> lsh
server02         admin,client                      (via OB)   in service
ob> chhost --role admin,mediaserver,client server02
ob> lshost
server02         admin,mediaserver,client          (via OB)   in service
ob> discoverdev --configure --interactive --host server02
   Device-Type   Device-Model            Serial-Number                                     Attachpoint
   Library       STK     L700            XYZZY_A    server02:/dev/sg11
create device object server02_lib_1? (a, n, q, y, ?) [y]:
   Library       STK     L80             XYZZY_B    server02:/dev/sg6
create device object server02_tape_2? (a, n, q, y, ?) [y]:
   Tape          IBM     ULT3580-TD6     XYZZY_A3   server02:/dev/sg2
create device object server02_tape_3? (a, n, q, y, ?) [y]:
   Tape          STK     T10000B         XYZZY_B3   server02:/dev/sg5
create device object server02_tape_5? (a, n, q, y, ?) [y]:
   Tape          IBM     ULT3580-TD8     XYZZY_A2   server02:/dev/sg3
create device object server02_tape_6? (a, n, q, y, ?) [y]:
   Tape          STK     T10000B         XYZZY_B2   server02:/dev/sg4

Checking each library to associate discovered drive(s) with DTE...
    Assigning DTE 1 in library server02_lib_1 for drive server02_tape_2 with serial number: XYZZY_A1
    Assigning DTE 2 in library server02_lib_1 for drive server02_tape_6 with serial number: XYZZY_A2
    Assigning DTE 3 in library server02_lib_1 for drive server02_tape_3 with serial number: XYZZY_A3
    Assigning DTE 4 in library server02_lib_1 for drive server02_tape_5 with serial number: XYZZY_A4
ob> lsdev
library             server02_lib_1   not in service
  drive 1           server02_tape_2  not in service
  drive 2           server02_tape_6  not in service
  drive 3           server02_tape_3  not in service
  drive 4           server02_tape_5  not in service

For better display I have decided to rename the VTL and the tape drives names:

ob> rendev --nq server02_lib_1 mhvtl01
ob> rendev --nq server02_tape_2 tape01
ob> rendev --nq server02_tape_6 tape02
ob> rendev --nq server02_tape_3 tape03
ob> rendev --nq server02_tape_5 tape04
ob> lsdev
library             mhvtl01          not in service
  drive 1           tape01           not in service
  drive 2           tape02           not in service
  drive 3           tape03           not in service
  drive 4           tape04           not in service

Put them in inservice mode with:

ob> chdev --inservice mhvtl01
ob> chdev --inservice tape01
ob> chdev --inservice tape02
ob> chdev --inservice tape03
ob> chdev --inservice tape04
ob> lsdev
library             mhvtl01          in service
  drive 1           tape01           in service
  drive 2           tape02           in service
  drive 3           tape03           in service
  drive 4           tape04           in service
ob> lsdev --mount
library             mhvtl01          in service
  drive 1           tape01           in service           unmounted
  drive 2           tape02           in service           unmounted
  drive 3           tape03           in service           unmounted
  drive 4           tape04           in service           unmounted

I initially thought I would be obliged to mount the tapes in drives but at the end OSB is doing it automatically for me, so skip this step. But it is interesting to know how to do it when we have tested MHVTL with raw commands…

RMAN testing

First BACKUP DATABASE PLUS ARCHIVELOG command failed for:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 07/29/2025 16:29:37
ORA-19506: failed to create sequential file, name="013vprng_1_1_1", parms=""
ORA-27028: skgfqcre: sbtbackup returned error
ORA-19511: non RMAN, but media manager or vendor specific failure, error text:
   sbt__rpc_cat_query: Query for piece 013vprng_1_1_1 failed.
(Oracle Secure Backup error: 'no preauth config found for OS user (OB tools) oracle').
RMAN Client Diagnostic Trace file : /u01/app/oracle/diag/clients/user_oracle/RMAN_4072705642_110/trace/ora_rman_50692_0.trc
RMAN Server Diagnostic Trace file : /u01/app/oracle/diag/rdbms/orcl1/orcl1/trace/orcl1_ora_50704.trc
RMAN Server Diagnostic Trace file : /u01/app/oracle/diag/rdbms/orcl1/orcl1/trace/orcl1_ora_50698.trc

So I had to create a user matching my database Linux user in OSB:

ob> mkuser --class oracle --password "secure_password" --unixname oracle --unixgroup dba oracle

But was still not enough:

RMAN Command Id : 2025-07-29T16:29:17
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 07/29/2025 16:29:37
ORA-19506: failed to create sequential file, name="013vprng_1_1_1", parms=""
ORA-27028: skgfqcre: sbtbackup returned error
ORA-19511: non RMAN, but media manager or vendor specific failure, error text:
   sbt__rpc_cat_query: Query for piece 013vprng_1_1_1 failed.
(Oracle Secure Backup error: 'no preauth config found for OS user (OB tools) oracle').
RMAN Client Diagnostic Trace file : /u01/app/oracle/diag/clients/user_oracle/RMAN_4072705642_110/trace/ora_rman_50692_0.trc
RMAN Server Diagnostic Trace file : /u01/app/oracle/diag/rdbms/orcl1/orcl1/trace/orcl1_ora_50704.trc
RMAN Server Diagnostic Trace file : /u01/app/oracle/diag/rdbms/orcl1/orcl1/trace/orcl1_ora_50698.trc

So added the preauthorization for this oracle user to use RMAN on server02:

ob> chuser --preauth server02:oracle+rman oracle
ob> lsuser --long oracle
oracle:
    Password:                   (set)
    Password last changed:      2025/07/29.16:40
    Password change required:   no
    Password lifetime:          180 days (system default)
    Password grace time:        3 days (system default)
    Password reuse time:        1 year (system default)
    User class:                 oracle
    Given name:                 [none]
    UNIX name:                  oracle
    UNIX group:                 dba
    Windows domain/acct:        [none]
    NDMP server user:           no
    Email address:              [none]
    UUID:                       313e5ff2-4ea7-103e-9ef7-080027333ceb
    Preauthorized access:
        Hostname:               server02
        Username:               oracle
        Windows domain:         [all]
        RMAN enabled:           yes
        Cmdline enabled:        no

I have used this RMAN configuration, the most important piece is obviously the first line, pointing to the OSB library:

CONFIGURE CHANNEL DEVICE TYPE SBT_TAPE PARMS 'SBT_LIBRARY=/usr/local/oracle/backup/lib/libobk.so';
CONFIGURE DEFAULT DEVICE TYPE TO SBT_TAPE;
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 4;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 9 DAYS; CONFIGURE BACKUP OPTIMIZATION ON;

Then you can perform a database plus archivelog backup on MHVTL, through OSB, with:

RUN {
  ALLOCATE CHANNEL sbt1 DEVICE TYPE SBT_TAPE;
  BACKUP DATABASE PLUS ARCHIVELOG FORMAT 'db_%U.bkp';
  RELEASE CHANNEL sbt1;
}

Script to clean all tapes

While doing plenty of testing I had to clean manually all tapes to reclaim space so built this clean_all_tapes script to do it automatically (use it with caution):

#!/bin/bash

# lsscsi -g to fill two below lines
LIBRARY="/dev/sg6"
DRIVE="/dev/st2"
MHVTL_PATH="/mhvtl"
MIN_SIZE_KB=8   # Minimum size in KB to consider as "non-empty" (4K is usually empty)

# Get mtx status and process each full slot
mtx -f $LIBRARY status | grep "Storage Element" | grep "Full" | while read -r line
do
  # Extract slot number and VolumeTag
  SLOT=$(echo "$line" | awk -F'[: ]+' '{print $3}')
  TAPE=$(echo "$line" | awk -F'VolumeTag=' '{print $2}' | tr -d ' ')

  # Check if the corresponding file exists and is non-empty
  TAPE_DIRECTORY="$MHVTL_PATH/$TAPE"
  if [ -d "$TAPE_DIRECTORY" ]
  then
    SIZE_KB=$(du -k "$TAPE_DIRECTORY" | awk '{print $1}')
    if [ "$SIZE_KB" -ge "$MIN_SIZE_KB" ]
    then
      echo "Tape $TAPE is non-empty ($SIZE_KB KB). Erasing..."

      # Load tape to drive 0
      mtx -f $LIBRARY load $SLOT 0
      if [ $? -ne 0 ]
      then
        echo "Failed to load slot $SLOT ($TAPE) to drive 0. Skipping..."
        continue
      fi

      sleep 5

      # Erase tape
      mt -f $DRIVE erase
      if [ $? -ne 0 ]
      then
        echo "Failed to erase tape $TAPE"
      else
        echo "Erase command sent for $TAPE"
      fi

      sleep 5

      # Unload tape
      mtx -f $LIBRARY unload $SLOT 0
      if [ $? -ne 0 ]
      then
        echo "Failed to unload tape $TAPE (slot $SLOT) from drive 0"
      else
        echo "Unloaded tape $TAPE (slot $SLOT) from drive 0"
      fi

      sleep 5
    else
      echo "Slot $SLOT ($TAPE) is empty or too small ($SIZE_KB KB). Skipping..."
    fi
  else
    echo "File $TAPE_DIRECTORY does not exist. Skipping..."
  fi
done

echo "All non-empty tapes processed"

Issues encountered

Pending resource availability

All jobs in stuck state and MRAN command blocked:

ob> lsjob
Job ID           Sched time  Contents                       State
---------------- ----------- ------------------------------ ---------------------------------------
oracle/1         none        database orcl1 (dbid=1592202806) processed; Oracle job(s) scheduled
oracle/1.1       none        archivelog backup              pending resource availability
oracle/1.2       none        archivelog backup              pending resource availability
oracle/1.3       none        archivelog backup              pending resource availability
ob> rmjob --nq oracle/1
Info: removing job oracle/1.1.
Info: removing job oracle/1.2.
Error: can't remove job oracle/1.2 - job can't be deleted because it is running
Info: removing job oracle/1.3.
Info: removing job oracle/1.
Error: can't remove job oracle/1 - job can't be deleted because it has a child
ob> lsjob

Ensure the library and tape drives are in service (chdev –inservice mhvtl01 | tapexx):

ob> lsvol --library mhvtl01 --long
Warning: No valid inventory entries found.
ob> inventory --library mhvtl01
ob> lsvol --library mhvtl01 --long
Inventory of library mhvtl01:
    in    1:             barcode E01001L8, oid 154
    in    2:             barcode E01002L8, oid 155
    in    3:             barcode E01003L8, oid 156
    in    4:             barcode E01004L8, oid 157
    in    5:             barcode E01005L8, oid 158
    in    6:             barcode E01006L8, oid 159
    in    7:             barcode E01007L8, oid 160
    in    8:             barcode E01008L8, oid 161
    in    9:             barcode E01009L8, oid 162
    in    10:            barcode E01010L8, oid 163
    in    11:            barcode E01011L8, oid 164
    in    12:            barcode E01012L8, oid 165
    in    13:            barcode E01013L8, oid 166
    in    14:            barcode E01014L8, oid 167
    in    15:            barcode E01015L8, oid 168
    in    16:            barcode E01016L8, oid 169
    in    17:            barcode E01017L8, oid 170
    in    18:            barcode E01018L8, oid 171
    in    19:            barcode E01019L8, oid 172
    in    20:            barcode E01020L8, oid 173
    in    21:            barcode E01021L8, oid 174
    in    22:            barcode CLN101L8, oid 175
    in    23:            barcode CLN102L6, oid 176
    in    24:            vacant
    in    25:            vacant
    in    26:            vacant
    in    27:            vacant
    in    28:            vacant
    in    29:            vacant
    in    30:            barcode F01030L6, oid 177
    in    31:            barcode F01031L6, oid 178
    in    32:            barcode F01032L6, oid 179
    in    33:            barcode F01033L6, oid 180
    in    34:            barcode F01034L6, oid 181
    in    35:            barcode F01035L6, oid 182
    in    36:            barcode F01036L6, oid 183
    in    37:            barcode F01037L6, oid 184
    in    38:            barcode F01038L6, oid 185
    in    39:            barcode F01039L6, oid 186
    in    iee1:          vacant
    in    iee2:          vacant
    in    iee3:          vacant
    in    iee4:          vacant
    in    dte1:          vacant
    in    dte2:          vacant
    in    dte3:          vacant
    in    dte4:          vacant

Barcode is required on, but missing from, volume

All jobs failing for:

ob> lsjob -c
Job ID           Sched time  Contents                       State
---------------- ----------- ------------------------------ ---------------------------------------
oracle/1         none        database orcl1 (dbid=1592202806) failed at 2025/07/30.10:25 - barcode is required on, but missing from, volume
oracle/1.2       none        archivelog backup              failed at 2025/07/30.10:25 - barcode is required on, but missing from, volume
oracle/2         none        database orcl1 (dbid=1592202806) failed at 2025/07/30.10:28 - barcode is required on, but missing from, volume
oracle/2.1       none        archivelog backup              failed at 2025/07/30.10:28 - barcode is required on, but missing from, volume
oracle/3         none        database orcl1 (dbid=1592202806) failed at 2025/07/30.10:33 - barcode is required on, but missing from, volume
oracle/3.1       none        archivelog backup              failed at 2025/07/30.10:33 - barcode is required on, but missing from, volume

Fetch the new inventory with:

ob> lsvol --library mhvtl01 --long
Inventory of library mhvtl01:
    in    dte1:          vacant
    in    dte2:          vacant
    in    dte3:          vacant
    in    dte4:          vacant
ob> inventory --library mhvtl01
ob> lsvol --library mhvtl01 --long
Inventory of library mhvtl01:
    in    dte1:          barcode G03004TA, oid 140, readonly, lastse 1
    in    dte2:          barcode G03001TA, oid 137, lastse 2
    in    dte3:          barcode G03002TA, oid 138, lastse 3
    in    dte4:          barcode G03003TA, oid 139, lastse 4

Remove non existent device attached to volumes

When you delete backup at RMAN level they are not deleted from tape:

ob> rmdev --nq --deletecontents -f mhvtl01
Error: device mhvtl01 is referenced by active volume(s):
       RMAN-DEFAULT-000008, RMAN-DEFAULT-000009, RMAN-DEFAULT-000010, RMAN-DEFAULT-000011, RMAN-DEFAULT-000012
ob> rmvol --nq --force --vid RMAN-DEFAULT-000008
ob> rmvol --nq --force --vid RMAN-DEFAULT-000009
ob> rmvol --nq --force --vid RMAN-DEFAULT-000010
ob> rmvol --nq --force --vid RMAN-DEFAULT-000011,RMAN-DEFAULT-000012
ob> rmdev --nq --deletecontents -f mhvtl01
ob> lsdev
library             server02_lib_1   not in service
  drive 1           server02_tape_1  not in service
  drive 2           server02_tape_4  not in service
  drive 3           server02_tape_2  not in service
  drive 4           server02_tape_3  not in service
drive               tape01           in service
drive               tape02           in service
drive               tape03           in service
drive               tape04           in service
ob> rmdev --nq --deletecontents -f tape01
ob> rmdev --nq --deletecontents -f tape02
ob> rmdev --nq --deletecontents -f tape03
ob> rmdev --nq --deletecontents -f tape04

References

About Post Author

Share the knowledge!

Leave a Reply

Your email address will not be published. Required fields are marked *