暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
session_by_XX
emcs
54次下载
889次浏览
2019-07-24
4.5

脚本内容

set line 199 col username format a14 col event format a35 col module format a20 col spid format a8 col machine format a15 col B_SESS for a10 --根据等待事件查会话 SELECT /*+rule */ sid, s.serial#, spid, event, sql_id, seconds_in_wait ws, row_wait_obj# obj, s.username, s.machine, BLOCKING_INSTANCE||'.'||blocking_session b_sess FROM v$session s, v$process p WHERE event='&event_name' AND s.paddr = p.addr order by 6; --根据用户查会话 SELECT /*+rule */ sid, s.serial#, spid, event, sql_id, seconds_in_wait ws, row_wait_obj# obj, s.username, s.machine, BLOCKING_INSTANCE||'.'||blocking_session b_sess FROM v$session s, v$process p WHERE s.username='&user_name' AND s.paddr = p.addr order by 6 --根据SQL_ID查会话 SELECT /*+rule */ sid, s.serial#, spid, event, sql_id, seconds_in_wait ws, row_wait_obj# obj, s.username, s.machine, BLOCKING_INSTANCE||'.'||blocking_session b_sess FROM v$session s, v$process p WHERE s.sql_id='&sql_id' AND s.paddr = p.addr order by 6 --根据会话ID查会话详情 SELECT s.sid, s.serial#, spid, event, sql_id, PREV_SQL_ID, seconds_in_wait ws, row_wait_obj# obj, s.username, s.machine, module,blocking_session b_sess,logon_time FROM v$session s, v$process p WHERE sid = '&sid' AND s.paddr = p.addr; --查询阻塞会话 select count(*),blocking_session from v$session where blocking_session is not null group by blocking_session; --查询会话的对象信息 col OBJECT_NAME for a30 select owner,object_name,subobject_name,object_type from dba_objects where object_id=&oid;

评论

贡献排行榜