Oracle Index Index Monitoring

1, the drawbacks of redundancy index   

Large number of redundant and useless index resulting in poor overall database performance, consumes a large amount of CPU and I / O overhead, the following specific performance:      

a, consume large amounts of storage space (maintenance and management index segment)      

b, an increase of DML completion time      

c, a considerable amount of time statistical information (index) collected      

d, structural verification time      

f, increases the time required for recovery

2, a single index monitoring        

a, for the monitoring of a single index, the following command can be done          

alter index <INDEX_NAME> monitoring usage;      

b, close monitoring of the index         

alter index <INDEX_NAME> nomonitoring usage;      

c, observation monitoring results (Query v $ object_usage view)         

select * from v$object_usage

3, schema level index monitor (without user SYS)

a, direct execution of the script to open the index monitoring

robin@SZDB:~/dba_scripts/custom/sql> more idx_monitor_on.sql

SET HEADING OFF  FEEDBACK OFF  TERMOUT OFF  ECHO OFF;

SET PAGESIZE 0;

SPOOL /tmp/mnt_idx.sql

SELECT 'ALTER INDEX ' || owner || '.' || index_name || ' MONITORING USAGE;'  FROM dba_indexes 

WHERE owner IN (SELECT username FROM dba_users WHERE account_status = 'OPEN')      

AND owner NOT IN ('SYS', 'SYSTEM', 'PERFSTAT', 'MGMT_VIEW', 'MONITOR', 'SYSMAN', 'DBSNMP');

SPOOL OFF;

b, disabled index monitoring

robin@SZDB:~/dba_scripts/custom/sql> more idx_monitor_off.sql

SET HEADING OFF  FEEDBACK OFF  TERMOUT OFF  ECHO OFF;

SET PAGESIZE 0;

SPOOL /tmp/un_mnt_idx.sql

SELECT 'ALTER INDEX ' || owner || '.' || index_name || ' NOMONITORING USAGE;'  FROM dba_indexes 

WHERE owner IN (SELECT username  FROM dba_users  WHERE account_status = 'OPEN')      

AND owner NOT IN ('SYS', 'SYSTEM', 'PERFSTAT', 'MGMT_VIEW', 'MONITOR', 'SYSMAN', 'DBSNMP');

SPOOL OFF;

c, see the index monitoring results

set linesize 190

SELECT u.name owner,      

io.name index_name,      

t.name table_name,      

DECODE (BITAND (i.flags, 65536), 0, 'NO', 'YES') monitoring,      

DECODE (BITAND (ou.flags, 1), 0, 'NO', 'YES') used,      

ou.start_monitoring start_monitoring,      

ou.end_monitoring end_monitoring 

FROM sys.user$ u,       sys.obj$ io,       sys.obj$ t,       sys.ind$ i,       sys.object_usage ou

WHERE i.obj# = ou.obj# AND io.obj# = ou.obj# AND t.obj# = i.bo#

AND u.user# = io.owner#      

AND u.name=decode(upper('&input_owner'),'ALL',u.name,upper('&input_owner'));

Guess you like

Origin www.cnblogs.com/xibuhaohao/p/11014269.html