Solved

Drop all trigger in Oracle database

Posted on 2006-07-12
4
1,357 Views
Last Modified: 2008-01-09
Hi, anyone can provide met he script to drop all trigger in oracle database ? TQ
0
Comment
Question by:netcool
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
Comment Utility
run this query to generate the script for dropping all triggers for a given schema
select 'drop trigger ' || t.owner || '.' || t.trigger_name || ';' from dba_triggers where t.owner = 'schema_name';
0
 
LVL 47

Expert Comment

by:schwertner
Comment Utility
use the view  dba_triggers.
it is bad idea to drop ALL triggers.
Try to drop the triggers in an schema.

the idea is to define a cursor

select owner, triggername from dba_triggers where owner = 'SCOTT';

After that in a loop create a string

v_str := 'DROP TRIGGER ' || cursor_name.owner || '.' || cursor_name.triggername
execute immediate v_str;

I think you will learn many things if you try to do this.
But be carefull, do it on experimental instance, not on production.
0
 
LVL 3

Expert Comment

by:haidersyed
Comment Utility

--To drop all triggers other then sys and system schema

begin
for i in (select trigger_name,owner from dba_triggers where owner not in ('SYS','SYSTEM')) LOOP
execute immediate 'DROP TRIGGER '||i.owner||'.'||i.trigger_name;
END LOOP;
END;
0
 
LVL 6

Expert Comment

by:JJSmith
Comment Utility


mmmmnnnnn..........

should someone who does not know how to identify/drop triggers in a database;  be dropping all triggers in a database?

normal schemas' can own system triggers!!





0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now