query to see how many trigger disabled
select count(*)from dba_triggerswhere status = 'DISABLED' and owner !='SYS';
run this script as trig.sql as sysdba
--------------------------------------------------
set serveroutput on size 1000000set verify offset serveroutput on
DECLAREsql_cmd varchar2(1024);
cursor cur_record isselect distinct OWNER,TRIGGER_NAMEfrom dba_triggerswhere status = 'DISABLED' and owner!='SYS';
trig_rec cur_record%ROWTYPE;
BEGINDBMS_OUTPUT.PUT_LINE('START OF PROGRAM');
FOR trig_rec IN cur_record LOOP
BEGINsql_cmd := 'alter trigger 'trig_rec.owner'."'trig_rec.trigger_name'" enable ';
EXECUTE IMMEDIATE sql_cmd;
DBMS_OUTPUT.PUT_LINE('Enabled : 'trig_rec.owner'.'trig_rec.trigger_name);
EXCEPTION WHEN others THENdbms_output.put_line('Error : 'trig_rec.owner'.'trig_rec.trigger_name);dbms_output.put_line(SQLERRM);END;
END LOOP;
DBMS_OUTPUT.PUT_LINE('END OF PROGRAM');
END;
/
------------------------------------------------------------------------------
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment