Oracle 通过 SID 查询 SESSION 和 SQL 信息
【摘要】
📢 注意:查询条件,需要输入 SPID !
set linesize 260
set pagesize 1000
col sid for 99999
col spid for a8
col event...
📢 注意:查询条件,需要输入 SPID
!
set linesize 260
set pagesize 1000
col sid for 99999
col spid for a8
col event for a30
col module for a35
col machine for a15
col username for a10
col holder for a10
col final for a10
col sql_id for a15
col exec_gets for 99999999
col seconds for a5
col object_id for 999999
col param for a30
col sql_text for a6
col PGA_USE for 9999
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
select a.sid,
a.username,
a.machine,
a.module,
a.event,
a.sql_id,
round(decode(c.executions,0,buffer_gets,buffer_gets/executions)) exec_gets,
a.ROW_WAIT_OBJ# object_id,
a.BLOCKING_INSTANCE||'_'||a.blocking_session holder,
a.FINAL_BLOCKING_INSTANCE||'_'||a.FINAL_BLOCKING_SESSION final,
to_char(LAST_CALL_ET) seconds,
a.p1 || '_' || a.p2 || '_' || a.p3 param,
b.spid,
trunc(b.PGA_USED_MEM / 1024 / 1024,2) as PGA_USE,
substr(c.sql_text,0,6) sql_text
from v$session a, v$process b,v$sql c
where a.paddr = b.addr(+)
and a.status = 'ACTIVE'
and not (a.type = 'BACKGROUND' and a.state = 'WAITING' and
a.wait_class = 'Idle')
and a.sql_id=c.sql_id(+)
and a.sql_child_number=c.CHILD_NUMBER(+)
and b.spid='&SPID'
order by a.sql_id, a.machine;
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
本次分享到此结束啦~
如果觉得文章对你有帮助,点赞、收藏、关注、评论,一键四连支持,你的支持就是我创作最大的动力。
❤️ 技术交流可以 关注公众号:Lucifer三思而后行 ❤️
文章来源: luciferliu.blog.csdn.net,作者:Lucifer三思而后行,版权归原作者所有,如需转载,请联系作者。
原文链接:luciferliu.blog.csdn.net/article/details/120211868
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)