Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Pid,sid search each other, query sql according to PID

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

There are three ways to view the session ID of the current session:

1. V$mystat view

SQL > select sid from v$mystat where rownum=1

SID

-

1152

two。 Get it directly using userenv ('sid')

This method can only be used after oracle 10g.

SQL > select userenv ('sid') from dual

Pid,sid looks for each other:

V$session_wait

V$session

V$sqltext

V$process

/ pid finds sid/ (if the process cannot find it, it is not an oracle process) /

/ sid found pid/ (possibly caused by something else)

Supplement 1:

Find the sql statement according to pid

SELECT

Sql_text,hash_value

FROM v$sqltext a

WHERE (a.hash_value, a.address) IN (

SELECT DECODE (sql_hash_value

0, prev_hash_value

Sql_hash_value

),

DECODE (sql_hash_value, 0, prev_sql_addr, sql_address)

FROM v$session b

WHERE b.paddr = (SELECT addr

FROM v$process c

WHERE c.spid ='& pid'))

ORDER BY piece ASC

Supplement 2:

According to pid, find the sid,serial#, and delete it.

Select sid,serial# FROM v$session b

WHERE b.paddr = (SELECT addr

FROM v$process c

WHERE c.spid ='& pid')

ORDER BY piece ASC

Description: the spid- of v$process here is the pid of top.

Supplement 3:

Find PID= according to sid,serial#,.

Select c.spid from v$process c where c.addr = (select b.paddr from v$session b where b.sid=''and b.serialkeeper ='')

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report