Here is a script I use to keep track of tapes in my library. You should be
able to get some ideas from this:
Name Line Command
Number
---------- ------
------------------------------------------------------------
COUNT_TAP- 1 /* line removed */
ES
5 issue message i 'Counts tapes in library in
Mountable
status.'
10 select count(*) as Mountable from drmedia where
state='MOUNTABLE'
15 issue message i 'Count tapes in Vault Status'
20 select count(*) as Vault_tapes from drmedia where
state='VAULT'
25 issue message i 'Count tapes in Vault Retrieve
Status'
30 select count(*) as Vault_Return from drmedia where
state='VAULTRETRIEVE'
35 issue message i 'Total number of tapes with backup
data on
them.'
40 select count(volume_name) as TOTAL_TAPES from
volumes where
status in('FULL','FILLING')
45 issue message i 'Total scratch tapes in the
library at this
time.'
50 select count(*) as Num_scratches from libvolumes
where
status='Scratch'
55 issue message i 'Number of TSM Database Backup
tapes.'
60 select count(distinct(volume_name)) as
DB_BACKUP_TAPES from
volhistory where type='BACKUPFULL'
Take care,
Al
Alan Davenport
Senior Storage Administrator
Selective Insurance Co. of America
alan.davenport AT selective DOT com
(973) 948-1306
-----Original Message-----
From: Prather, Wanda [mailto:Wanda.Prather AT JHUAPL DOT EDU]
Sent: Friday, December 19, 2003 2:18 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: Need script for counting all cartridges used by tsm
Tsm server v5.1.6.2 on solaris 2.8. Have a magstar 3494 with approximately
1500 slots.
I would like to be able to count how many tapes we are using in onsite
pools, offsite pools, db backups, and scratches.
Got the on and offsite count easily enough. I also have a script for
counting scratches.
Is there a way in SQL to save the output of selects, then some them to reach
a final value?
>> Only via arithmetic in the SQL, if you are running a straight TSM script
and not a host script.
This works for me; you will have to doctor it a little to match your own
class names:
select -
count(distinct a.volume_name) + count(distinct b.volume_name) +
count(distinct c.volume_name) -
as "Tapes in Use " -
from volumes a, libvolumes b , volhistory c -
where a.devclass_name <> 'DISK' and -
b.status='Scratch' and -
c.type in ('BACKUPFULL','DBSNAPSHOT','BACKUPINCR','EXPORT') and -
c.devclass = 'LTOTAPE'
Wanda Prather
Johns Hopkins University Applied Physics Laboratory
443-778-8769
"Intelligence has much less practical application than you'd think" -
Dilbert/Scott Adams
|