Tsm Sql Interface: Tivoli 技术专家沙龙活动
Tsm Sql Interface: Tivoli 技术专家沙龙活动
Tsm Sql Interface: Tivoli 技术专家沙龙活动
周硕基
zhoushuoji@gmail.com
IBM Software Group | Tivoli software
Overview
2
IBM Software Group | Tivoli software
Complicated queries may take a long time to complete and can interfere
with server operations(such as select * from backups)
You cannot issue SELECT queries from the server console (admin
command line only )
3
IBM Software Group | Tivoli software
4
IBM Software Group | Tivoli software
SELECT 语法
SELECT column|expression [,n..]
FROM tablename {,n…}
column refers to a column in a table
* is allowed as a wildcard to select all columns in a table
expression refers to functions that allow you manipulate the data being
returned
[,n…] indicates that you may specify one or more columns or
expressions
FROM clause indicates which table to search
You can specify one or more tablenames
5
IBM Software Group | Tivoli software
SYSCAT.ENUMTYPES
6
IBM Software Group | Tivoli software
7
IBM Software Group | Tivoli software
These allow you to sort, order, filter, and compute the data on a select
command
8
IBM Software Group | Tivoli software
9
IBM Software Group | Tivoli software
WHERE Clause
The WHERE clause allows you to filter out rows from the results
I want this, this and this, but only where this condition is true
I want to see all the volumes on which the client called test1 has data:
10
IBM Software Group | Tivoli software
AND means that the expressions on both sides must be true to return
TRUE
SELECT * FROM NODES WHERE NODE_NAME=‘TEST1’ AND
PLATFORM_NAME=‘WinNT’
11
IBM Software Group | Tivoli software
12
IBM Software Group | Tivoli software
ORDER BY Clause
The ORDER BY clause is used to sort the rows priorto displaying them:
SELECT NODE_NAME, PLATFORM_NAME FROM NODES
ORDER BY PLATFORM_NAME
13
IBM Software Group | Tivoli software
Functions
Functions allow you to aggregate data and operate on strings, numeric
and date and time values
COUNT(*) is useful for finding the number of rows that match a query.
14
IBM Software Group | Tivoli software
15
IBM Software Group | Tivoli software
GROUP BY Clause
The GROUP BY clause allows you to combine the rows being selected
into logical groups
Normally used with aggregate functions
SELECT NODE_NAME, SUM(NUM_FILES) AS #_OF_FILES,
SUM(LOGICAL_MB) AS TOTAL_MB FROM OCCUPANCY GROUP
BY NODE_NAME
16
IBM Software Group | Tivoli software
HAVING Clause
HAVING always follows the GROUP BY clause
Use the HAVING clause to filter the results of the GROUP BY clause
SELECT NODE_NAME, SUM(NUM_FILES) AS #_OF_FILES,
SUM(LOGICAL_MB) AS TOTAL_MB FROM OCCUPANCY GROUP BY
NODE_NAME HAVING SUM(LOGICAL_MB)>1
17
IBM Software Group | Tivoli software
Joining Tables
Helps you see how data relates between tables
There are different types of joins, depending on the data you are trying
to relate
Use an alias to specify which column you want to display when joining
tables with columns of the same name
The keyword DISTINCT specifies only unique rows will be retrieved and
prevent duplicates
18
IBM Software Group | Tivoli software
JOIN Example
To see which schedules a node is associated with join ASSOCIATIONS
with CLIENT_SCHEDULES
DOMAIN_NAME and SCHEDULE_NAME are common columns
19
IBM Software Group | Tivoli software
20
IBM Software Group | Tivoli software
21
IBM Software Group | Tivoli software
思考 : 恢复不了的文件是做的备份而不是归档还要注意哪些地方?
注意活动非活动版本
注意不同的管理类
…
22
IBM Software Group | Tivoli software
next?
Del volh t=dbb
23
IBM Software Group | Tivoli software
24
IBM Software Group | Tivoli software
25
IBM Software Group | Tivoli software
26
IBM Software Group | Tivoli software
列出使用自动调度的客户端节点
SELECT node_name FROM nodes WHERE node_name IN (SELECT
node_name FROM associations) ( 子查询非相关子查询)
other:
events?
策略相关 ?
27
IBM Software Group | Tivoli software
28
IBM Software Group | Tivoli software
Tsm Sql 参考
Help select
http://www.redbooks.ibm.com/abstracts/tips0010.html?Open
http://thobias.org/tsm/sql/index.html
http://www.lascon.co.uk/d005104.htm
29
IBM Software Group | Tivoli software
Questions????
30