• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JDBC, Oracle 11, and database locking

 
Ranch Hand
Posts: 1408
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to write a program that:

(1) Joins a few huge tables (and also maybe a few small static configuration tables), producing a VERY LARGE result set, and
(2) Iterates through the result set to write an extract file.

These tables are used intensively by thousands of users for online transaction processing.
However, the rows I am selecting are no longer being actively updated.

I know how to use JDBC to select my data and to iterate through the result set.

Is there anything special I need to do to ensure that the tables themselves are not being locked while the program is run -- that my program does not interfere with ongoing transaction processing of the more current routes?

Or is this automatically taken care of by the design of Oracle's locking mechanisms.
 
Bartender
Posts: 598
26
Oracle Notepad Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Frank Silbermann wrote:Is there anything special I need to do to ensure that the tables themselves are not being locked while the program is run


No. SELECT does not acquire locks (unless it's a SELECT...FOR UPDATE). And even if it did, it would would be row level locks, not table locks, so on unused records, it wouldn't be an issue anyway. Furthermore, locks don't always block reads, and the data would be read from the redo segment. Based on your explanation, i can't imagine there being an issue.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Frank Silbermann wrote:Is there anything special I need to do to ensure that the tables themselves are not being locked while the program is run -- that my program does not interfere with ongoing transaction processing of the more current routes?

Or is this automatically taken care of by the design of Oracle's locking mechanisms.


I agree with Brian! A SELECT will not require any locks (unless you are using the FOR UPDATE clause). I have written a gazillion SELECT statements and never had to worry about any locking issues.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic