TSM Scripting Hints


Send offsite and recall Copy tapes

To move tapes offsite schedule this command daily

Command: update vol * access=offsite
where access=readwrite
where stg=copy_pool location='offsite_location'
where status=full
{just send out full tapes}

To recall back onsite schedule this command weekly

Command: update vol * access=readwrite
where access=offsite
where stg='offsite_location='
where status=empty
{recall empty tapes}

back to top


Free up tapes which are almost empty

This script is a combination of TSM queries and unix scripting

for volume in
$(dsmadmc -id=adminname -pass=adminpass -outfile
"select 'MARKER', volume_name from volumes
where pct_utilized >20 " | grep '^MARKER' | cut -b 12-) ;
do dsmadmc -id=adminname -pass=adminpass -outfile
'move data ${volume} options..' ; done

Explanation : Use an SQL query to generate a list of almost empty tapes

SELECT 'MARKER', volume_name stgpool_name,pct_utilized from volumes WHERE PCT_UTILIZED < 10

will output something like :

Use the grep command to extract lines we want

grep 'MARKER'

gives

MARKER A40012
MARKER A40015

use cut to extract the tape volsers

cut -b 12-

gives

A40012
A40015

back to top


Multiple macro commands

If you specify several commands in a macro, sometimes the macro does not seem to get past the first command. Try using 'commit' after each statement:

q vol access=destroyed
commit
q vol access=unavail
commit

back to top


Exporting scripts

The query script command will list out the names of all your scripts and their descriptions like this

If you want to export your scripts, say to build another server, then you need to know the details. The command to use is

Q script f=macro

which will produce output in a format that can be executed as a macro. If you pipe that command to a file, the file can be copied to another server for execution.

back to top