SQL ScriptDisable all database triggers |
This script disables all database triggers. If you are supporting a database that uses triggers, you'll need this script if you ever attempt a database import. See also Enable triggers script.
None.
rem whenever oserror exit 1 set serveroutput on size 100000 rem whenever sqlerror exit 2 set verify off set serveroutput on ACCEPT own PROMPT 'Enter Value for Trigger Owner : ' PROMPT declare sql_stmt varchar2(1024); cursor get_trigs is select distinct table_owner, table_name from all_triggers where status = 'ENABLED' and owner = UPPER('&&own'); trig_rec get_trigs%ROWTYPE; begin FOR trig_rec IN get_trigs LOOP BEGIN sql_stmt := 'alter table '||trig_rec.table_owner ||'.'||trig_rec.table_name|| ' disable all triggers'; dbms_output.put_line(sql_stmt); EXECUTE IMMEDIATE sql_stmt; EXCEPTION WHEN others THEN dbms_output.put_line('Error Processing ' ||trig_rec.table_owner||'.'||trig_rec.table_name||' ' ); dbms_output.put_line(SQLERRM); END; END LOOP; end; / select status,count(*) from all_triggers where owner = UPPER('&&own') group by status;
Return to Index of SQL Scripts
Home
|
Company Profile
|
Services
|
Contact Us
|
SQL scripts and tips
|
Quiz
|