監控指令碼
---TOP EVNET--- 不對
SELECT ROUND((TIMEWAIT / SUM(TIMEWAIT) OVER()) * 100, 2) AS PCT,
EVENT,
WAIT_CLASS
FROM (SELECT SUM(TIME_WAITED) AS TIMEWAIT, EVENT, WAIT_CLASS
FROM V$ACTIVE_SESSION_HISTORY
GROUP BY EVENT, WAIT_CLASS)
ORDER BY PCT DESC;
---TOP MODULE---
SELECT ROUND((SECWAIT / SUM(SECWAIT) OVER()) * 100, 2) AS PCT, MODULE
FROM (SELECT SUM(SECONDS_IN_WAIT) AS SECWAIT, MODULE
FROM GV$SESSION
GROUP BY MODULE)
ORDER BY PCT DESC;
---TOP MACHINE---
SELECT ROUND((SECWAIT / SUM(SECWAIT) OVER()) * 100, 2) AS PCT, MACHINE
FROM (SELECT SUM(SECONDS_IN_WAIT) AS SECWAIT, MACHINE
FROM GV$SESSION
GROUP BY MACHINE)
ORDER BY PCT DESC;
--TOP SESSION-- 不太對
SELECT ROUND((SECWAIT / SUM(SECWAIT) OVER()) * 100, 2) AS PCT,
SID,
USERNAME,
MODULE
FROM (SELECT SUM(SECONDS_IN_WAIT) AS SECWAIT, SID, USERNAME, MODULE
FROM GV$SESSION
GROUP BY SID, USERNAME, MODULE)
WHERE USERNAME IS NOT NULL
ORDER BY PCT DESC;
SELECT CASE
WHEN SUM(TIMEWAIT) OVER() = 0 THEN
0
ELSE
ROUND((TIMEWAIT / SUM(TIMEWAIT) OVER()) * 100, 2)
END AS PCT,
ROUND(TIMEWAIT / 1000 / 1000, 2) AS S,
DECODE(EVENT, NULL, 'DB CPU', EVENT) AS EVENT,
WAIT_CLASS
FROM (SELECT * FROM (SELECT DECODE(SUM(TM_DELTA_DB_TIME), NULL, 0, SUM(TM_DELTA_DB_TIME)) AS TIMEWAIT,
EVENT,
WAIT_CLASS
FROM V$ACTIVE_SESSION_HISTORY
GROUP BY EVENT, WAIT_CLASS
ORDER BY TIMEWAIT DESC) WHERE ROWNUM < 11)
ORDER BY PCT DESC;
--
SELECT ROUND((SECONDS_IN_WAIT / SUM(SECONDS_IN_WAIT) OVER()) * 100, 2) AS PCT,
TOTAL_WAITS,
ROUND(SUM(SECONDS_IN_WAIT) OVER() / 1000 / 1000 / TOTAL_WAITS, 2) AS AVG_WAIT_TIME,
DECODE(EVENT, NULL, 'DB CPU', EVENT) AS EVENT,
WAIT_CLASS
FROM (SELECT COUNT(*) TOTAL_WAITS,
TRUNC(SUM(TIME_WAITED)) SECONDS_IN_WAIT,
EVENT,
WAIT_CLASS
FROM V$ACTIVE_SESSION_HISTORY
WHERE SESSION_STATE = 'WAITING'
AND TIME_WAITED > 0
GROUP BY EVENT, WAIT_CLASS)
ORDER BY PCT DESC
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29990276/viewspace-2142878/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql監控指令碼MySql指令碼
- DBA監控指令碼指令碼
- session指令碼監控Session指令碼
- 埠監控指令碼指令碼
- oracle 監控指令碼Oracle指令碼
- listener監聽監控指令碼指令碼
- 【SQL監控】SQL完全監控的指令碼SQL指令碼
- ogg監控指令碼指令碼
- stap監控IO指令碼指令碼
- 【shell】磁碟監控指令碼指令碼
- mysql 的一個監控指令碼,監控heartbeatMySql指令碼
- mysql mon 的一個監控指令碼,監控heartbeatMySql指令碼
- PostgreSQL之鎖監控指令碼SQL指令碼
- Oracle DBA常用監控指令碼Oracle指令碼
- memcached程式埠監控指令碼指令碼
- Nagios 監控ESXI指令碼iOS指令碼
- 監控cpu與memory指令碼指令碼
- 資料庫監控指令碼資料庫指令碼
- (Datagurad)監控指令碼指令碼
- 監控session數量指令碼Session指令碼
- 監控硬碟空間指令碼硬碟指令碼
- 監控sqlldr執行指令碼SQL指令碼
- 監控資料庫指令碼資料庫指令碼
- cacti自定義監控指令碼指令碼
- 監控系統告警指令碼集合指令碼
- 監控oracle表空間指令碼Oracle指令碼
- Goldengate for nrpe監控指令碼Go指令碼
- systemtap的網路監控指令碼指令碼
- stap監控cpu指令碼小結指令碼
- 指令碼監控MySQL伺服器指令碼MySql伺服器
- [zt]資料庫監控指令碼資料庫指令碼
- LINUX主機監控指令碼Linux指令碼
- 資料庫監控指令碼(一)資料庫指令碼
- 資料庫監控指令碼(二)資料庫指令碼
- 資料庫監控指令碼(三)資料庫指令碼
- oracle會話監控shell指令碼Oracle會話指令碼
- oracle空間使用監控指令碼Oracle指令碼
- linux監控,單行指令碼Linux指令碼