When trying to sync a target table involved in referential integrity, the following errors are observed:
sp_ctrl (source_servername:5438)> copy owner.tablename
copying 1 of 1 objects
copy started; job id 106
sp_ctrl (source_servername:5438)> copy status
Job ID : 106
Host : source_servername
Started : 11-SEP-09 17:42:43
Job Type : Copy
Status : Failed - Internal error occurred on target. See sync_clt_106 log file for details
# more sync_svr_106_SID1_source_servername_p22065.log
.
.
22065 11/17:43:03 ERROR:SyncProcess:3: The Process already exited!
22065 11/17:43:03 INFO:SyncExportThread:3: Export process returned status: 0
22065 11/17:43:03 WARNING:SyncMessager:0: Export thread 3 completed successfully
22065 11/17:43:04 ERROR:SyncMessager:0: An error occurred in the import thread
22065 11/17:43:04 INFO:SyncMessager:0: Abort remaining threads
22065 11/17:43:04 INFO:SyncMessager:0: Waiting for threads to finish
22065 11/17:43:04 ERROR:SyncApplication:0: Error processing SYNC at sync/svr/sync_server.cpp:125
.
# more sync_clt_106_SID1_source_servername_p26686.log
.
.
26686 11/17:43:03 ERROR:SyncProcess:1: The Process already exited!
26686 11/17:43:04 INFO:SyncMessager:0: Import thread 1 completed successfully
26686 11/17:43:04 ERROR:SyncOCIQuery:0: ORA-2298: ORA-02298: cannot validate (OWNER.NUM_COL_FK) - parent keys not found
at sync/oci/sync_ociquery.cpp:152
26686 11/17:43:04 ERROR:SyncFKHandler:0: Failed to enable FK constraint for table \OWNER\.\TABLENAME\ at sync/clt/sync_fk_handler.cpp:190
26686 11/17:43:04 ERROR:main:0: Failed altering contraints at sync/clt/sync_fk_handler.cpp:161
.
When trying to sync the child table, the copy fails as the sync process would create an orphaned row in child table.
The correct way to handle it would be to disable referential integrity constraints on the target tables and run copy for both parent and child tables separately. The constraint can then be re-enabled. The Shareplex Reference Guide recommends this as well.
The following describes the ORA02298:
Error:ORA-02298: cannot enable name - parent keys not found
Cause:You tried to execute an ALTER TABLE ENABLE CONSTRAINT command, but it failed because your table has orphaned child records in it.
Action:The options to resolve this Oracle error are:
1.Remove the orphaned child records from the child table (foreign key relationship), and then re-execute the ALTER TABLE ENABLE CONSTRAINT command.
2.Create the missing parent records in the parent table (foreign key relationship), and then re-execute the ALTER TABLE ENABLE CONSTRAINT command.
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy