Confluence Upgrade Fails with ORA-02298 Parent Keys Not Found

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

When replicating or restoring Oracle database backup created using datapump, you receive foreign key constraint errors. The following appears in the atlassian-confluence.log:

1 2 ORA-39083: Object type REF_CONSTRAINT failed to create with error: ORA-02298: cannot validate (WIKI_357.FKA898D4778DD41734) - parent keys not found

Cause

This is usually caused by taking a database backup using datapump utility while the database is active, also known as a "hot dump".

Workaround

The specific entries causing the error to be thrown will be included in the logs.

The datapump file can be cleaned up using the following queries:

1 2 select <COLUMN_NAME> from <CHILD_TABLE> a where not exists (select <COLUMN_NAME> from <PARENT_TABLE> where primary_key = a.<KEY_VALUE>);

This will show you the row (or rows) that exist in the child table but don't exist in the parent table. Once you have either (1)added rows to the parent table to match the child rows, or (2) removed the child rows that don't have parents, run the import again, preferably in a development environment.

Resolution

  1. If possible, create the database dump while the database is not active.

  2. There are also some features in Oracle datapump that will allow you to avoid this kind of trouble when importing/exporting. Two specifically are FLASHBACK_TIME & FLASHBACK_SCN, which may be used to alleviate these problems in the future.

  3. If it's not possible to complete step 1, use the query in the Workaround section to clean up database foreign key constraint errors.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.