Steps to delete SQL_PLAN_BASELIN in oracle 11g
SQL> select SQL_HANDLE,SQL_TEXT,PLAN_NAME,CREATOR,CREATED,LAST_MODIFIED,LAST_EXECUTED,LAST_VERIFIED,ENABLED,ACCEPTED,OPTIMIZER_COST MODULE,ACTION from dba_sql_plan_baselines;
SQL_HANDLE SQL_TEXT PLAN_NAME CREATOR CREATED LAST_MODIFIED LAST_EXECUTED LAST_VERIFIED ENA ACC MODULE ACTION
------------------------------ -------------------------------------------------------------------------------- ------------------------------ ------------------------------ --------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- --- --- ---------- ----------------------------------------------------------------
SQL_c595019517ca2fba WITH SUBQRY (REGIONID,TERRITORYID,LANGUAGEID,MEDIAID) AS (SELECT /*+ index(y X SQL_PLAN_cb581knbwnbxu5537e8e9 SYS 18-JUN-15 12.22.00.000000 PM 18-JUN-15 12.22.00.000000 PM 18-JUN-15 01.11.49.000000 PM YES YES 63
IE
SQL> set serveroutput on
SQL> declare
2 ret_value pls_integer;
3 sql_handle_in varchar2(30);
4 cursor c1 is
5 select sql_handle from dba_sql_plan_baselines
6 where sql_text like 'WITH SUBQRY (REGIONID,TERRITORYID,LANGUAGEID,MEDIAID) AS %' ;
7 begin
8 open c1 ;
9 loop
10 fetch c1 into sql_handle_in;
11 exit when c1%notfound;
12 ret_value := dbms_spm.drop_sql_plan_baseline(sql_handle=>sql_handle_in,plan_name=>NULL);
13 dbms_output.put_line(ret_value);
14 end loop;
15 end;
16 /
1
PL/SQL procedure successfully completed.
SQL> select SQL_HANDLE,SQL_TEXT,PLAN_NAME,CREATOR,CREATED,LAST_MODIFIED,LAST_EXECUTED,LAST_VERIFIED,ENABLED,ACCEPTED,OPTIMIZER_COST MODULE,ACTION from dba_sql_plan_baselines;
no rows selected
SQL>
SQL> select SQL_HANDLE,SQL_TEXT,PLAN_NAME,CREATOR,CREATED,LAST_MODIFIED,LAST_EXECUTED,LAST_VERIFIED,ENABLED,ACCEPTED,OPTIMIZER_COST MODULE,ACTION from dba_sql_plan_baselines;
SQL_HANDLE SQL_TEXT PLAN_NAME CREATOR CREATED LAST_MODIFIED LAST_EXECUTED LAST_VERIFIED ENA ACC MODULE ACTION
------------------------------ -------------------------------------------------------------------------------- ------------------------------ ------------------------------ --------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- --- --- ---------- ----------------------------------------------------------------
SQL_c595019517ca2fba WITH SUBQRY (REGIONID,TERRITORYID,LANGUAGEID,MEDIAID) AS (SELECT /*+ index(y X SQL_PLAN_cb581knbwnbxu5537e8e9 SYS 18-JUN-15 12.22.00.000000 PM 18-JUN-15 12.22.00.000000 PM 18-JUN-15 01.11.49.000000 PM YES YES 63
IE
SQL> set serveroutput on
SQL> declare
2 ret_value pls_integer;
3 sql_handle_in varchar2(30);
4 cursor c1 is
5 select sql_handle from dba_sql_plan_baselines
6 where sql_text like 'WITH SUBQRY (REGIONID,TERRITORYID,LANGUAGEID,MEDIAID) AS %' ;
7 begin
8 open c1 ;
9 loop
10 fetch c1 into sql_handle_in;
11 exit when c1%notfound;
12 ret_value := dbms_spm.drop_sql_plan_baseline(sql_handle=>sql_handle_in,plan_name=>NULL);
13 dbms_output.put_line(ret_value);
14 end loop;
15 end;
16 /
1
PL/SQL procedure successfully completed.
SQL> select SQL_HANDLE,SQL_TEXT,PLAN_NAME,CREATOR,CREATED,LAST_MODIFIED,LAST_EXECUTED,LAST_VERIFIED,ENABLED,ACCEPTED,OPTIMIZER_COST MODULE,ACTION from dba_sql_plan_baselines;
no rows selected
SQL>