Oracle获取最近执行的SQL语句
时间:2021-07-01 10:21:17
帮助过:5人阅读
last_load_time, sql_text
from v$sql
where module
not in (
‘jsenv.exe‘,
‘w3wp.exe‘,
‘SQL Developer‘)
--and sql_text like ‘%"Extent1"."ENCOUNTERID"%‘
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%‘ or sql_text
like ‘SELECT%‘)
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 ‘update%‘ ORDER BY last_load_time
DESC;
SELECT sql_text, last_load_time
FROM v$sql
WHERE last_load_time
IS NOT NULL and last_load_time
like‘ 2017-6-9%‘ ORDER BY last_load_time
DESC;
select a.username, a.sid,b.SQL_TEXT, b.SQL_FULLTEXT
from v$session a, v$sqlarea b
where a.sql_address
= b.address;
---执行过的
select b.SQL_TEXT,b.FIRST_LOAD_TIME,b.SQL_FULLTEXT
from v$sqlarea b
where b.FIRST_LOAD_TIME
between ‘2017-6-9/13:24:47‘ and
‘2017-6-9/15:24:47‘ order by b.FIRST_LOAD_TIME;
--(此方法好处可以查看某一时间段执行过的sql,并且 SQL_FULLTEXT 包含了完整的 sql 语句)
Oracle获取最近执行的SQL语句
标签:ora username sel extent 完整 获取 执行 load 并且