• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

JDBC, Oracle 11, and database locking

 
Ranch Hand
Posts: 1408
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic