Tuesday 12 November 2013

Handy TSM queries

#query act log for media errors
q act begind=-1 search="media error"

#note the vol with error and query it to get its status
q libv cir-g-lib f=d

#check the volume out
checkout libv checkl=no rem=bulk

#query configured schedules
query sched f=d

#Removing a node from backup
q node f=d
q filespace
del filespace  *           (this removes all backup data for node1)
del filespace   nametype=fsid            (fsid is an integer for filesystem id)
remove node

#Renaming a node
rename node node2 node3 (this renames the node, but it keeps all the data)
(you'll need to logon to node2/3 and edit the dsm.opt/dsm.sys file etc and restart the scheduler to rename it on that side too).

#List filespaces that have not been backed up in the last 10 days for node
SELECT node_name,filespace_name, filespace_type,DATE(backup_end) as DATE FROM filespaces WHERE -node_name='' and DAYS(current_date)-DAYS(backup_end)>10

#show backups for the last 7 days
q event * * begind=-7 begint=12:00 endd=today node=

#show last backup completion date/time
q file  f=d

#show last successful backup end times for node
select END_TIME from summary where activity='BACKUP' and SUCCESSFUL='YES' and ENTITY=''