Solved

Disable\Enable Constraints and Triggers for a Schema

Posted on 2008-06-13
1
940 Views
Last Modified: 2008-06-15
Hello,

Can anyone please provide a method or script to easily Disable\Enable Constraints and Triggers for a Schema?

Thanks,

Michael4606
0
Comment
Question by:michael4606
1 Comment
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 125 total points
ID: 21781207

You actually only need to disable the foreign key (and unique key maybe) constraints.

You could code a PL/SQL procedure with dynamic SQL or do something like this:

Set Pages 0 Lin 120 Trims On Feed Off Echo Off

Spo Dis_Cons.Sql

Select 'Alter Table '||Table_Name

    ||' Disable Constraint '||Constraint_Name||';'

  From User_Constraints Where Constraint_Type In ('R', 'U');

Spo Off

@Dis_Cons

Spo Dis_Trig.Sql

Select 'Alter Trigger '||Trigger_Name||' Disable;'

  From User_Triggers;

Spo Off

@Dis_Trig

Open in new window

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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 video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

746 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

10 Experts available now in Live!

Get 1:1 Help Now