tail查看oracle执行过的sql
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tail查看oracle执行过的sql相关的知识,希望对你有一定的参考价值。
参考技术A Oracle 最近执⾏过的sql语句:1. SELECT sql_text, last_load_time
2. FROM v$sql
3. WHERE last_load_time IS NOT NULL
4. ORDER BY last_load_time DESC
其它
SELECT sql_text,last_load_time FROM v$sql order by last_load_time desc;
SELECT sql_text, last_load_time FROM v$sql WHERE last_load_time IS NOT NULL and sql_text like 'select%' ORDER BY last_load_time DESC;
查询Oracle正在执行和执行过的SQL语句
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;
以上是关于tail查看oracle执行过的sql的主要内容,如果未能解决你的问题,请参考以下文章