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.
USE YourDBName GO SELECT ' GO ' + Char(10) + Char(13) + 'DROP TRIGGER ' + QUOTENAME(OBJECT_SCHEMA_NAME(O. [object_id])) + '. ' + QUOTENAME(name) FROM sys. sql_modules as M INNER JOIN sys.
Use the DROP TRIGGER statement to remove a database trigger from the database. The trigger must be in your own schema or you must have the DROP ANY TRIGGER system privilege. To drop a trigger on DATABASE in another user's schema, you must also have the ADMINISTER DATABASE TRIGGER system privilege.
Use the ALTER TRIGGER statement to enable, disable, or compile a database trigger.
How many triggers can be dropped in a single command? A single SQL statement can potentially fire up to four types of triggers: BEFORE row triggers.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With