Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Oracle locking strategies

Oracle Database Tips by Donald BurlesonNovember 9, 2015

 

Question:  I have a large application that will be doing large updates and I want to know the ways that you can lock rows and ensure integrity.  There are other approaches to setting exclusive locks on rows, and I want to understand the best practices for Oracle table locking.

 

Answer:  There are three main approaches used, each with its own advantages and disadvantages:

  • select for update - This holds an exclusive lock on the target row and is 100% reliable.  The downside is with disconnected session which may require DBA intervention to release the locks.  In general, the "select for update" is not used in web-based systems, or on applications with unreliable network connectivity.
     

  • Re-read - One common method is to write the application to re-read the rows before updating, and notify the end-user that the row has changed since it was first displayed on their screen.  With this approach, it's important to track changes to everything that is displayed to the end-user, not just the updated item.  This is because a non-updated screen item may have influenced the update value.
     

  • Date-time stamp - Another approach is to tag all rows with a last_updated_date column (of the date datatype).  At screen map-out time, the sysdate is stored within the application (i.e. a variable named map_out_time).  At update time, the application re-reads the row and compares the value of the last_updated_date column to the map_out_time value.

Oracle locking notes

See my related notes on Oracle locking and lock strategies:

 

If you like Oracle tuning, you might enjoy my book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.