Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Oracle Database 11gR2 Performance Tuning Cookbook

You're reading from  Oracle Database 11gR2 Performance Tuning Cookbook

Product type Book
Published in Jan 2012
Publisher Packt
ISBN-13 9781849682602
Pages 542 pages
Edition 1st Edition
Languages
Author (1):
Ciro Fiorillo Ciro Fiorillo
Profile icon Ciro Fiorillo

Table of Contents (21) Chapters

Oracle Database 11gR2 Performance Tuning Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Starting with Performance Tuning Optimizing Application Design Optimizing Storage Structures Optimizing SQL Code Optimizing Sort Operations Optimizing PL/SQL Code Improving the Oracle Optimizer Other Optimizations Tuning Memory Tuning I/O Tuning Contention Dynamic Performance Views A Summary of Oracle Packages Used for Performance Tuning Index

Detecting and preventing lock contention


If databases were used by a single user there would be no need for locks, because other users are not accessing the same data at the same time. In this recipe we will see how two concurrent sessions experience wait time due to locks, and how to diagnose them and what to do to resolve and avoid these situations.

Getting ready

In this recipe we use three concurrent SQL*Plus sessions to simulate two concurrent users in the first two sessions, while querying dynamic performance views in a third session. We will use the TESTDB database in the rest of this book.

How to do it...

The following steps will show how to detect and prevent lock contention:

  1. Connect SESSION1 as user SH:

    -- SESSION 1
    CONNECT sh@TESTDB/sh
    
  2. Update a row in SESSION1, not completing the transaction with a COMMIT or ROLLBACK statement:

    UPDATE CUSTOMERS SET
      CUST_FIRST_NAME = 'TEST1'
      WHERE CUST_ID = 26;
    
  3. Connect SESSION2 as user SH:

    -- SESSION 2
    CONNECT sh@TESTDB/sh
    
  4. Update the same row SESSION2...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}