Home » SQL & PL/SQL » SQL & PL/SQL » Problem in locking
Problem in locking [message #293179] Fri, 11 January 2008 01:53 Go to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Guys,

Please assist me in this problem.

The lock command I am running doesn't seem to work ...can anyone tell me why

lock table t2 in exclusive mode wait 120;

I am getting error 00933 - SQL command not properly ended

- Das

Re: Problem in locking [message #293180 is a reply to message #293179] Fri, 11 January 2008 01:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:

wait 120;

This does not exist in Oracle.
Only NOWAIT option is available unless you are in 11g.

Next time, please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button to verify.
Always post your Oracle version (4 decimals).

Regards
Michel
Re: Problem in locking [message #293186 is a reply to message #293180] Fri, 11 January 2008 02:21 Go to previous messageGo to next message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Thanks for the reply

I tried this command to lock table.

sql - Practice1/practice1

select * from t2 for update
(I read that this acquires update lock over the table.

I had given the rights to SYS over this table, now when I tried to update this table from SYS

update practice1.t2 set name ='DAS' where name like 'E%' the session has hanged..

I cannot use the alter system kill session as SYS has hanged..can you tell the way to stop the lock and release my SYS session

- Das
Re: Problem in locking [message #293188 is a reply to message #293186] Fri, 11 January 2008 02:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
- Never ever use SYS but for maintenance purpose (startup, shutdown, backup, recover)
- SYS is special
- SYS is Oracle proprietary (try to open a SR/TAR starting with "i did that with SYS" and you'll see the immediate answer)
- SYS does not act like any other user
- When you use SYS Oracle deactivates some code path and activates others
- Whatever you do with SYS will neither validate nor invalidate the same thing with any other user.

NEVER EVER use SYS for anything that can be done by another user.
Use SYS ONLY for something that can't be done by someone else.


Quote:

I cannot use the alter system kill session as SYS has hanged..

rollback the first session
or
start a new session to kill one of the previous ones.

Regards
Michel
Re: Problem in locking [message #293192 is a reply to message #293188] Fri, 11 January 2008 02:53 Go to previous message
durgadas.menon
Messages: 365
Registered: December 2007
Location: Nowhere
Senior Member
Thanks a lot

The problem is resolved

- Das
Previous Topic: Logical operations
Next Topic: query help
Goto Forum:
  


Current Time: Thu Dec 08 08:08:12 CST 2016

Total time taken to generate the page: 0.20046 seconds