Use the SELECT command to create and format a customized query of the IBM® Tivoli® Storage Manager database.
Tivoli Storage Manager provides an SQL interface to a DB2® program. Restrictions and guidelines for handling SQL queries are handled directly by DB2.
You cannot issue the SELECT command from a server console.
Because the select command does not lock and unlock records, contention for a record can cause the server to erroneously issue message ANR2034E: SELECT: No match found using this criteria. Check your selection criteria, and if you believe that it is correct, try the command again.
To stop the processing of a SELECT command after it starts, cancel the administrative session from which the command was issued. Cancel the session from either the server console or another administrative session.
Temporary table spaces are used to process SQL queries within DB2. Inadequate temporary space can cause SQL queries to fail.
To export output to a comma-separated file for import into a spreadsheet, use -comma and > command-line options on the dsmadmc command.
Any administrator can issue this command.
For SELECT statement syntax and guidelines, see the DB2 Information Center: http://pic.dhe.ibm.com/infocenter/db2luw/v10r5. Search on Select-statement for usage guidelines.
SELECT * FROM SUMMARY WHERE ACTIVTY='EXPIRATION' AND START_TIME >'2009-05-10 00:00:00' AND START_TIME <'2009-05-11 23:23:23'
The SELECT command is used to customize a wide variety of queries. To give you an idea of what you can do with the command, this section includes many examples. There are, however, many more possibilities. Query output is shown only for the more complex commands to illustrate formatting.
The following list summarizes the example SELECT commands:select admin_name from admins where
authentication=local
select * from syscat.tables
ABSCHEMA: SERVER1
TABNAME: ACTLOG
CREATE_TIME: 1999-05-01 07:39:06
COLCOUNT: 10
INDEX_COLCOUNT: 1
UNIQUE_INDEX: FALSE
REMARKS: Server activity log
TABSCHEMA: SERVER1
TABNAME: ADMIN_SCHEDULES
CREATE_TIME: 1995-05-01 07:39:06
COLCOUNT: 14
INDEX_COLCOUNT: 1
UNIQUE_INDEX: TRUE
REMARKS: Administrative command schedules
TABSCHEMA: SERVER1
TABNAME: ADMINS
CREATE_TIME: 1995-05-01 07:39:06
COLCOUNT: 15
INDEX_COLCOUNT: 1
UNIQUE_INDEX: TRUE
REMARKS: Server administrators
TABSCHEMA: SERVER1
TABNAME: ARCHIVES
CREATE_TIME: 1995-05-01 07:39:06
COLCOUNT: 10
INDEX_COLCOUNT: 5
UNIQUE_INDEX: FALSE
REMARKS: Client archive files
select node_name from nodes where locked='YES'
select admin_name from admins where locked='YES'
select node_name from nodes where invalid_pw_count <>0
select admin_name from admins where invalid_pw_count <>0
select node_name from nodes where domain_name='STANDARD' and
node_name not in (select node_name from associations
where domain_name='STANDARD' and
schedule_name='DAILYBACKUP')
select admin_name from admins where
upper(system_priv) <>'NO'
or upper(policy_priv) <>'NO'
select date_time,msgno,message from actlog
where severity='E' or severity='W'
select schedule_name from admin_schedules
where chg_admin='JAKE'
select schedule_name,priority from admin_schedules order
by priority
select domain_name,set_name,class_name from ar_copygroups
where retver='NOLIMIT' or cast(retver as integer) >365
select domain_name,set_name,class_name from bu_copygroups
where verexists ='NOLIMIT' or
cast(verexists as integer)>5
select node_name from nodes where option_set='SECURE'
select domain_name,num_nodes from domains
select node_name,count(*) from archives
group by node_name
select node_name from auditocc where spacemg_mb <>0
select count(*) from volumes where stgpool_name='TAPE'
and upper(status)='FULL' and pct_utilized < 50
select node_name, count(*) as "Files" from backups
where class_name='DAILY' and node_name in
(select node_name from nodes where domain_name='STANDARD')
group by node_name
select session_id as "Session",
client_name as "Client",
state as "State",
current_timestamp-start_time as "Elapsed Time",
(cast(bytes_sent as decimal(18,0)) /
cast(second(current_timestamp-start_time) as decimal(18,0)))
as "Bytes sent/second",
(cast(bytes_received as decimal(18,0)) /
cast(second(current_timestamp-start_time) as decimal(18,0)))
as "Bytes received/second"
from sessions
Session: 24
Client: ALBERT
State: Run
Elapsed Time: 0 01:14:05.000000
Bytes sent/second: 564321.9302768451
Bytes received/second: 0.0026748857944
Session: 26
Client: MILTON
State: Run
Elapsed Time: 0 00:06:13.000000
Bytes sent/second: 1638.5284210992221
Bytes received/second: 675821.6888561849
select process_num as "Number",
process,
current_timestamp-start_time as "Elapsed Time",
(cast(files_processed as decimal(18,0)) /
cast(second(current_timestamp-start_time) as decimal(18,0)))
as "Files/second",
(cast(bytes_processed as decimal(18,0)) /
cast(second(current_timestamp-start_time) as decimal(18,0)))
as "Bytes/second"
from processes
Number: 1
PROCESS: Expiration
Elapsed Time: 0 00:24:36.000000
Files/second: 6.3216755870092
Bytes/second: 0.0000000000000
select platform_name,count(*) as "Number of Nodes"
from nodes group by platform_name
PLATFORM_NAME Number of Nodes
------------- ---------------
AIX 6
SunOS 27
Win32 14
Linux 20
select node_name, count(*) as "number of filespaces"
from filespaces group by node_name order by 2
NODE_NAME number of filespaces
------------------ --------------------
ALBERT 2
MILTON 2
BARNEY 3
SEBASTIAN 3
MAILHOST 4
FALCON 4
WILBER 4
NEWTON 4
JEREMY 4
WATSON 5
RUSSELL 5
select * from summary where activity='OFFSITE RECLAMATION'
START_TIME: 2004-06-16 13:47:31.000000
END_TIME: 2004-06-16 13:47:34.000000
ACTIVITY: OFFSITE RECLAMATION
NUMBER: 4
ENTITY: COPYPOOL
COMMMETH:
ADDRESS:
SCHEDULE_NAME:
EXAMINED: 170
AFFECTED: 170
FAILED: 0
BYTES: 17821251
IDLE: 0
MEDIAW: 0
PROCESSES: 2
SUCCESSFUL: YES
VOLUME_NAME:
DRIVE_NAME:
LIBRARY_NAME:
LAST_USE:
COMM_WAIT:
NUM_OFFSITE_VOLS: 2
select stgpool_name,has_client_dedup_data from stgpools
STGPOOL_NAME HAS_CLIENT_DEDUP_DATA
-------------------- --------------------
ADPOOL NO
ARCHIVEPOOL NO
BACKUPPOOL NO
COPYDEDUP NO
COPYNODEDUP NO
FILEPOOL YES
FILEPOOL2 NO
LANFREEFILEPOOL YES
SPACEMGPOOL NO
select * from db
DATABASE_NAME: TSMDB1
TOT_FILE_SYSTEM_MB: 2048000
USED_DB_SPACE_MB: 12576
FREE_SPACE_MB: 1576871
TOTAL_PAGES: 983044
USABLE_PAGES: 982908
USED_PAGES: 977736
FREE_PAGES: 5172
BUFF_HIT_RATIO: 96.2
TOTAL_BUFF_REQ: 53967
SORT_OVERFLOW: 0
LOCK_ESCALATION: 0
PKG_HIT_RATIO: 70.0
LAST_REORG: 2010-07-15 17:32:55.000000
FULL_DEV_CLASS: OUTFILE
NUM_BACKUP_INCR: 0
LAST_BACKUP_DATE: 2010-01-21 10:37:59.000000
PHYSICAL_VOLUMES: 0
PAGE_SIZE:
NUM_BACKUP_STREAMS: 4
Generate the PVU estimate for a node named ACCTSRECSRV, which is used by the IBM Tivoli Storage Manager Extended Edition product.
select * from pvuestimate_details where node_name='ACCTSRECSRV'
PRODUCT: PRODTSMEE
LICENSE_NAME: MGSYSLAN
NODE_NAME: ACCTSRECSRV
LAST_USED: 2008-01-20 16:12:24.000000
TRYBUY: FALSE
PROC_VENDOR: IBM
PROC_BRAND: POWER5+ QCM
PROC_TYPE: 4
PROC_MODEL:
PROC_COUNT: 2
ROLE: SERVER
ROLE_OVERRIDE: USEREPORTED
ROLE_EFFECTIVE: SERVER
VALUE_UNITS: 50
VALUE_FROM_TABLE: YES
PVU: 100
SCAN_ERROR : NO
API_CLIENT: NO
PVU_AGNOSTIC: NO
HYPERVISOR: VMWARE
GUID: 01.2e.1c.80.e5.04-
.11.da.aa.ab.00.-
15.58.0b.d9.47
VERSION: 6
RELEASE: 3
LEVEL: 1
VENDOR_D: IBM(R)
BRAND_D: POWER5(TM) QCM
TYPE_D: Quad-core Module
MODEL_D: All Existing
PVU per node = number of processors per node * processor type * pvu value
where
the processor type represents the number of cores,
and the pvu value is the value defined for the processor
type in the IBM PVU table.The following example shows partial results for a selected node, including PVU-related information and role information. Possible roles are CLIENT, SERVER, or OTHER. PVU is calculated only for nodes defined as servers.
select * from nodes
ROLE: CLIENT
ROLE_O: USEREPORTED
PVENDOR: INTEL
PBRAND: INTEL
PTYPE: 4
PMODEL:
PCOUNT: 1
HYPERVISOR:
PAPI: NO
SCANERROR: NO