oracle禁用和启用所有触发器

直接执行下面脚本便可禁用所有触发器(触发器暂时失效)。将disable改为enable为启用(触发器恢复)


declare
  v_sql        varchar2(100);
  v_table_name varchar2(100);
  v_ref        sys_refcursor;
begin
  for v_ref in (select object_name from user_objects where object_type = 'TRIGGER') loop
    v_sql := 'alter trigger ' || v_ref.object_name || ' disable';  --将disable改为enable为启用
  
    execute immediate v_sql;
    dbms_output.put_line(v_sql);
  end loop;

exception
  when others then
    dbms_output.put_line(SQLCODE || ' ' || SQLERRM);
end;

 

你可能感兴趣的:(oracle)