Saturday, August 23, 2008

Mislabeled Tapes Headache

I am periodically running into a situation where TSM will check in our tapes as private or relabel them to private, causing me headaches until I get the tapes status updated. So how do you identify the tapes that are mislabeled? Well if you have setup a library controller instance (which I recommend even if you will only have one instance for clients) then this script should work for you. What you will find when tapes are mislabeled is that they will show the library controller as their owner, will have a NULL value for LAST USE, and will of course be in private status. So a simple select statement can identify them for use.

select VOLUME_NAME from LIBVOLUMES where volume_name not in (select volume_name from volumes) and status='Private' and last_use is NULL and owner=''

If your library uses different types of media (LTO-2 and LTO-3) and you have different volume label series for them you can add another filter to further refine the results. For example my LTO-3 tape labels all start with L3 so I use:

select VOLUME_NAME from LIBVOLUMES where volume_name not in (select volume_name from volumes) and status='Private' and last_use is NULL and owner='' and volume_name like 'L3'

Once TSM has generated a list you can then run it through a while loop to reset their status or do further refining of the list if you like. If you are proficient with scripts you can automate the whole process and make life a lot easier.