• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC, Oracle 11, and database locking

 
Frank Silbermann
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.
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • 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.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic