How to use V$SQL_MONITOR

1. add hint to monitor a particular SQL

eg.  select/*+ monitor */ emp_name from emp;


2.  to get sid for the sql

select SQL_ID,sum(buffer_gets) buffer_gets,
sum(disk_reads)disk_reads,round(sum(cpu_time/1000000),1) cpu_secs
from v$sql_monitor

where sql_text like '%monitor%'

3. check the SQL PLAN for this sql

using SQL_ID  to get the SQL PLAN

SELECT DBMS_SQLTUNE.report_sql_monitor(sql_id => '1kfww208s1gtz', type => 'TEXT') AS report FROM dual;

猜你喜欢

转载自blog.csdn.net/xiadingling/article/details/80002472