TSM Topics Feed

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.


4 comments:

  1. On unix, anyway, if you pipe dsmadmc into another command, it won't prompt for anything at all (always seems to imply YES answers to the questions it would have asked, and disables the pager):

    dsmadmc -id=whatever -pass=whatever "audit volume whatever" |cat

    for instance. We have a standard shell script we use to strip out all the header/login cruft, and dsmadmc *always* gets piped into that to clean up the output, so we never get prompted :)

    ReplyDelete
  2. hi,
    macro command does not need confirmation as well. and you can run this from tsm cmd line.

    filip

    ReplyDelete
  3. hi,

    good command for generation tsm command to macro file is "set sqldisplaymode w" before you use select to redirect output to file. Than you can use macro cmd.

    ReplyDelete
  4. Yeah those work but I save my command as a TSM admin script and then just cut and paste it into the command in a batch and it runs. I can be lazy at times so this way is quick and easy. I like those other options and will remember to use them when needing to do similar items through a shell script.

    ReplyDelete