功能:Oracle查询最近7天某用户执行的sql语句
参数:
SYS---要查询的用户,大写
+7----可改为任意数字查询任意天数
SQL语句:
select last_load_time,sql_text
from v$sqlarea
where parsing_schema_name='SYS'
and
last_load_time+7 > sysdate;
如果要按性能执行优劣排序(从最差到最好排序),执行下面语句:
select last_load_time,sql_text
from v$sqlarea
where parsing_schema_name='SYS'
and
last_load_time+7 > sysdate
order BY disk_reads DESC ;