Hello.
I have a record which is locked, how can I unlock it?
Hello.
I have a record which is locked, how can I unlock it?
If you have access to the DB, you could use the query from below site to see which are the locked objects and you could kill the session that’s locking the object.
Finding Oracle locked objects (dba-oracle.com)
select
(select username from v$session where sid=a.sid) blocker,
a.sid,
' is blocking ',
(select username from v$session where sid=b.sid) blockee,
b.sid
from
v$lock a,
v$lock b
where
a.block = 1
and
b.request > 0
and
a.id1 = b.id1
and
a.id2 = b.id2;
select
blocking_session,
sid,
serial#,
wait_class,
seconds_in_wait
from
v$session
where
blocking_session is not NULL
order by
blocking_session
These 2 sql querries return no result :
select
blocking_session,
sid,
serial#,
wait_class,
seconds_in_wait
from
v$session
where
blocking_session is not NULL
order by
blocking_session
select *
from v$lock
where block = 1
I asked Chat GPT who asked me to use this procedure, but I dunno if it’s safe or not to use it, I didn’t even try it yet :
CREATE OR REPLACE PROCEDURE unlock_record (p_rowid IN ROWID)
IS
l_lockhandle VARCHAR2(128);
BEGIN
l_lockhandle := DBMS_LOCK.REQUEST(DBMS_LOCK.X_MODE, p_rowid, release_on_commit => TRUE);
END unlock_record;
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.