(sql_address,sql_hash_value),(prev_sql_addr,prev_hash_value) 根据这两组字段, 可以查询到当前session正在执行的或最近一次执行的sql语句的详细信息:
select * from v$sqltext where address = &sql_address and hash_value = &sql_hash_value;
根据PID查SQL相关信息
select id,serial#
,username,osuser,machine,program,process,to_char(logon_time,'yyyy/mm/dd
hh24:mi:ss') logon from v$session where paddr in ( select addr from
v$process where spid in('&pid'));
根据PID查SQL语句
SELECT
a.username,a.machine,a.program,a.sid,a.serial#,a.status,c.piece,c.sql_text
FROM v$session a,v$process b,v$sqltext c WHERE b.spid='&spid' AND
b.addr=a.paddr AND a.sql_address=c.address(+) ORDER BY c.piece;
得到进程的sid号:
select
id,serial#
,username,osuser,machine,program,process,to_char(logon_time,'yyyy/mm/dd
hh24:mi:ss') logon from v$session where paddr in ( select addr from
v$process where spid in('&pid'));
得到session的sqltext语句:
select
sql_text from v$sqltext_with_newlines where hash_value in (select
SQL_HASH_VALUE from v$session where paddr in (select addr from v$process
where spid= '&pid')) order by piece;
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞0
添加新评论0 条评论