Wednesday, April 11, 2018

SQL Profile

When you run SQL Tuning Advisor, sometimes you can see findings for SQL Profile:
1- SQL Profile Finding (see explain plans section below)
--------------------------------------------------------
  A potentially better execution plan was found for this statement.


  Recommendation (estimated benefit: 99.99%)
  ------------------------------------------
  - Consider accepting the recommended SQL profile.
    execute dbms_sqltune.accept_sql_profile(task_name => 'staName61543', task_owner => 'PWRLINE', replace => TRUE);


If you run execute dbms_sqltune.accept_sql_profile(task_name => 'staName61543', task_owner => 'PWRLINE', replace => TRUE); to accept the recommended SQL Profile, you can check the result in dba_sql_profiles:
SQL> select name, status from dba_sql_profiles;

NAME                                                                                                                             STATUS
-------------------------------------------------------------------------------------------------------------------------------- --------
SYS_SQLPROF_0162b5a4ac580001                                                                                                     ENABLED

To disable the pofile:
SQL> exec DBMS_SQLTUNE.ALTER_SQL_PROFILE('SYS_SQLPROF_0162b5a4ac580001','STATUS','DISABLED');

PL/SQL procedure successfully completed.

SQL> select name, status from dba_sql_profiles;

NAME                                                                                                                             STATUS
-------------------------------------------------------------------------------------------------------------------------------- --------
SYS_SQLPROF_0162b5a4ac580001                                                                                                     DISABLED

To drop the profile:
SQL> exec dbms_sqltune.drop_sql_profile ('SYS_SQLPROF_0162b5a4ac580001');

PL/SQL procedure successfully completed.

SQL> select name, status from dba_sql_profiles;

no rows selected

No comments:

Post a Comment