查看oracle数据库最近执行了哪些sql语句
2个回答
展开全部
1、修改日期显示格式
alter session set nls_date_format=’YYYY-MM-DD HH24:MI:SS’;
2、哪个主机最近执行的sql语句:
SELECT b.sql_text,a.machine,a.username, a.module,c.sofar / totalwork * 100,
c.elapsed_seconds,c.time_remaining
FROM v$session a, v$sqlarea b, v$session_longops c
WHERE a.sql_hash_value = b.hash_value(+) AND a.SID = c.SID(+)
AND a.serial# = c.serial#(+)
--AND a.sid=139
3、最近的sql语句
SELECT sql_text, last_load_time,LAST_ACTIVE_TIME FROM v$sql WHERE LAST_LOAD_TIME > trunc(sysdate) and last_load_time IS NOT NULL ORDER BY last_load_time DESC;
4、正在执行的sql
SELECT a.sid, a.serial#, b.sql_text
FROM v$session a, v$sqltext b
WHERE a.sql_address = b.address
--AND a.sid = <...>
ORDER BY b.piece
5、推荐你用lab128监测软件,一目了然。
alter session set nls_date_format=’YYYY-MM-DD HH24:MI:SS’;
2、哪个主机最近执行的sql语句:
SELECT b.sql_text,a.machine,a.username, a.module,c.sofar / totalwork * 100,
c.elapsed_seconds,c.time_remaining
FROM v$session a, v$sqlarea b, v$session_longops c
WHERE a.sql_hash_value = b.hash_value(+) AND a.SID = c.SID(+)
AND a.serial# = c.serial#(+)
--AND a.sid=139
3、最近的sql语句
SELECT sql_text, last_load_time,LAST_ACTIVE_TIME FROM v$sql WHERE LAST_LOAD_TIME > trunc(sysdate) and last_load_time IS NOT NULL ORDER BY last_load_time DESC;
4、正在执行的sql
SELECT a.sid, a.serial#, b.sql_text
FROM v$session a, v$sqltext b
WHERE a.sql_address = b.address
--AND a.sid = <...>
ORDER BY b.piece
5、推荐你用lab128监测软件,一目了然。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询