How to Disable a SQL Plan from the Baseline

Use the Below command :


declare
myplan pls_integer;
begin
myplan:=DBMS_SPM.ALTER_SQL_PLAN_BASELINE (sql_handle => 'SQL_09103a73587663bb',plan_name  => 'SQL_PLAN_0k41ufdc7csxvab99b059',attribute_name => 'ENABLED',   attribute_value => 'NO');
end;
/

After the above PL/SQL block is executed, check the ENABLED column in DBA_SQL_PLAN_BASELINES View to confirm that it is disabled. (Should be set to 'NO');

This change will prevent the optimizer from picking this plan. (The effect is same as "ACCEPTED=NO').

1 comment:

  1. Hello
    Thank you it worked fine with ENABLED => NO
    But not with ACCEPTED
    We get the error : ORA-38136: invalid attribute name ACCEPTED specified

    ReplyDelete