查詢Oracle正在執行和執行過的SQL語句
阿新 • • 發佈:2018-04-09
session man ESS ext acl ads ont desc -s
1、正在執行的
select a.username, a.sid,b.SQL_TEXT, b.SQL_FULLTEXT from v$session a, v$sqlarea b where a.sql_address = b.address;
2、執行過的(此方法好處可以查看某一時間段執行過的sql,並且 SQL_FULLTEXT 包
select b.SQL_TEXT,b.FIRST_LOAD_TIME,b.SQL_FULLTEXT from v$sqlarea b where b.FIRST_LOAD_TIME between ‘2018-04-09/09:24:47‘ and ‘2018-04-09/16:24:47 ‘ order by b.FIRST_LOAD_TIME;
3、查找前十條性能差的sql.
SELECT * FROM (select PARSING_USER_ID,EXECUTIONS,SORTS, COMMAND_TYPE,DISK_READS,sql_text FROM v$sqlarea order BY disk_reads DESC )where ROWNUM<10;
查詢Oracle正在執行和執行過的SQL語句