{SQL計画管理}SQL計画ベースラインから実行計画を削除

https://docs.oracle.com/cd/F19136_01/tgsql/managing-sql-plan-baselines.html#GUID-BA19EA4E-AFEF-4677-B08F-854DE59ED932


variable n number
begin
:n := DBMS_SPM.DROP_SQL_PLAN_BASELINE (
   sql_handle     => 'SQL_a2468e835b8e4aa8');
end;
/

variable n number
begin
:n := DBMS_SPM.DROP_SQL_PLAN_BASELINE (
   plan_name     => 'SQL_PLAN_09swyck06x5skdaeb500c');
end;
/

 

SET SERVEROUTPUT ON
declare
cursor cur1 is SELECT  SQL_HANDLE FROM  DBA_SQL_PLAN_BASELINES group by SQL_HANDLE  fetch first 100 rows only;
n number;

begin
 for c1 in cur1 loop

  dbms_output.put_line(c1.SQL_HANDLE);
  n := DBMS_SPM.DROP_SQL_PLAN_BASELINE ( sql_handle     => c1.SQL_HANDLE);

 end loop;
end;
/


SELECT SQL_HANDLE, PLAN_NAME, ENABLED, ACCEPTED, FIXED ,origin, created, SQL_TEXT
FROM   DBA_SQL_PLAN_BASELINES
order by CREATED;