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 analyze the problem of locking tables with v$locked_object and $lock

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article is to share with you about how to analyze v$locked_object, $lock lock table, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

The following are related tables

SELECT * FROM v$lock

SELECT * FROM v$sqlarea

SELECT * FROM v$session

SELECT * FROM v$process

SELECT * FROM v$locked_object

SELECT * FROM all_objects

SELECT * FROM v$session_wait

-- View locked tables

Select b.owner.ownerreb. Objectkeeper namefilamenta.sessionroomidrecorda.lockedwriting mode from v$locked_object a dbathing objects b where b.object_id = a.object_id

-- check that user and that process is deadlocked

Select b.username.b.sidrecoveryb.serialpaperpaperlogonedtime from v$locked_object arecoveryvaccountsession b where a.session_id = b.sid order by b.logon_time

-- View the progress of the connection

SELECT sid, serial#, username, osuser FROM v$session

-3. Find out the sid, serial#,os_user_name, machine_name, terminal, type,mode of the lock table

SELECT s.sid, s.serial#, s.username, s.schemaname, s.osuser, s.process, s.machine

S.terminal, s.logon_time, l.type

FROM v$session s, v$lock l

WHERE s.sid = l.sid

AND s.username IS NOT NULL

ORDER BY sid

This statement will find the locks generated by all the DML statements in the database, and you can also find

Any DML statement actually produces two locks, a table lock and a row lock.

-- kill the process sid,serial#

Alter system kill session'210,11562'

The above is how to analyze the problem of v$locked_object, $lock locking table. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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

Internet Technology

Wechat

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

12
Report