Home » RDBMS Server » Server Administration » unlock the records
unlock the records [message #64332] Wed, 12 January 2005 22:06 Go to next message
omprakash
Messages: 11
Registered: January 2005
Junior Member
Hi,

I want to the delete the few records from table, but unfortunately the record has been locked.

Please suggest me how to unlock the record

regards
omprakash
Re: unlock the records [message #64334 is a reply to message #64332] Wed, 12 January 2005 23:00 Go to previous message
Frank Naude
Messages: 4580
Registered: April 1998
Senior Member
Hi,

You need to wait until those records are unlocked, or kill the users that are locking them.

To wait:
SELECT * FROM emp FOR UPDATE WAIT 120;


Identify sessions to kill:
SQL> select /*+ ordered */ s.sid, s.serial#,
  2         nvl(s.username, 'SYS') username,
  3         nvl(s.terminal, 'None') terminal,
  4         U.NAME||'.'||T.NAME tab,
  5         decode(L.LMODE,1,'No Lock',
  6                  2,'Row Share',
  7                  3,'Row Exclusive',
  8                  4,'Share',
  9                  5,'Share Row Exclusive',
 10                  6,'Exclusive', null) lmode,
 11         decode(L.REQUEST,1,'No Lock',
 12                  2,'Row Share',
 13                  3,'Row Exclusive',
 14                  4,'Share',
 15                  5,'Share Row Exclusive',
 16                  6,'Exclusive', 'None') request
 17  from  SYS.V_$LOCK L,
 18        SYS.V_$SESSION S,
 19        SYS.USER$ U,
 20        SYS.OBJ$ T
 21  where L.SID   = S.SID
 22    and T.OBJ#  = decode(L.ID2,0,L.ID1,L.ID2)
 23    and U.USER# = T.OWNER#
 24    and U.NAME  = 'SCOTT'
 25    and T.NAME  = 'EMP'
 26  order by 1,2,5
 27  /

 SID SERIAL# Username                       Term
---- ------- ------------------------------ ------------------------------
Table Name                                    Lock Held
--------------------------------------------- --------------------
Lock Requested
--------------------
 155      24 SCOTT                          pts/7
SCOTT.EMP                                     Row Share
None


Kill:
SQL> ALTER SYSTEM KILL SESSION '155,22';


Best regards.

Frank
Previous Topic: How to check when the tablespace came online/offline
Next Topic: Rollback seg
Goto Forum:
  


Current Time: Fri Sep 27 04:28:14 CDT 2024