Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Disable\Enable Constraints and Triggers for a Schema

Posted on 2008-06-13
1
Medium Priority
?
956 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 375 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

618 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