oracle 10g Latch waits too high

Posted on 2009-02-13
Last Modified: 2013-12-18
I am having some performance problems sporadicallly on my database.

The only indicators of problems activated by Quest Spotlight are latch waits and lock waits.

So far I have read that the real solution for this is to re-use sql code more effectively, but I need to find a solution as fast as possible. Changing the applicaion will take a lot of time and money.

Below is the line of statistics for the library cache:

Latch name      Latches      Gets/s      % gets      Sleeps/s      % sleeps      Sleep rate
library cache        54      2,887.29      27.53      1.20      100.00      0.04

Misses/s      % misses      Miss rate
1.53      88.46      0.05
Question by:jose_rijos
    LVL 73

    Expert Comment

    you can "try" to set cursor_sharing = similar or cursor_sharing = force

    these will force binding of all literals in your sql.  Even ones you don't want it to (like constants)
    however it may let you limp along  until you can get your code fixed.

    Author Comment

    thanks a lot sdstuber. I'll try that.

    Author Comment


    I issued the command alter system set cursor_sharing=force;

    Do you know if this will take effect imediately or do i have to bounce the db?

    LVL 73

    Accepted Solution

    it will take effect immediately.

    alter system flush shared_pool  to get rid of any already parsed cursors
    LVL 47

    Expert Comment

    About LATCHES on library cache additionally to above suggestion you can try to increase the shared pool size.

    About LOCKS:

    Query V$LOCK to find the sessions holding the lock. For every session waiting for the event enqueue, there is a row in V$LOCK with REQUEST <> 0. Use one of the following two queries to find the sessions holding the locks and waiting for the locks.

    If there are enqueue waits, you can see these using the following statement:

    SELECT * FROM V$LOCK WHERE request > 0;

    To show only holders and waiters for locks being waited on, use the following:

    SELECT DECODE(request,0,'Holder: ','Waiter: ') ||
              sid sess, id1, id2, lmode, request, type
       FROM V$LOCK
     WHERE (id1, id2, type) IN (SELECT id1, id2, type FROM V$LOCK WHERE request > 0)
       ORDER BY id1, request;


    Author Comment

    alter system flush shared_pool fix the problem for the moment. I also altered the cursor sharing parameter.

    For a long term solution should I look at the application, or there are other tuning options for the db regarding this particular kind of wait?

    Author Comment

    Thank you schwertner for the lock contention information?

    In regards to latch free waits, what you suggest of increasing the shared pool, I tried once to do that and couldn't put a value > 2G, got the error out of memory. My server is Linux 32 bit. Is there a way to incerase the shared pool on a 32 bit linux server beyond 2Gb?
    LVL 73

    Expert Comment

    actually, for system that does not use binds increasing your shared pool might even make it worse since you'll have more statements that you do not want to use in the pool.

    with binds, a larger pool will let you store more statements that are useful.

    yes, you should definitely look at the application.

    Author Comment

    Thanks again sdstuber. What you suggested so far have solved the problem in terms of what I could do as a dba.
    I will close this thread and will have to open another prbably to address other issues.
    Thanks again to sdstuber and schwertner.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
    Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now