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

How to query the sql statement being executed by Oracle and the user who executed it

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to query Oracle is executing the sql statement and the implementation of the statement of users, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian with you to understand.

-- query the sql statement being executed by Oracle and the user who executed the statement

SELECT b.sid oracleID

B.username login Oracle user name

B.serial#

Spid operating system ID

Paddr

SQL being executed by sql_text

B.machine computer name

FROM v$process a, v$session b, v$sqlarea c

WHERE a.addr = b.paddr

AND b.sql_hash_value = c.hash_value

-- View the distribution procedure of the initiator who is executing the sql

Login identity of SELECT OSUSER computer

The program that PROGRAM initiates the request

User name of the USERNAME login system

SCHEMANAME

B.Cpu_Time spent the time of cpu

STATUS

Sql executed by B.SQL_TEXT

FROM V$SESSION A

LEFT JOIN V$SQL B ON A.SQL_ADDRESS = B.ADDRESS

AND A.SQL_HASH_VALUE = B.HASH_VALUE

ORDER BY b.cpu_time DESC

-- find out the current locked object of oracle

SELECT l.session_id sid

S.serial#

L.locked_mode lock mode

L.oracle_username login user

L.os_user_name login machine user name

S.machine machine name

S.terminal terminal user name

O.object_name locked object name

S.logon_time login time to the database

FROM v$locked_object l, all_objects o, v$session s

WHERE l.object_id = o.object_id

AND l.session_id = s.sid

ORDER BY sid, s.serial#

-- kill drops the current lock object can be

Alter system kill session 'sid, s. Serializations'

Thank you for reading this article carefully. I hope the article "how to query the sql statement being executed by Oracle and the users who execute it" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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