清理SQL_PLAN_BASELINE的SQL语句

测试SPM忘记把参数OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES调回来了 产生了N多baseline。

动手写了的sql

declare
     v_sql_handle dba_sql_plan_baselines.sql_handle%type;
     v_plan_name dba_sql_plan_baselines.plan_name%type;
     v_pls number;
begin
for d in (select * from dba_sql_plan_baselines) loop
     v_sql_handle:=d.sql_handle;
     v_plan_name:=d.plan_name;
     v_pls:=dbms_spm.drop_sql_plan_baseline(v_sql_handle,v_plan_name);
end loop;
end;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>