Monday, May 15, 2017

oracle db table lock

in oracle db, some time we need lock a table for long time db update, here is the command
lock table table_name in exclusive mode;

after update, we need commit or rollbak to release the lock

other application can use following code to check the lock

SELECT
    B.Owner,
    B.Object_Name,
    A.*
FROM
    V$Locked_Object A,
    All_Objects B
WHERE
    A.Object_ID = B.Object_ID and A.OBJECT_ID=1211103;

object_id is the table's object_id in table all_objects

No comments:

Post a Comment