oracle怎么查看當(dāng)前鎖

小億
252
2024-05-17 19:22:11
欄目: 云計(jì)算

要查看當(dāng)前數(shù)據(jù)庫中的鎖,您可以執(zhí)行以下查詢:

SELECT
  c.owner,
  c.object_name,
  c.object_type,
  b.sid,
  b.serial#,
  b.status,
  b.osuser,
  b.machine
FROM
  v$locked_object a,
  v$session b,
  dba_objects c
WHERE
  b.sid = a.session_id
  AND a.object_id = c.object_id;

這條查詢會(huì)返回當(dāng)前數(shù)據(jù)庫中所有被鎖定的對(duì)象和相關(guān)的會(huì)話信息,包括會(huì)話ID、會(huì)話狀態(tài)、操作系統(tǒng)用戶、機(jī)器名等等。

0