Skip to Main Content
  • Questions
  • ORA-30927: Unable to complete execution due to failure in temporary table transformation - When using WITH + UNION

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Adam.

Asked: January 26, 2017 - 6:23 pm UTC

Last updated: January 30, 2017 - 7:53 pm UTC

Version: 11g Enterprise Edition Release 11.2.0.3.0 - 64bit

Viewed 1000+ times

You Asked

Basically when I run the below query or any like it (actually pulling data) I am getting the ORA-30927 error, I can run this query without the UNION and it will not give this error, however trying to run multiple SELECT with UNION (in order to display different data results from the same 'master' select ) results in this error. We were recently running on a different DB Server for the same instance, there are 6 servers for this DB and on the previous server this was never an issue and this error was never appearing for these types of queries, however now on a different server we are having these errors and in general very low performance. I engaged a DBA however they only proceeded to tell me what the error was doing ( which I already knew ) without explaining a root cause as to why it is happening on this server but not the other, what could be causing this behavior / errors?

This same simple SQL Code block runs with no issues or errors within one DB Server and is similar to some actual SQL Code being used within our Dashboards in relation to structure but actually pulling DB Data. Without the proper access (eg. to run select * from v$sgastat order by pool, bytes desc; or other system queries) and my limited knowledge about Oracle SGA it seems there might be an issue within the Shared Pool within the SGA or SGA optimization all together within this other server.

Any input would be appreciated. Thank you!

Code sample below


WITH DUAL_TEST AS (

SELECT '1' "Number_Test" FROM DUAL
UNION
SELECT '2' "Number_Test" FROM DUAL
UNION
SELECT '3' "Number_Test" FROM DUAL
)

--SELECT * FROM DUAL_TEST

SELECT *
FROM DUAL_TEST
WHERE "Number_Test" = 1

UNION

SELECT *
FROM DUAL_TEST
WHERE "Number_Test" = 2

and Connor said...

That sounds like the following bug to me, or a variant of it.

Bug 14143632  ora-30927 on active data guard

 This note gives a brief overview of bug 14143632. 
 The content was last updated on: 20-DEC-2013
 Click here for details of each of the sections below.
Affects:

Product (Component) Oracle Server (Rdbms)
Range of versions believed to be affected Versions BELOW 12.1
Versions confirmed as being affected 
11.2.0.3 Bundle Patch 8 for Exadata Database
11.2.0.3 Bundle Patch 7 for Exadata Database
11.2.0.3
Platforms affected Generic (all / most platforms affected)


You'll need to log a call with Support.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Bug 14143632 ora-30927 on active data guard

Adam Jarvis, January 26, 2017 - 11:54 pm UTC

Thank you so much for the response and the helpful information, I tried looking up this bug and more information about it but haven't been able to find much yet without the need of an Oracle provider code or something. I am going to try and get our DB team to reach out to Oracle for further assistance. Thanks again! Very quick reply !!
Connor McDonald
January 27, 2017 - 12:02 am UTC

There is a patch available, and the bug is fixed in 11.2.0.4

You could also try the following as a workaround

with blah as
( select a,b,c from ...)

becomes

with blah as
( select /*+ inline */ a,b,c from ...)

to avoid the temporary table load/creation - but no guarantees, because if a query cannot be inlined, you'll still get the error.

WITH clause inline view

Adam Jarvis, January 27, 2017 - 12:41 am UTC

That work around did force it to run as incline view vs being resolved as a Temp Table, however it took almost 16 Minutes to do so however forcing the same dataset to run as incline view on the other server (where this bug seems to not exist) only took 22 Seconds. Do you know if this bug also can cause overall low performance in general? Or does something specific set it off like DNS name change / Failing over from the other server to this one that is showing issues? Thank you for the work around, that is a neat trick I did not have any idea about!
Connor McDonald
January 30, 2017 - 7:53 pm UTC

INLINE is very much a *workaround* rather than a solution, because if a query cannot be inlined, then the hint wont take effect and you'd be back to the original error.

I think your best way forward would be to upgrade to 11.2.0.4 or get a patch for the bug.