Add new comment

"There was a problem creating a SQL tuning task. ORA-13780: SQL statement does not exist. ORA-06512"

I recently got this error while trying to run a SQL Tuning Task against a SQL statement that was available in AWR but not currently in the library cache.
I got around it by locating the SQL in OEM and using SQL Worksheet to execute it:

  • Go to the Performance Tab for your database.
  • Select the Search SQL link.
  • Check the "AWR Snapshots time Period" and select ALL from the dropdown.
  • Enter identifying information for your SQL statement.
  • Click Search.
  • Select the AWR snapshots tab.
  • Select the SQL ID of the statement you are interested in.
  • You are now at the SQL Details screen which shows the Statistics/Activity/Plan/Plan Control/Tuning History/SQL Monitoring tabs.
  • Click SQL Worksheet in the bottom right.
  • A SQL Worksheet window will be presented with your SQL Statement already loaded.
  • Click the Execute button.

Now your statement has been executed and has at least 1 execution plan available in the library cache. Now you can run SQL Tuning advisor on it and review its results. I have also read that you may be able to run SQL Tuning advisor if you can get the statement added to a SQL Tuning Set. I have not tried this yet but will report back if I can give it a shot.