ORA-13786 missing SQL text of statement object %s for tuning task %s

While implementing one sql tuning advice from OEM came across following error:

ORA-13786 missing SQL text of statement object %s for tuning task %s" when Accepting a SQL Profile for a Parallel Execution Plan

In order to identify exact error, query the view dba_advisor_rationale

SQL> select message from dba_advisor_rationale where object_id=<object number from error>;

MESSAGE

--------------------------------------------

This attribute enables parallel execution.

The message clearly states it's sql plan enables the parallel execution of query which needs extra attribute in the statement to proceed.

In order to re-produce the error on the database run the following commands:

EXEC dbms_sqltune.accept_sql_profile(task_name => 'SYS_AUTO_SQL_TUNING_EXAMPLE', object_id => 2);

ORA-13786: missing SQL text of statement object "1" for tuning task "SYS_AUTO_SQL_TUNING_EXAMPLE"

SQL> select message from dba_advisor_rationale where object_id=2;


MESSAGE

--------------------------------------------

This attribute enables parallel execution.


In order to apply this sql profile you need to add profile_type as PX_PROFILE to the above statment.

EXEC dbms_sqltune.accept_sql_profile(task_name => 'SYS_AUTO_SQL_TUNING_EXAMPLE', object_id => 2,profile_type => DBMS_SQLTUNE.PX_PROFILE);


Above statement should serve the purpose and needed for a SQL Profile with a change to parallel execution and REGULAR_PROFILE value without a change to parallel execution.


Comments

Popular posts from this blog

How to Solve - "WAIT FOR EMON PROCESS NTFNS"

Query Regression - "OR" Transformation Oracle 19c

ORA - 12537: TNS: connection closed