die Seilerwerks

Chronicling Life, Love, Linux and Oracle database administration.

v$sql_bind_capture Not Quite Capturing SQL Binds

with 7 comments

A week or so ago, I was working with a developer to find out why a SQL statement he was sending would sometimes work and sometimes return an invalid DATE format error. Part of the troubleshooting led us to examine the actual bind values being received by the server, just to make sure it was the same as being sent. I thought I was onto something when I saw that the fields of TIMESTAMP datatype actually were NULL:

SQL> select name, datatype_string, value_string
from v$sql_bind_capture
where sql_id='0wp5c2a3z82jr'
SQL> /

NAME DATATYPE_STRING VALUE_STRING
---- --------------- ------------
:1   TIMESTAMP       {NULL}
:2   VARCHAR2(32)    3WC
:3   VARCHAR2(32)    001
:4   TIMESTAMP       {NULL}
:5   NUMBER          8429721
:6   NUMBER          206

6 rows selected.

Unfortunately it was like this when the query both failed and succeeded. I banged my head against the wall for 30 more minutes before concluding that it must be a bug. Metalink agreed, and Note 444551.1 details the bug, which is not yet fixed and “should be fixed in 11.2,” affecting versions 9.2 to 11.1. Seems kind of long for something like this to still be out in the open, and it’s very annoying when you really want to see the value of a TIMESTAMP bind variable.

Written by Don Seiler

January 29, 2008 at 4:09 pm

Posted in oracle

Tagged with , ,

7 Responses

Subscribe to comments with RSS.

  1. Don,
    try this workaround:

    select name, position, datatype_string, was_captured, value_string,
    anydata.accesstimestamp(value_anydata) from v$sql_bind_capture where sql_id = …..

    rgds

    ghassan

    January 30, 2008 at 2:55 pm

  2. [...] Don Seiler found a bug with v$sql_bind_capture. [...]

  3. [...] di tipo date della insert non comparivano, mentre per le altre si. Mi vi è venuto quindi in mente un post di Don Seiler, in cui pare l’autore spiega come si trovasse ad analizzare un problema non molto diverso dal [...]

  4. Hi Don,
    it seems that same bug involves also trace of event 10046. If you enable session tracing (for example with dbms_monitor.session_trace_enable) than in tracefile bind variable values for timestamps are absent. That is also more annoying.

    cristiancudizio

    February 7, 2008 at 6:08 am

  5. Hi,
    I have been working on an Oracle DBA/Sysadmin Dashboard. What do you think are the key ingredients of a DBA dashboard?

    Your opinion is highly regarded
    Regards
    Nilesh
    Dashboards

    Dashboards

    February 12, 2008 at 7:33 pm

  6. Don,

    Here’s a link to the solution for syntax highlighting in WordPress.

    Tyler

    Tyler Muth

    February 22, 2008 at 10:18 am

  7. Thanks Tyler!

    Don Seiler

    February 22, 2008 at 3:44 pm


Leave a Reply