在PL/SQL中,可以使用以下几种方法来查看被锁的表:
SELECT *
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'TABLE'
AND OBJECT_NAME IN (
SELECT OBJECT_NAME
FROM V$LOCKED_OBJECT
);
SELECT OBJECT_NAME, SESSION_ID, ORACLE_USERNAME
FROM V$LOCKED_OBJECT
WHERE OBJECT_TYPE = 'TABLE';
SELECT L.OBJECT_NAME, S.SID, S.SERIAL#
FROM V$LOCK L, V$SESSION S
WHERE L.SID = S.SID
AND L.TYPE = 'TM'
AND L.ID1 = (
SELECT OBJECT_ID
FROM DBA_OBJECTS
WHERE OBJECT_NAME = 'YOUR_TABLE_NAME'
AND OBJECT_TYPE = 'TABLE'
);
以上方法都可以帮助你查看被锁的表,你可以根据实际情况选择使用其中一种方法来查看。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: plsql如何快速导出大量数据