Solved

Deleting rows

Posted on 2011-02-22
4
350 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

831 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