Ask the Expert

Unique constraint violations, "parent key not found" errors

Hi Brian, I exported a schema from a production database and tried to import to the same schema in the test database. The import completed with lots of unique constraint violation and "parent key not found" error messages. How to fix it? Do I need to disable all the constraints before importing the data? By the way, no triggers got imported. Thank you.

    Requires Free Membership to View

If the tables already exist in your test database, then you may have to disable the constraints before importing the data. Normally, I drop the objects before importing them anew in a test environment. The quickest way to accomplish that is to drop the schema owner and re-create it.

You should not get constraint violations if the tables do not exist because the constraints will not be created until after the data has been imported.

This was first published in August 2007

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: