RE: Query not in code, but has vaguely known WHERE condition

From: Jonathan Lewis <>
Date: Mon, 26 Jan 2015 13:23:36 +0000
Message-ID: <CE70217733273F49A8A162EE074F64D92826A27F_at_EXMBX01.thus.corp>

Have you lost some of the text in emailing it, or is it really this garbaged ? If the latter then perhaps it's appearing because it keeps failing parse (which still gets it pushed into the shared pool) and is constantly cuasing breaks and being re-issued. Pick any session that tries to execute it, and enable trace for a few minutes to see if that shows you anything showing up just before or after a call to this thing.

It won't show up in the AWR because it's always going to cause a syntax error.

Jonathan Lewis

From: [] on behalf of Martin Klier [] Sent: 26 January 2015 12:53
To: Oracle-L Freelists
Subject: Query not in code, but has vaguely known WHERE condition

Hi listers,

I found a strange SQL in our database, causing Library Cache and Cursor Sharing fun of all kinds, but no need to elaborate on that. The database is a jungle of dynamic SQL and parsing storms, so we had to enable CURSOR_SHARING=SIMILAR to work at all. No value in ranting on that.

What I need to do is, to find where it comes from, to start investigating the case.

The SQL text is like that:

WHERE a.div_id = b.div_id

AND a.entity_id = b.entity_id
AND a.attribute_id = :"SYS_B_1"
AND a.other_id = :"SYS_B_2"

We can see it being a top consumer or waiter in currently running / active sessions and ASH, but it never shows up in AWR. For sure, that's not one of ours, even when ignoring the fact that it does not make much sense for itself. All I recognise is the WHERE condition - it may match some of our MERGE ON clauses.

So my questions:

  1. How does the DB come to creating this kind of SQL text?
  2. What's the use of it, the mechanism behind?
  3. How can I find out where it is triggered?

Thank you all in advance!

Freundliche Gre / Best regards

Martin Klier
Performing Databases GmbH
Oracle ACE

-- Received on Mon Jan 26 2015 - 14:23:36 CET

Original text of this message