Monday, August 12, 2013

TSM Command Processing Tip

I am constantly having to run a large list of commands and sometimes just don't want to deal with running them through a shell script. So whats the best way to run a list of commands without having to deal with TSM prompting for a YES/NO. I can using a batch command with the -NOPROMPT option from a admin command-line, but sometimes thats more work than I want to deal with. There's got to be a better way. Well the simple answer is to define the TSM server to itself and use it in the command when you run it.  Here's an example....I have to delete empty volumes from storage pools rather than wait for the 1 day delay.

select  'ustsm07:del vol', cast((volume_name)as char(8)) as VOLNAME, from volumes where pct_utilized=0 and devclass_name <> 'DISK' 

RESULTS:

Unnamed[1]           VOLNAME   
----------------     --------- 
ustsm07:del vol      K00525    
ustsm07:del vol      K00526    
ustsm07:del vol      J00789    
ustsm07:del vol      J00197    
ustsm07:del vol      J00303    
ustsm07:del vol      J01172    
ustsm07:del vol      J01233    
ustsm07:del vol      J00850    
ustsm07:del vol      J00861    
ustsm07:del vol      K00018    
ustsm07:del vol      J01613    
ustsm07:del vol      J01624    
ustsm07:del vol      J01671    
ustsm07:del vol      J01687    
ustsm07:del vol      K00116    
ustsm07:del vol      K00130    
ustsm07:del vol      K00340    
ustsm07:del vol      K00348 

tsm: USTSM07>USTSM07:del vol       K00525
ANR1699I Resolved USTSM07 to 1 server(s) - issuing command DEL VOL K00525 against server(s).
ANR1687I Output for command 'DEL VOL K00525' issued against server USTSM07 follows:
ANR2208I Volume K00525 deleted from storage pool TAPE_A.
ANR1688I Output for command 'DEL VOL K00525' issued against server USTSM07 completed.
ANR1694I Server USTSM07 processed command 'DEL VOL K00525' and completed successfully.
ANR1697I Command 'DEL VOL K00525  processed by 1 server(s):  1 successful, 0 with warnings, and 0 with errors.
   

So I copy the data and paste it into my command line and because I am using server routing (even to the same server I am on) TSM does not prompt for confirmation. So make sure you have defined your TSM servers to themselves so you can take advantage of this simple feature.  Also note that TSM wont delete a tape with data, so I leave the "DISCARD=YES" option off so only EMPTY tapes are deleted.