Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Why we should use bind variables when we write code......

Re: Why we should use bind variables when we write code......

From: Dennis Williams <oracledba.williams_at_gmail.com>
Date: Tue, 19 Sep 2006 18:24:41 -0500
Message-ID: <de807caa0609191624w547c1bbau93aa47cdbec56a48@mail.gmail.com>


Mark,

Basically Oracle "tries" to share SQL statements all the time. So when it gets a new SQL statement, it first creates a checksum and compares that checksum with each of the SQL statements in the buffer to try to find a match, an exercise in futility with non-binding code. Here is what I did when I encountered your problem a few years ago, maybe others have better suggestions:

  1. Reduce SHARED_POOL as a quick fix. This means it has fewer statements to attempt to compare with.
  2. Scan V$SQL for the worst offenders. You'll see the same SQL statements appear in the thousands, with just changed variables. Use some clever SQL queries to pinpoint the worst of the worst.
  3. Take the worst SQL statements and match them with the application. Then beg the developers to locate the place where those SQL statements are generated and change them to use bind variables.

That should get you past the crisis. Then you can work the larger issue of training all the developers.

Dennis Williams

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Sep 19 2006 - 18:24:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US