Script:诊断解析等待和高version count

Script:诊断解析等待和高version count

 

 

select * from 
   (select sql_id, count(child_number) 
      from v$sql_shared_cursor 
     group by sql_id
     order by count(child_number) desc)
where rownum <=5;

-- Script Code
set serveroutput on 

DECLARE
  v_count number;
  v_sql varchar2(500);
  v_sql_id varchar2(30) := '&sql_id';
BEGIN
  v_sql_id := lower(v_sql_id);
  dbms_output.put_line(chr(13)||chr(10));
  dbms_output.put_line('sql_id: '||v_sql_id);
  dbms_output.put_line('------------------------');
  FOR c1 in 
    (select column_name  
       from dba_tab_columns 
      where table_name ='V_$SQL_SHARED_CURSOR' 
        and column_name not in ('SQL_ID', 'ADDRESS', 'CHILD_ADDRESS', 'CHILD_NUMBER', 'REASON')
      order by column_id)
  LOOP
    v_sql := 'select count(*) from V_$SQL_SHARED_CURSOR 
              where sql_id='||''''||v_sql_id||''''||' 
              and '||c1.column_name||'='||''''||'Y'||'''';
    execute immediate v_sql into v_count;
    IF v_count > 0 
    THEN 
      dbms_output.put_line(' - '||rpad(c1.column_name,30)||' count: '||v_count);
    END IF;
  END LOOP;
END;
/

oradebug setmypid
oradebug unlimit;
alter session set events 'immediate trace name systemstate level 266';
 alter session set events 'immediate trace name library_cache level 11';
 alter session set events 'immediate trace name cursordump level 16'; 
oradebug tracefile_name;

SELECT b.*
FROM v$sqlarea a ,
  TABLE(version_rpt(a.sql_id)) b
WHERE loaded_versions >=100;


SELECT b.*
FROM v$sqlarea a ,
  TABLE(version_rpt(NULL,a.hash_value)) b
WHERE loaded_versions>=100;

 

 

version_rpt3_22.sql

Comment

*

沪ICP备14014813号-2

沪公网安备 31010802001379号