I received an error during a restore process today, where multiple FKs could 
not be restored.  The restore log messages look like this:

 

gbak:cannot commit index FK_ZIP_CODE_ACCT_TO_ACCOUNT

gbak: ERROR:violation of FOREIGN KEY constraint "FK_ZIP_CODE_ACCT_TO_ACCOUNT" 
on table "ZIP_CODE_ACCOUNT"

gbak: ERROR:    Foreign key reference target does not exist

 

gbak:cannot commit index FK_TRANSFER_TO_ACCOUNT

gbak: ERROR:violation of FOREIGN KEY constraint "FK_TRANSFER_TO_ACCOUNT" on 
table "TRANSFER"

gbak: ERROR:    Foreign key reference target does not exist

 

All told there were about 23 foreign keys which couldn’t be restored – almost 
the exact number of foreign keys pointing to the ACCOUNT table.

 

It looks to me like somehow an ACCOUNT row was deleted, breaking the FK.  I ran 
a number of queries that look like this:

 

select

   t.account_id, a.account_id

from

   zip_code_account t

   left join account a on (a.account_id = t.account_id)

 

So that I could look for any record in ZIP_CODE_ACCOUNT that did not have a 
matching record in ACCOUNT.  There were no records that matched this condition. 
 I tried it on a number of other tables as well, and could not find one 
instance where a value in table T.ACCOUNT_ID did not have a matching value in 
A.ACCOUNT_ID.

 

What would have caused this restore to fail?

 

Thank you,

 

Bob M..

Reply via email to