oracle运维05监视执行sql正在执行已执行执行性能查看

78次阅读

共计 490 个字符,预计需要花费 2 分钟才能阅读完成。

1. 正在执行的 sql

select a.username, a.sid,b.SQL_TEXT,b.SQL_FULLTEXT,b.sql_id,b.EXECUTIONS
  from v$session a, v$sqlarea b 
where a.sql_address = b.address

2. 执行过的 sql

select b.SQL_TEXT,b.FIRST_LOAD_TIME,b.SQL_FULLTEXT
from v$sqlarea b
where b.FIRST_LOAD_TIME between '2020-06-20/01:52:00' and '2020-06-22/13:52:02'
order by b.FIRST_LOAD_TIME desc;

3. 查找前 10 条性能最差 sql;

SELECT *
  FROM (select PARSING_USER_ID,
               EXECUTIONS,
               SORTS,
               COMMAND_TYPE,
               DISK_READS,
               sql_text,
               sql_fulltext,
               parsing_schema_name
          FROM v$sqlarea
         order BY disk_reads DESC)
 where ROWNUM < 10;

正文完
 0