Solved

Disable\Enable Constraints and Triggers for a Schema

Posted on 2008-06-13
1
943 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
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…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

910 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

20 Experts available now in Live!

Get 1:1 Help Now