?
Solved

Deleting rows

Posted on 2011-02-22
4
Medium Priority
?
355 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
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 shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

762 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