Helpful TSM SQL Commands
Show all Client Nodes that are not in a Collocation Group
For TSM version 5
SELECT * FROM NODES WHERE NODE_NAME NOT IN ( SELECT NODE_NAME FROM COLLOCGROUP WHERE NODE_NAME IS NOT NULL )
For TSM version 6 and above
SELECT * FROM NODESVIEW WHERE NODE_NAME NOT IN ( SELECT NODE_NAME FROM COLLOCGROUP WHERE NODE_NAME IS NOT NULL )
Get the Number of Client Nodes on a TSM Server
For TSM v 5
SELECT COUNT(*) FROM NODES
For TSM v6 and above
SELECT COUNT(*) FROM NODESVIEW
Show all the Management Classes Used by Client
SELECT DISTINCT NODE_NAME, CLASS_NAME FROM BACKUPS WHERE NODE_NAME=’XXXXX’
Replace XXXXX with your node name
Show the number of Linux Client Nodes on a TSM Server
TSM v5
SELECT COUNT(*) FROM NODES WHERE PLATFORM_NAME LIKE ‘%LINUX%’
TSMv6 and above
SELECT COUNT(*) FROM NODESVIEW WHERE PLATFORM_NAME LIKE ‘%LINUX%’
Show the number of Windows Clients on a TSM Server
TSM v5
SELECT COUNT(*) FROM NODES WHERE PLATFORM_NAME LIKE ‘WIN%’
TSM v6 and above
SELECT COUNT(*) FROM NODESVIEW WHERE PLATFORM_NAME LIKE ‘WIN%’
Show All Filespaces that have not backed up or did not backup successfully
TSM v5
SELECT NODE_NAME, FILESPACE_NAME from FILESPACE WHERE BACKUP_END IS NULL OR BACKUP_END < BACKUP_START
TSMv6
SELECT NODE_NAME, FILESPACE_NAME from FILESPACEVIEW WHERE BACKUP_END IS NULL OR BACKUP_END < BACKUP_START
Show the number of TDP Agents on a TSM Server
TSM v5
SELECT COUNT(*) FROM NODES WHERE PLATFORM_NAME LIKE ‘%DP%’
TSMv6 and above
SELECT COUNT(*) FROM NODESVIEW WHERE PLATFORM_NAME LIKE ‘%DP%’
Show the number of AIX Client Nodes on a TSM Server
TSM v5
SELECT COUNT(*) FROM NODES WHERE PLATFORM_NAME LIKE ‘%AIX%’
TSMv6 and above
SELECT COUNT(*) FROM NODESVIEW WHERE PLATFORM_NAME LIKE ‘%AIX%’
Show the number of Solaris Client Nodes on a TSM Server
TSM v5
SELECT COUNT(*) FROM NODES WHERE PLATFORM_NAME LIKE ‘%SOLARIS%’
TSMv6 and above
SELECT COUNT(*) FROM NODESVIEW WHERE PLATFORM_NAME LIKE ‘%SOLARIS%’
Show a list of unavailable volumes
SELECT * FROM VOLUMES WHERE ACCESS=’UNAVAILABLE’
Show a list of read only volumes
SELECT * FROM VOLUMES WHERE ACCESS=’READONLY’
Show the Number of Readonly Volumes
SELECT COUNT(*) FROM VOLUMES WHERE ACCESS=’READONLY’
Show the number of Offsite Volumes
SELECT COUNT(*) FROM VOLUMES WHERE ACCESS=’OFFSITE’
Show all Offsite Volumes
SELECT * FROM VOLUMES WHERE ACCESS=’OFFSITE’
Show the number of volumes used by each node sorted by node name
SELECT NODE_NAME, COUNT(DISTINCT VOLUME_NAME) AS VOLUME_COUNT FROM VOLUMEUSAGE GROUP BY NODE_NAME ORDER BY NODE_NAME
or in reverse order
SELECT NODE_NAME, COUNT(DISTINCT VOLUME_NAME) AS VOLUME_COUNT FROM VOLUMEUSAGE GROUP BY NODE_NAME ORDER BY NODE_NAME DESC
Show the number of volumes used by each node sorted by number of volumes used
SELECT NODE_NAME, COUNT(DISTINCT VOLUME_NAME) AS VOLUME_COUNT FROM VOLUMEUSAGE GROUP BY NODE_NAME ORDER BY VOLUME_COUNT
or in reverse order
SELECT NODE_NAME, COUNT(DISTINCT VOLUME_NAME) AS VOLUME_COUNT FROM VOLUMEUSAGE GROUP BY NODE_NAME ORDER BY VOLUME_COUNT DESC
Show all Client Nodes with no data
TSM v6 and Above
SELECT NODE_NAME FROM NODESVIEW WHERE NODE_NAME NOT IN (SELECT NODE_NAME FROM OCCUPANCY)
Show the Number of Nodes per Schedule
SELECT DOMAIN_NAME,SCHEDULE_NAME,COUNT(NODE_NAME) AS NUMBER_OF_NODES FROM ASSOCIATIONS GROUP BY DOMAIN_NAME,SCHEDULE_NAME
Show the number of scratch tapes per library
NOTE: Wont show anything for a library that has no scratch tapes available, for that use TSM Studio
SELECT LIBRARY_NAME,COUNT(*) AS NUM_SCRATCH FROM LIBVOLUMES WHERE UPPER(STATUS)=’SCRATCH’ GROUP BY LIBRARY_NAME
Show all volumes in an error state
SELECT * FROM VOLUME WHERE UPPER(ERROR_STATE) = ‘YES’
Show volumes with write errors
SELECT * FROM VOLUMES WHERE WRITE_ERRORS>5 (Use a number relevant for your environment, this should be 0 if using a VTL)
NOTE: The > symbol when using the TSM Admin CLI is also used for redirection. To ensure it is used for correct intention here as a GREATER THAN sign remove the spaces on either side of the > symbol
Show volumes with read errors
SELECT * FROM VOLUMES WHERE READ_ERRORS>5 (Use a number relevant for your environment, this should be 0 if using a VTL)
NOTE: The > symbol when using the TSM Admin CLI is also used for redirection. To ensure it is used for correct intention here as a GREATER THAN sign remove the spaces on either side of the > symbol
Show the number of volumes with more than 50% reclaimable space
SELECT COUNT(*) AS NUM_RECLAIMABLE_TAPES FROM VOLUMES WHERE PCT_RECLAIM>50
Show the number of volumes used grouped by Storage Pool
SELECT STGPOOL_NAME, COUNT(VOLUME_NAME) AS VOLUME_COUNT FROM VOLUMES GROUP BY STGPOOL_NAME
Show how many error messages have happened in the last 24 hours
SELECT COUNT(*) AS ERROR_MESSAGE_COUINT FROM ACTLOG WHERE SEVERITY = ‘E’ AND DATE_TIME> ‘YYYY-MM-DD HH:MM‘
WHERE
YYYY = Year
MM = Month
DD = Day
HH = Hour
MM = Month
Show how many debug messages have happened in the last 24 hours
SELECT COUNT(*) AS DEBUG_MESSAGE_COUINT FROM ACTLOG WHERE SEVERITY = ‘D’ AND DATE_TIME> ‘YYYY-MM-DD HH:MM‘
WHERE
YYYY = Year
MM = Month
DD = Day
HH = Hour
MM = Month
Show how many warning messages have happened in the last 24 hours
SELECT COUNT(*) AS WARNING_MESSAGE_COUINT FROM ACTLOG WHERE SEVERITY = ‘W’ AND DATE_TIME> ‘YYYY-MM-DD HH:MM‘
WHERE
YYYY = Year
MM = Month
DD = Day
HH = Hour
MM = Month
Show all drives that are offline
SELECT * FROM DRIVES WHERE UPPER(ONLINE)<>’YES’
Show all paths that are offline
SELECT * FROM PATHS WHERE UPPER(ONLINE)<>’YES’