Hi all,
If in SQL 7.3 I lock a table using the folwoing command:
lock table tmp_problem_file in share mode nowait;
Then how to unlock?????
Thanks and Regards
Printable View
Hi all,
If in SQL 7.3 I lock a table using the folwoing command:
lock table tmp_problem_file in share mode nowait;
Then how to unlock?????
Thanks and Regards
By executing either COMMIT or ROLLBACK.
Hi,
Thank you very much...
However, suppose that I do COMMIT then I decide to unlock the table what should I do?
Regards
may be u can try
alter system kill session 'sid, serial#';
following query shows which table has been locked in what mode , u will get sid and serial # also from this .
----------------------------------
select nvl(S.USERNAME,'Internal') username, nvl(S.TERMINAL,'None') terminal, L.SID||','||S.SERIAL# Kill, U1.NAME||'.'||substr(T1.NAME,1,20) tab,
decode(L.LMODE,1,'No Lock', 2,'Row Share', 3,'Row Exclusive', 4,'Share', 5,'Share Row Exclusive', 6,'Exclusive',null) lmode,
decode(L.REQUEST,1,'No Lock', 2,'Row Share', 3,'Row Exclusive',4,'Share', 5,'Share Row Exclusive', 6,'Exclusive',null) request from V$LOCK L, V$SESSION S, SYS.USER$ U1, SYS.OBJ$ T1 whereL.SID = S.SID and T1.OBJ# = decode(L.ID2,0,L.ID1,L.ID2) and U1.USER# = T1.OWNER# and S.TYPE != 'BACKGROUND' order by 1,2,5
[Edited by prakashs43 on 10-02-2002 at 08:23 AM]
Once you do COMMIT all your locks are released, so the table is no longer locked. So you can't "decide to unlock the table", it is already unlocked.Quote:
Originally posted by omran
However, suppose that I do COMMIT then I decide to unlock the table what should I do?
You can never explicitely unlock the tables you have locked - it can be done only implicitly by COMMIT or ROLLBACK. There is no third way.
THANK YOU ALL FOR YOUR VALUABLE HELP!!!