監控指令碼
---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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【shell】磁碟監控指令碼指令碼
- PostgreSQL之鎖監控指令碼SQL指令碼
- 監控系統告警指令碼集合指令碼
- Shell 系統資訊監控指令碼指令碼
- 監控磁碟使用率的shell指令碼指令碼
- 網路卡流量監控指令碼,python實現指令碼Python
- centos 監控web站點是否500 指令碼CentOSWeb指令碼
- shell指令碼:監控MySQL服務是否正常指令碼MySql
- Shell指令碼監控MySQL主從狀態指令碼MySql
- shell指令碼監控啟動停止weblogic服務指令碼Web
- 關於前端指令碼異常監控的思考前端指令碼
- 在 Linux 上用 Bash 指令碼監控 messages 日誌Linux指令碼
- 使用Shell指令碼程式監控網站URL是否正常指令碼網站
- 寫了個監控 ElasticSearch 程式異常的指令碼!Elasticsearch指令碼
- 透過shell指令碼監控日誌切換頻率指令碼
- 基於Ping和Telnet/NC的監控指令碼案例分析指令碼
- zabbix-mongodb監控指令碼(高效能、低佔用)MongoDB指令碼
- MySQL 5.6大查詢和大事務監控指令碼(Python 2)MySql指令碼Python
- 分享實用監控指令碼:使用Shell檢查程式是否存在指令碼
- 利用 Shell 指令碼來監控 Linux 系統的記憶體指令碼Linux記憶體
- 用於自動監控磁碟使用情況的 Shell 指令碼指令碼
- sqlserver監控指令碼_發現某個等待就發出郵件SQLServer指令碼
- 用 Bash 指令碼監控 Linux 上的記憶體使用情況指令碼Linux記憶體
- PowerShell 指令碼來監控 CPU、記憶體和磁碟使用情況:指令碼記憶體
- 如何用bash shell 指令碼監控 Linux記憶體、磁碟和 CPU?指令碼Linux記憶體
- Linux下針對伺服器網路卡流量和磁碟的監控指令碼Linux伺服器指令碼
- 用 Linux Shell 指令碼來監控磁碟使用情況併傳送郵件Linux指令碼
- 黑盒監控、日誌監控
- 案例五:shell指令碼實現定時監控http服務的執行狀態指令碼HTTP
- 6.prometheus監控--監控dockerPrometheusDocker
- TiDB監控實現--存活監控TiDB
- 【Azure Redis 快取】使用Python程式碼獲取Azure Redis的監控指標值 (含Powershell指令碼方式)Redis快取Python指標指令碼
- 寶塔liunx控制皮膚,監控程式斷了以後自動重啟的指令碼指令碼
- 監控
- 聊聊前端監控——錯誤監控篇前端
- 淺析badjs原始碼(前端監控方案)JS原始碼前端
- 編碼:執行緒執行監控執行緒
- 運維指令碼: 實時監測登入運維指令碼
- APM效能監控軟體的監控型別服務及監控流程型別