DB2_狀態監視
目的:
測試DB2狀態監視,本指令碼摘錄自DB2安裝目錄admin_scripts/monitor.db2。
版本:Windows DB2 Express-C V9.7
操作步驟:
使用"db2cmd db2 -t"進入互動模式,執行後續操作。
-- Connect to SAMPLE
CONNECT TO sample;
-- List the top CPU consuming applications for the currently connected
-- database on the currently connected partition
SELECT s2.APPL_NAME,
s2.APPL_ID,
s1.AGENT_ID,
s2.PRIMARY_AUTH_ID,
((s1.AGENT_USR_CPU_TIME_S + s1.AGENT_SYS_CPU_TIME_S)*1000000 +
s1.AGENT_USR_CPU_TIME_MS + s1.AGENT_SYS_CPU_TIME_MS) AS TOTAL_CPU_TIME,
(s1.AGENT_USR_CPU_TIME_S*1000000 + s1.AGENT_USR_CPU_TIME_MS) AS AGENT_USR_CPU_TIME,
(s1.AGENT_SYS_CPU_TIME_S*1000000 + s1.AGENT_SYS_CPU_TIME_MS) AS AGENT_SYS_CPU_TIME
FROM TABLE( SNAP_GET_APPL( '', -1 )) as s1,
TABLE( SNAP_GET_APPL_INFO( '', -1 )) as s2
WHERE s1.AGENT_ID = s2.AGENT_ID
ORDER BY TOTAL_CPU_TIME DESC, s2.APPL_NAME;
--select * from table(snap_get_appl('',-1)) as s1;可以獲取該應用(會話)的統計資訊,包括當前持有鎖,io,cpu,sort等
--select * from table(snap_get_appl_info('',-1)) as s2;可以獲取應用連線資訊
-- Retrieving the snapshot statistics about the progress
-- of all active utilities per partition.
SELECT u1.UTILITY_DBNAME,
u1.DBPARTITIONNUM,
u1.UTILITY_ID,
u1.UTILITY_PRIORITY,
u1.UTILITY_DESCRIPTION,
u2.UTILITY_STATE,
u2.PROGRESS_WORK_METRIC,
u2.PROGRESS_COMPLETED_UNITS,
u2.PROGRESS_TOTAL_UNITS,
DEC( ( FLOAT( u2.PROGRESS_COMPLETED_UNITS ) / FLOAT( u2.PROGRESS_TOTAL_UNITS ) ) * 100, 4, 2 )
AS PERCENT_SEQ_COMPLETE
FROM SYSIBMADM.SNAPUTIL as u1, SYSIBMADM.SNAPUTIL_PROGRESS as u2
WHERE u1.UTILITY_ID = u2.UTILITY_ID and u1.DBPARTITIONNUM = u2.DBPARTITIONNUM
ORDER BY u1.UTILITY_DBNAME, u1.DBPARTITIONNUM, u2.PROGRESS_SEQ_NUM;
--select * from SYSIBMADM.SNAPUTIL;工具基本資訊
--select * from SYSIBMADM.SNAPUTIL_PROGRESS;工具進度資訊,總量,當前
-- Retrieving the snapshot statistics about total amount of space
-- used by all tablespaces per partition in the currently connected database.
SELECT SUM( TBSP_TOTAL_SIZE_KB ) AS DBPART_TBSP_TOTAL_SIZE,
DBPARTITIONNUM FROM SYSIBMADM.TBSP_UTILIZATION
GROUP BY DBPARTITIONNUM ORDER BY DBPART_TBSP_TOTAL_SIZE DESC;
--select * FROM SYSIBMADM.TBSP_UTILIZATION;表空間基本資訊和使用資訊,分配,已用,空閒
-- Connect reset
CONNECT RESET;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18922393/viewspace-702288/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DB2_使用事件監視器DB2事件
- DB2_獲取系統引數狀態DB2
- DB2_使用表函式獲取健康監視器快照DB2函式
- win10電腦怎麼檢視windows防火牆監視器狀態Win10Windows防火牆
- 監控Nginx的工作狀態Nginx
- Nginx服務狀態監控Nginx
- openwrt,狀態監測netdata
- 2.5.4. 測試Oracle net——2.5.4.2. 檢視監聽程式狀態Oracle
- 智慧工廠裝置狀態視覺化監控解決方案視覺化
- Docker 之 執行狀態監控Docker
- MySQL MHA 執行狀態監控MySql
- iOS AFN監聽網路狀態iOS
- SCNetworkReachabilityRef監測網路狀態
- nagios監控drbd同步狀態iOS
- memcached的執行狀態監控
- 檢視BW執行狀態
- 檢視看防火牆狀態防火牆
- 7. 監控MySQL主從狀態MySql
- iOS 使用 Reachability 監聽網路狀態iOS
- Galera Cluster for MySQL監控狀態說明MySql
- Java應用異常狀態監測Java
- nagios監控 ogg同步狀態iOS
- Nginx狀態圖形化監控工具Nginx
- 利用btrace線上監控java程式狀態Java
- 用c#監控網路狀態C#
- Linux iostat監測IO狀態LinuxiOS
- Linux下用netstat檢視網路狀態、埠狀態Linux
- 系統狀態檢視工具Sysstat
- firewalld:檢視版本/幫助/狀態
- WPF 視覺狀態VisualState使用視覺
- GitLab 的元件狀態檢視Gitlab元件
- 利用superlance監控supervisor執行狀態
- Shell指令碼監控MySQL主從狀態指令碼MySql
- 巧用Zabbix自定義監控Mysql效能狀態MySql
- 利用shell指令碼監控網站狀態指令碼網站
- Linux-iostat監測IO狀態LinuxiOS
- MySQL監控SQL狀態及命中率MySql
- 開啟nginx狀態監控,檢視web伺服器的併發連線數NginxWeb伺服器