A simple index to monitor the use of ORACLE

Description:


Application development may be the establishment of a number of indexes, but these indexes used in the end how kind, is there an index has not been used, which requires us to monitor these indexes in order to determine their usage, and as to whether They can clear the basis is given.

This article describes two ways:

First: Open the monitoring function;

2nd: View the history of implementation of the plans, conduct analysis;



Environment:


SQL> select * from v $ version;




BANNER

-------------------------------------------------- --------------

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi

PL / SQL Release 10.2.0.3.0 - Production

CORE 10.2.0.3.0 Production

TNS for Linux: Version 10.2.0.3.0 - Production

NLSRTL Version 10.2.0.3.0 - Production

Test:

First:


CREATE TABLE tt

AS

SELECT * FROM dba_objects;




DELETE FROM tt

WHERE object_id IS NULL;




ALTER TABLE tt ADD CONSTRAINT pk_tt PRIMARY KEY (object_id);




Note: Use the alter index <INDEX_NAME> nomonitoring usage cancel monitoring.




SELECT object_id, object_name

FROM tt

WHERE object_id = 333;




SELECT INDEX_NAME, MONITORING, USED, START_MONITORING, END_MONITORING

FROM V $ OBJECT_USAGE;




In order to avoid the V $ OBJECT_USAGE only under the current user query to the index to monitor the situation, you can use the following statement to query the database for all monitors the use of an index:




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 #



Second:


Library cache data on the use of a

SELECT OBJECT_NAME

FROM V $ SQL_PLAN A, V $ SQLAREA B

WHERE A. SQL_ID = B. SQL_ID

AND A. OBJECT_TYPE = 'INDEX'

AND OBJECT_OWNER IN ( 'XXXX', 'XXXX');




2 the use of STATSPACK

SELECT A. OBJECT_OWNER, A. OBJECT_NAME

FROM STATS $ SQL_PLAN A, STATS $ SQL_PLAN_USAGE B

WHERE A. PLAN_HASH_VALUE = B. PLAN_HASH_VALUE

AND A. OBJECT_TYPE = 'INDEX';

Note: The need to open Statspack snapshot feature, or finding out data;




3 If it is more than 10g version of the data, you can use AWR

SELECT B. OBJECT_NAME

FROM DBA_HIST_SNAPSHOT A, DBA_HIST_SQL_PLAN B, DBA_HIST_SQLSTAT C

WHERE A. SNAP_ID = C. SNAP_ID

AND B. SQL_ID = C. SQL_ID

AND B. OBJECT_TYPE = 'INDEX'

AND B. OBJECT_OWNER IN ( 'XXX', 'XXXX');




Note: You can adopt the following statement to query the operation of AWR




SELECT *

FROM DBA_HIST_WR_CONTROL;

Reference:


http://www.hellodba.com/Doc/monitor_index.htm

http://www.oracle.com/technology/global/cn/pub/articles/10gdba/week6_10gdba.html




Pending further study of content:

http://www.remote-dba.net/oracle_10g_tuning/t_oracle_index_usage_tracking.htm



Added:


With regard to the index to monitor or track, this is just to stay in a simple theory of phase, and in-depth in practice there are many elements to understand.


  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of A simple index to monitor the use of ORACLE

  • ORACLE10G full version centos5 installed (the installation has passed)

    ORACLE10G full version centos5 installed (the installation has passed) 1. Centos 5.0 install rn GUI must be installed, it is best not to start selinux rn rn rn 2. . Ready to install the software: (this is very important, is the first installation fai ...

  • SGA extended the principle of 32bit oracle

    SGA extended the principle of 32bit oracle From: http://www.itpub.net/247048.html Because the median 32bitrnoracle restrictions can only visit the oracle process 4g (2 of 32 power) following virtual memory address, the time at a lot of people this is ...

  • Oracle in the relationship between User and Schema

    If we want to know the database and the User What is the relationship between Schema, we must first know about User and Schema database What is the concept in the end. In SQL Server2000 in architecture because of the reason, User and Schema there is ...

  • High Availability Oracle Flashback

    Brief introduction Flashback Database is a point in time (PIT) restore the database approach. This incomplete recovery strategy can be used to restore the logic because of human error cause damage to the database. At the introduction of 10g, it is de ...

  • An example of the use of TKPROF

    First, view and edit parameters SQL> show parameter max_dump_file_size NAME TYPE VALUE ------------------------------------ ----------- --- --------------------------- max_dump_file_size string UNLIMITED SQL> show parameter user_dump_dest NAME TYPE

  • Diagnosis and principles of order

    SQL> select disk.value "Disk", mem.value "Mem", 2 (disk.value / mem.value) * 100 "Ratio" 3 from v $ sysstat mem, v $ sysstat disk 4 where mem.name = 'sorts (memory)' 5 and disk.name = 'sorts (disk)'; D ...

  • ORACLE 10G dataguard configuration Step by Step

    oracle dataguard

Leave a Reply

Recent
Recent Entries
Tag Cloud
Random Entries
Latest Comments