• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to find oracle table is locked or not

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ppl. I have a big doubt, can anyone tell me how to find the oracle table is locked or not? and if some client is already locked the table using 'select for update' clause, what could be the solution to release the lock or to avoid lock.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Shaffic!

I've moved your question to our Oracle forum, as it is much better suited for it than the general JDBC forum.

There are several performance and administration views that will allow you to find out details of the active locks. They are all documented here. It's a dense read, though. You might want to start with V$LOCK or DBA_LOCK (use index in that document). However, you need powerful privileges to access these views, which you probably won't be granted by a database administrator in production environments.

Also note that SELECT FOR UPDATE lock, or any other DML lock, only block writers, not readers. Consequently readers "avoid" these locks automatically and are never blocked (unlike some other databases where isolation level has to be adjusted to have readers avoid write-locks). There is no way for writers to avoid these locks.

To release the lock the transaction that holds it must be ended; if it is not ended by the process that holds it, the only other possibility I know of is to have a DBA kill the session that holds the lock.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic