Oracle 監控索引的使用率
轉載自:
http://blog.csdn.net/leshami/article/details/8823133
set linesize 140
set pagesize 160
clear breaks
clear computes
break on TABLE_NAME skip 2 ON INDEX_NAME ON INDEX_TYPE ON MB
compute sum of NR_EXEC on TABLE_NAME SKIP 2
compute sum of MB on TABLE_NAME SKIP 2
SET TIMI OFF
set linesize 140
set pagesize 10000
set verify off
col OWNER noprint
col TABLE_NAME for a30 heading 'Table name'
col INDEX_NAME for a30 heading 'Index name'
col INDEX_TYPE for a15 heading 'Index type'
col INDEX_OPERATION for a21 Heading 'Index operation'
col NR_EXEC for 9G999G990 heading 'Executions'
col MB for 999G990D90 Heading 'Index|Size MB' justify right
WITH Q AS (
SELECT
S.OWNER A_OWNER,
TABLE_NAME A_TABLE_NAME,
INDEX_NAME A_INDEX_NAME,
INDEX_TYPE A_INDEX_TYPE,
SUM(S.bytes) / 1048576 A_MB
FROM DBA_SEGMENTS S,
DBA_INDEXES I
WHERE S.OWNER = upper('&&1')
AND I.OWNER = upper('&&1')
AND INDEX_NAME = SEGMENT_NAME
GROUP BY S.OWNER, TABLE_NAME, INDEX_NAME, INDEX_TYPE
HAVING SUM(S.BYTES) > 1048576 * &&2
)
SELECT /*+ NO_QUERY_TRANSFORMATION(S) */
A_OWNER OWNER,
A_TABLE_NAME TABLE_NAME,
A_INDEX_NAME INDEX_NAME,
A_INDEX_TYPE INDEX_TYPE,
A_MB MB,
DECODE (OPTIONS, null, ' -',OPTIONS) INDEX_OPERATION,
COUNT(OPERATION) NR_EXEC
FROM Q,
DBA_HIST_SQL_PLAN d
WHERE
D.OBJECT_OWNER(+)= q.A_OWNER AND
D.OBJECT_NAME(+) = q.A_INDEX_NAME
GROUP BY
A_OWNER,
A_TABLE_NAME,
A_INDEX_NAME,
A_INDEX_TYPE,
A_MB,
DECODE (OPTIONS, null, ' -',OPTIONS)
ORDER BY
A_OWNER,
A_TABLE_NAME,
A_INDEX_NAME,
A_INDEX_TYPE,
A_MB DESC,
NR_EXEC DESC
;
PROMPT "Showed only indexes in &&1 schema whose size > &&2 MB in period:"
SET HEAD OFF;
select to_char (min(BEGIN_INTERVAL_TIME), 'DD.MM.YYYY')
|| '-' ||
to_char (max(END_INTERVAL_TIME), 'DD.MM.YYYY')
from dba_hist_snapshot;
SET HEAD ON
SET TIMI ON
http://blog.itpub.net/29254281/viewspace-1067050/
相對於索引監控,不僅可以看到索引是否使用
更可以看到使用該索引的步驟的數量,十分直觀
http://blog.csdn.net/leshami/article/details/8823133
set linesize 140
set pagesize 160
clear breaks
clear computes
break on TABLE_NAME skip 2 ON INDEX_NAME ON INDEX_TYPE ON MB
compute sum of NR_EXEC on TABLE_NAME SKIP 2
compute sum of MB on TABLE_NAME SKIP 2
SET TIMI OFF
set linesize 140
set pagesize 10000
set verify off
col OWNER noprint
col TABLE_NAME for a30 heading 'Table name'
col INDEX_NAME for a30 heading 'Index name'
col INDEX_TYPE for a15 heading 'Index type'
col INDEX_OPERATION for a21 Heading 'Index operation'
col NR_EXEC for 9G999G990 heading 'Executions'
col MB for 999G990D90 Heading 'Index|Size MB' justify right
WITH Q AS (
SELECT
S.OWNER A_OWNER,
TABLE_NAME A_TABLE_NAME,
INDEX_NAME A_INDEX_NAME,
INDEX_TYPE A_INDEX_TYPE,
SUM(S.bytes) / 1048576 A_MB
FROM DBA_SEGMENTS S,
DBA_INDEXES I
WHERE S.OWNER = upper('&&1')
AND I.OWNER = upper('&&1')
AND INDEX_NAME = SEGMENT_NAME
GROUP BY S.OWNER, TABLE_NAME, INDEX_NAME, INDEX_TYPE
HAVING SUM(S.BYTES) > 1048576 * &&2
)
SELECT /*+ NO_QUERY_TRANSFORMATION(S) */
A_OWNER OWNER,
A_TABLE_NAME TABLE_NAME,
A_INDEX_NAME INDEX_NAME,
A_INDEX_TYPE INDEX_TYPE,
A_MB MB,
DECODE (OPTIONS, null, ' -',OPTIONS) INDEX_OPERATION,
COUNT(OPERATION) NR_EXEC
FROM Q,
DBA_HIST_SQL_PLAN d
WHERE
D.OBJECT_OWNER(+)= q.A_OWNER AND
D.OBJECT_NAME(+) = q.A_INDEX_NAME
GROUP BY
A_OWNER,
A_TABLE_NAME,
A_INDEX_NAME,
A_INDEX_TYPE,
A_MB,
DECODE (OPTIONS, null, ' -',OPTIONS)
ORDER BY
A_OWNER,
A_TABLE_NAME,
A_INDEX_NAME,
A_INDEX_TYPE,
A_MB DESC,
NR_EXEC DESC
;
PROMPT "Showed only indexes in &&1 schema whose size > &&2 MB in period:"
SET HEAD OFF;
select to_char (min(BEGIN_INTERVAL_TIME), 'DD.MM.YYYY')
|| '-' ||
to_char (max(END_INTERVAL_TIME), 'DD.MM.YYYY')
from dba_hist_snapshot;
SET HEAD ON
SET TIMI ON
http://blog.itpub.net/29254281/viewspace-1067050/
相對於索引監控,不僅可以看到索引是否使用
更可以看到使用該索引的步驟的數量,十分直觀
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29254281/viewspace-1314620/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle索引的監控Oracle索引
- ORACLE 監控索引的使用Oracle索引
- 如何監控oracle的索引是否使用Oracle索引
- 監控Oracle索引的使用情況Oracle索引
- 監控Oracle索引是否被使用?Oracle索引
- 監控server磁碟使用率的jobServer
- 監控磁碟使用率的shell指令碼指令碼
- 從例項看oracle的索引監控與無效索引維護Oracle索引
- html監控ASM磁碟組使用率HTMLASM
- 索引監控-查詢從未被使用過的索引索引
- 監控mysql索引使用效率的指令碼MySql索引指令碼
- Oracle對錶的監控Oracle
- Oracle-監控oracle的等待事件Oracle事件
- oracle監控軟體Oracle
- oracle 長sql監控OracleSQL
- Oracle常用監控SQLOracleSQL
- oracle 監控指令碼Oracle指令碼
- 利用nsca監控oracle的session數OracleSession
- ORACLE監控之OSW部署Oracle
- Oracle-常用監控SQLOracleSQL
- 使用nagios監控oracleiOSOracle
- Oracle常用監控SQL(轉)OracleSQL
- top linux 實時監控命令 檢視CPU使用率(轉)Linux
- oracle備庫延時的監控方法Oracle
- Oracle資料庫的監控內容Oracle資料庫
- Oracle RAC 的監控和調整 (zt)Oracle
- Zabbix如何監控Oracle的告警日誌Oracle
- Zabbix透過Orabbix監控OracleOracle
- Spotlight On Oracle 監控軟體Oracle
- oracle表空間增加監控Oracle
- Oracle DBA常用監控指令碼Oracle指令碼
- Oracle Undo使用情況監控Oracle
- 監控Oracle資料庫方法Oracle資料庫
- zabbix監控oracle資料庫Oracle資料庫
- 使用zabbix監控oracle的後臺日誌Oracle
- 【TABLE】Oracle監控異常的表設計Oracle
- Nagois監控oracle資料庫注意的地方GoOracle資料庫
- Oracle對儲存的監控及意義Oracle