Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to disable and enable triggers for schema user 1

Status
Not open for further replies.

jasper04

Technical User
Aug 24, 2007
6
any one help me with script to disable and enable triggers for schema user. Schema user is Student

Thanks
 
Here are my triggers and their statuses:
Code:
select trigger_name,status from user_triggers;

TRIGGER_NAME                   STATUS
------------------------------ --------
FILIPE_EMAIL_CHECK             ENABLED
INSERT_CH1                     ENABLED
MYEEPULSE_TRIGGER3             ENABLED
MYEEPULSE_TRIGGER4             ENABLED
TREVOR_SEQ_GEN                 ENABLED
TRGTST                         ENABLED
TRG_RO_TEST                    ENABLED
UPDATE_CH1_VIEW                ENABLED

8 rows selected.
To disable a user's triggers:
Code:
begin
    for x in (select trigger_name trig from user_triggers order by trig) loop
        execute immediate 'alter trigger '||x.trig||' disable';
    end loop;
end;
/

PL/SQL procedure successfully completed.
Here is the confirmation that the above code disabled my triggers:
Code:
select trigger_name,status from user_triggers;

TRIGGER_NAME                   STATUS
------------------------------ --------
FILIPE_EMAIL_CHECK             DISABLED
INSERT_CH1                     DISABLED
MYEEPULSE_TRIGGER3             DISABLED
MYEEPULSE_TRIGGER4             DISABLED
TREVOR_SEQ_GEN                 DISABLED
TRGTST                         DISABLED
TRG_RO_TEST                    DISABLED
UPDATE_CH1_VIEW                DISABLED

8 rows selected.
To enable a user's triggers:
Code:
begin
    for x in (select trigger_name trig from user_triggers order by trig) loop
        execute immediate 'alter trigger '||x.trig||' enable';
    end loop;
end;
/
Here is the confirmation that the triggers are re-enabled:
Code:
select trigger_name,status from user_triggers;

TRIGGER_NAME                   STATUS
------------------------------ -------
FILIPE_EMAIL_CHECK             ENABLED
INSERT_CH1                     ENABLED
MYEEPULSE_TRIGGER3             ENABLED
MYEEPULSE_TRIGGER4             ENABLED
TREVOR_SEQ_GEN                 ENABLED
TRGTST                         ENABLED
TRG_RO_TEST                    ENABLED
UPDATE_CH1_VIEW                ENABLED

8 rows selected.
Let us know if this does what you requested.

PL/SQL procedure successfully completed.[/code]

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Thanks Santha for your input you are the mann!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top