?
Solved

Deleting rows

Posted on 2011-02-22
4
Medium Priority
?
356 Views
Last Modified: 2012-05-11
If I disable the FK constraints and then delete rows from the parent table, will I be able to enable the FK constraints again or will the referential integrity be disrupted and I will not be able to enable the FK constraints?
0
Comment
Question by:msimons4
[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
  • 2
4 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 668 total points
ID: 34951486
the FK's cannot be enabled if the referenced parent records are deleted
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1332 total points
ID: 34951595
You've asked a lot of questions recently on this topic.

What are you really after?  If you can provide us with the 'big picture' maybe we can save you asking a lot of similar questions.

On topic:  Do not disable constraints on a live database.
0
 

Author Comment

by:msimons4
ID: 34951688
Trying to get producting 300G down to a reasonable size for the developers laptops. A lot of tables need to have rows deleted based on date and other tables need to be truncated? The FK don't have on delete cascade.
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1332 total points
ID: 34951731
Instead of deleting down, why not create an 'empty' database and a 'test baseline' by selecting/inserting known rows.

Use exp with no rows to create the empty database.

If the constraints are set up properly you might be able to get by with an exp/imp with a QUERY clause and do it all at once.  Once you have this baseline export complete, just keep reusing it.

Short of that:  Just delete the children first, then the parents.

For what it's worth, I have a baseline export DMP file that I use to reload ALL my test/dev databases.  It makes life very easy when I need to refresh/reset a dev/test instance.

It's 100% known data.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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…
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…
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.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

650 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