Subject Re: [firebird-support] How to repair a database with damaged index
Author Carsten Schäfer
It worked.
After deleting the index i have identified the duplicate primary key and
deleted it.
But how can this happen ?
I always thought this is impossible.

mfg
Carsten

Svein Erling Tysvaer schrieb:
> First of all, don't trust a word of what I write, I've never fixed a
> broken Firebird database.
>
> I cannot explain what happened to you, but you seem to have a problem
> with duplicate primary keys.
>
> I would have ascertained that no-one was connected to the database in
> any way (a simple way to check this should be to try to rename the
> database file), then do a filecopy in case things got more corrupted
> while trying to fix the problem.
>
> For fixing the problem, I'd simply try to remove the primary key
> constraint, fix the duplicate record and recreate the primary key. Maybe
> your problem is a simple as that, if not cry for more help and if it is
> serious enough, then sooner or later the mother of Firebird, Ann
> Harrison, will come to your rescue or direct you to ibsurgeon.
>
> Set
>
> Carsten Schäfer wrote:
>
>> When i do this query on the damaged database i get no result !
>> When i do this query on the database after the aborted restore i find
>> the duplicate primary key.
>> Can someone explain this to me ?
>> But what is the next step ?
>> I thought i have to repair the original database and not the aborted
>> restore ?
>>
>> mfg
>> Carsten
>>
>> Svein Erling Tysvaer schrieb:
>>
>>> Maybe something like
>>>
>>> select pk_field, count(*)
>>> from table
>>> group by pk_field
>>> having count(*) > 1
>>>
>>> to identify the duplicate records to remove/modify before recreating the
>>> key?
>>>
>>> Set
>>>
>>> Carsten Schäfer wrote:
>>>
>>>
>>>> Hi,
>>>> I'm using Firebid 1.5.3 on Win XP.
>>>> I have a damaged database
>>>> When i do a backup and restore of this database i get the follwing error
>>>> in ibexpert:
>>>> IBE: Unsuccessful execution caused by system error that does not
>>>> preclude successful execution of subsequent statements.
>>>> action cancelled by trigger (2) to preserve data integrity.
>>>> Cannot deactivate index used by an integrity constraint.
>>>>
>>>> This happens when creating a primary key index.
>>>> When i do restore with deactivating indexes the restore gives no error.
>>>>
>>>> But what are the next steps to repair the database ?
>>>>
>>>> mfg
>>>> Carsten
>>>>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>