How to drop (remove, delete) all triggers within given DB.
Problem is that application requires DB upgrade and does not proceed triggers (suport, drop, create) after upgrade, application upgrade fails.
This will generate the command how to drop all triggers in current schema:
select 'drop trigger ' || trigger_name || ';' stmt from user_triggers;
You can create a script for dropping triggers by using the Oracle system tables, like this:
select 'drop trigger ' || owner || '.' || trigger_name || ';' from all_triggers
Note that there are 3 views containing triggers:
First Google hit for search query: Drop all triggers - Oracle
BEGIN
FOR i in (select trigger_name,owner
from dba_triggers
where trigger_name like '%_BI%' and owner = 'myTesting' ) LOOP
EXECUTE IMMEDIATE 'DROP TRIGGER '||i.owner||'.'||i.trigger_name;
END LOOP;
END;
If you really want to drop all the triggers in the database,
BEGIN
FOR i in (select trigger_name,owner
from dba_triggers ) LOOP
EXECUTE IMMEDIATE 'DROP TRIGGER '||i.owner||'.'||i.trigger_name;
END LOOP;
END;
SYS and SYSTEM triggers as well as any user-created triggers. Either the block would fail due to a lack of permissions, or the database would be left in a broken state.where owner not in ('SYS','SYSTEM')