Subject RE: [ib-support] Duplicate value in primary index error at restore
Author Javier Castro
Hi Nick,

Thanks for answering.

>
>
> what do you have to do to get the database back online?
>
>

I have not done it myself, but the people who do it tell me it is like this:

First we do a restore without indices

gbak -R -I -C baddb.gbk baddb.gdb

Then we delete the contents of the table. Fortunately, we are able to
regenarate the contents from the contents of other tables in the database.

Next, we activate the PK indices

update rdb$indices
set rdb$index_inactive = 0
where rdb$index_inactive = 1
and rdb$index_name like 'RDB$PRIMARY%'

Then the FK indices

update rdb$indices
set rdb$index_inactive = 0
where rdb$index_inactive = 1
and rdb$index_name like 'RDB$FOREIGN%'

Then the rest of the indices

update rdb$indices
set rdb$index_inactive = 0
where rdb$index_inactive = 1
and rdb$index_name not like 'RDB$FOREIGN%' and
rdb$index_name not like 'RDB$PRIMARY%'

Next we do a full backup and restore cycle.

Last we recreate lost metadata (procedures, triggers and views) from
scripts.

Regards,

Javier Castro
El Priorato Marin, S.L.
priorato@...