Solved

Deleting rows

Posted on 2011-02-22
4
353 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 167 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 333 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 333 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

730 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