So you want to query a script and see what it executes but don't like the standard Q SCRIPT results? Don't forget about the FORMAT= options available. Most people know FORMAT=DETAIL but with the Q SCRIPT command there are two additional formats. FORMAT=LINE and FORMAT=RAW. I like RAW but LINE is decent if you want to see the script by sequence.
UPDATE: As reader Erwann reminded me (I had long forgotten), there is also a F=MACRO option which will display the script in a form that can be run as a macro to define the script to another TSM server. If you issue Help Q SCRIPT it does not list the MACRO option, but it is valid and does work. So you could dump all your scripts to macro format and send it to an outfile. Then you could define them to an alternate TSM server (Q SCRIPT * OUTFILE=SCRIPTS.MAC F=Macro).
tsm: TSMLIBM>q script LIBR_INFO f=macro
DEFINE SCRIPT LIBR_INFO DESC="Library path information"
UPDATE SCRIPT LIBR_INFO "q libr $1"
UPDATE SCRIPT LIBR_INFO "q libr $1 f=d"
UPDATE SCRIPT LIBR_INFO "q path $1 srct=serv destt=libr f=d"
UPDATE SCRIPT LIBR_INFO "q path * srct=serv destt=dr libr=$1 f=d"
UPDATE SCRIPT LIBR_INFO "select library_name,library_type,library_serial from libraries where library_name ='$1'"
UPDATE SCRIPT LIBR_INFO "select source_name,destination_name,library_name,device serial from paths where library_name='$1'"
UPDATE SCRIPT LIBR_INFO "select drive_name,drive_serial,element,library_name from drives where library_name='$1'"
Here are the examples:
tsm: TSMLIBM>q script LIBR_INFO f=line
Name Line Command
Number
---------- ------ ------------------------------------------------------------
LIBR_INFO 5 q libr $1
10 q libr $1 f=d
15 q path $1 srct=serv destt=libr f=d
20 q path * srct=serv destt=dr libr=$1 f=d
25 select library_name,library_type,library_serial from
libraries where library_name ='$1'
30 select source_name,destination_name,library_name,device
serial from paths where library_name='$1'
35 select drive_name,drive_serial,element,library_name from
drives where library_name='$1'
tsm: TSMLIBM>q script LIBR_INFO f=raw
q libr $1
q libr $1 f=d
q path $1 srct=serv destt=libr f=d
q path * srct=serv destt=dr libr=$1 f=d
select library_name,library_type,library_serial from libraries where library_name ='$1'
select source_name,destination_name,library_name,device serial from paths where library_name='$1'
select drive_name,drive_serial,element,library_name from drives where library_name='$1'
Showing posts with label macros. Show all posts
Showing posts with label macros. Show all posts
Wednesday, May 18, 2011
Getting TSM Script Info
So you want to query a script and see what it executes but don't like the standard Q SCRIPT results? Don't forget about the FORMAT= options available. Most people know FORMAT=DETAIL but with the Q SCRIPT command there are two additional formats. FORMAT=LINE and FORMAT=RAW. I like RAW but LINE is decent if you want to see the script by sequence.
UPDATE: As reader Erwann reminded me (I had long forgotten), there is also a F=MACRO option which will display the script in a form that can be run as a macro to define the script to another TSM server. If you issue Help Q SCRIPT it does not list the MACRO option, but it is valid and does work. So you could dump all your scripts to macro format and send it to an outfile. Then you could define them to an alternate TSM server (Q SCRIPT * OUTFILE=SCRIPTS.MAC F=Macro).
tsm: TSMLIBM>q script LIBR_INFO f=macro
DEFINE SCRIPT LIBR_INFO DESC="Library path information"
UPDATE SCRIPT LIBR_INFO "q libr $1"
UPDATE SCRIPT LIBR_INFO "q libr $1 f=d"
UPDATE SCRIPT LIBR_INFO "q path $1 srct=serv destt=libr f=d"
UPDATE SCRIPT LIBR_INFO "q path * srct=serv destt=dr libr=$1 f=d"
UPDATE SCRIPT LIBR_INFO "select library_name,library_type,library_serial from libraries where library_name ='$1'"
UPDATE SCRIPT LIBR_INFO "select source_name,destination_name,library_name,device serial from paths where library_name='$1'"
UPDATE SCRIPT LIBR_INFO "select drive_name,drive_serial,element,library_name from drives where library_name='$1'"
Here are the examples:
tsm: TSMLIBM>q script LIBR_INFO f=line
Name Line Command
Number
---------- ------ ------------------------------------------------------------
LIBR_INFO 5 q libr $1
10 q libr $1 f=d
15 q path $1 srct=serv destt=libr f=d
20 q path * srct=serv destt=dr libr=$1 f=d
25 select library_name,library_type,library_serial from
libraries where library_name ='$1'
30 select source_name,destination_name,library_name,device
serial from paths where library_name='$1'
35 select drive_name,drive_serial,element,library_name from
drives where library_name='$1'
tsm: TSMLIBM>q script LIBR_INFO f=raw
q libr $1
q libr $1 f=d
q path $1 srct=serv destt=libr f=d
q path * srct=serv destt=dr libr=$1 f=d
select library_name,library_type,library_serial from libraries where library_name ='$1'
select source_name,destination_name,library_name,device serial from paths where library_name='$1'
select drive_name,drive_serial,element,library_name from drives where library_name='$1'
UPDATE: As reader Erwann reminded me (I had long forgotten), there is also a F=MACRO option which will display the script in a form that can be run as a macro to define the script to another TSM server. If you issue Help Q SCRIPT it does not list the MACRO option, but it is valid and does work. So you could dump all your scripts to macro format and send it to an outfile. Then you could define them to an alternate TSM server (Q SCRIPT * OUTFILE=SCRIPTS.MAC F=Macro).
tsm: TSMLIBM>q script LIBR_INFO f=macro
DEFINE SCRIPT LIBR_INFO DESC="Library path information"
UPDATE SCRIPT LIBR_INFO "q libr $1"
UPDATE SCRIPT LIBR_INFO "q libr $1 f=d"
UPDATE SCRIPT LIBR_INFO "q path $1 srct=serv destt=libr f=d"
UPDATE SCRIPT LIBR_INFO "q path * srct=serv destt=dr libr=$1 f=d"
UPDATE SCRIPT LIBR_INFO "select library_name,library_type,library_serial from libraries where library_name ='$1'"
UPDATE SCRIPT LIBR_INFO "select source_name,destination_name,library_name,device serial from paths where library_name='$1'"
UPDATE SCRIPT LIBR_INFO "select drive_name,drive_serial,element,library_name from drives where library_name='$1'"
Here are the examples:
tsm: TSMLIBM>q script LIBR_INFO f=line
Name Line Command
Number
---------- ------ ------------------------------------------------------------
LIBR_INFO 5 q libr $1
10 q libr $1 f=d
15 q path $1 srct=serv destt=libr f=d
20 q path * srct=serv destt=dr libr=$1 f=d
25 select library_name,library_type,library_serial from
libraries where library_name ='$1'
30 select source_name,destination_name,library_name,device
serial from paths where library_name='$1'
35 select drive_name,drive_serial,element,library_name from
drives where library_name='$1'
tsm: TSMLIBM>q script LIBR_INFO f=raw
q libr $1
q libr $1 f=d
q path $1 srct=serv destt=libr f=d
q path * srct=serv destt=dr libr=$1 f=d
select library_name,library_type,library_serial from libraries where library_name ='$1'
select source_name,destination_name,library_name,device serial from paths where library_name='$1'
select drive_name,drive_serial,element,library_name from drives where library_name='$1'
Friday, April 29, 2011
Delete Old Filespaces
Been looking to do some cleanup and I wanted an easy way to do it. So...I wrote this script. I can take the list returned and either make it a macro or an internal TSM script. Sure I could build a shell script that processed a list with the TSM server_name, the node_name, and FSID but I thought I'd show how you can create a command out of SQL returned data.
select 'del filespace ' || node_name || ' ' || cast(FILESPACE_ID as char(3)) || ' type=backup nametype=fsid wait=yes' AS COMMAND from filespaces where cast((current_timestamp-backup_end)days as decimal)>90
Here is an example of the results from the script:
COMMAND
------------------------------------------------------------
del filespace NODE1 37 type=backup nametype=fsid wait=yes
del filespace NODE1 9 type=backup nametype=fsid wait=yes
del filespace NODE1 36 type=backup nametype=fsid wait=yes
del filespace NEO_1 32 type=backup nametype=fsid wait=yes
del filespace NEO_1 31 type=backup nametype=fsid wait=yes
del filespace NEO_1 23 type=backup nametype=fsid wait=yes
del filespace NEO_1 29 type=backup nametype=fsid wait=yes
select 'del filespace ' || node_name || ' ' || cast(FILESPACE_ID as char(3)) || ' type=backup nametype=fsid wait=yes' AS COMMAND from filespaces where cast((current_timestamp-backup_end)days as decimal)>90
Here is an example of the results from the script:
COMMAND
------------------------------------------------------------
del filespace NODE1 37 type=backup nametype=fsid wait=yes
del filespace NODE1 9 type=backup nametype=fsid wait=yes
del filespace NODE1 36 type=backup nametype=fsid wait=yes
del filespace NEO_1 32 type=backup nametype=fsid wait=yes
del filespace NEO_1 31 type=backup nametype=fsid wait=yes
del filespace NEO_1 23 type=backup nametype=fsid wait=yes
del filespace NEO_1 29 type=backup nametype=fsid wait=yes
Labels:
cleanup,
filespaces,
macros,
Scripts,
tsm script
Delete Old Filespaces
Been looking to do some cleanup and I wanted an easy way to do it. So...I wrote this script. I can take the list returned and either make it a macro or an internal TSM script. Sure I could build a shell script that processed a list with the TSM server_name, the node_name, and FSID but I thought I'd show how you can create a command out of SQL returned data.
select 'del filespace ' || node_name || ' ' || cast(FILESPACE_ID as char(3)) || ' type=backup nametype=fsid wait=yes' AS COMMAND from filespaces where cast((current_timestamp-backup_end)days as decimal)>90
Here is an example of the results from the script:
COMMAND
------------------------------------------------------------
del filespace NODE1 37 type=backup nametype=fsid wait=yes
del filespace NODE1 9 type=backup nametype=fsid wait=yes
del filespace NODE1 36 type=backup nametype=fsid wait=yes
del filespace NEO_1 32 type=backup nametype=fsid wait=yes
del filespace NEO_1 31 type=backup nametype=fsid wait=yes
del filespace NEO_1 23 type=backup nametype=fsid wait=yes
del filespace NEO_1 29 type=backup nametype=fsid wait=yes
select 'del filespace ' || node_name || ' ' || cast(FILESPACE_ID as char(3)) || ' type=backup nametype=fsid wait=yes' AS COMMAND from filespaces where cast((current_timestamp-backup_end)days as decimal)>90
Here is an example of the results from the script:
COMMAND
------------------------------------------------------------
del filespace NODE1 37 type=backup nametype=fsid wait=yes
del filespace NODE1 9 type=backup nametype=fsid wait=yes
del filespace NODE1 36 type=backup nametype=fsid wait=yes
del filespace NEO_1 32 type=backup nametype=fsid wait=yes
del filespace NEO_1 31 type=backup nametype=fsid wait=yes
del filespace NEO_1 23 type=backup nametype=fsid wait=yes
del filespace NEO_1 29 type=backup nametype=fsid wait=yes
Subscribe to:
Posts (Atom)