Solved

Disable\Enable Constraints and Triggers for a Schema

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

821 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