Subject | I miss an option to reactivate indexes in gbak |
---|---|
Author | Pierre Y. |
Post date | 2006-02-15T21:50:23Z |
Hello world,
Consider a corrupted database where gfix -validate -full report errors
on index pages and database pages :
gbak -b : works nice
gbak -c : fails because it cannot reactivate index RDB$PRIMARY1 due to
duplicate primary key values or "NULLS"
this kind of requests fails too :
select pk_field1, pk_field2, count(*) from thetable
group by pk_field1, pk_field2
having count(*) > 1
it returns "0".
In the firebird log errors are reported. Values are missing in
RDB$PRIMARY1 index, that's why above select resultset is empty.
One solution is to kill relations, kill the primary key, run the select,
delete duplicates, restore primary key, restore relations... not so easy.
The second is to gbak -c -i, index are created but not activated.
gbak -c -i succeeds.
select ... having count(*) > 1 succeeds
delete from (using rdb$db_key because primary key values are duplicates
?) succeeds
Now... how do i reactivate indexes ? All indexes... in the right order ?
I had a dream : on my index-deactivated database i run a gbak -b, then a
gbak -c --godblessthefirebirdcoreteam and, surprise, all indexes has
been reactivated ;-)
Instead I had to dive into rdb$indexes to reactivate all primary key,
foreign key, unique constraint indexes, and other non unique indexes by
hand.
Important note : Firebird 1.5.3 CRASHES if you try to reactivate a
foreign key index prior to reactivate the corresponding foreign table
primary key index.
Can't gbak include an option to force primary key and foreign key
indexes, at least, to be reactivated ?
Best regards
--
Pierre Y. KeyID : 0x7890CFE9
Consider a corrupted database where gfix -validate -full report errors
on index pages and database pages :
gbak -b : works nice
gbak -c : fails because it cannot reactivate index RDB$PRIMARY1 due to
duplicate primary key values or "NULLS"
this kind of requests fails too :
select pk_field1, pk_field2, count(*) from thetable
group by pk_field1, pk_field2
having count(*) > 1
it returns "0".
In the firebird log errors are reported. Values are missing in
RDB$PRIMARY1 index, that's why above select resultset is empty.
One solution is to kill relations, kill the primary key, run the select,
delete duplicates, restore primary key, restore relations... not so easy.
The second is to gbak -c -i, index are created but not activated.
gbak -c -i succeeds.
select ... having count(*) > 1 succeeds
delete from (using rdb$db_key because primary key values are duplicates
?) succeeds
Now... how do i reactivate indexes ? All indexes... in the right order ?
I had a dream : on my index-deactivated database i run a gbak -b, then a
gbak -c --godblessthefirebirdcoreteam and, surprise, all indexes has
been reactivated ;-)
Instead I had to dive into rdb$indexes to reactivate all primary key,
foreign key, unique constraint indexes, and other non unique indexes by
hand.
Important note : Firebird 1.5.3 CRASHES if you try to reactivate a
foreign key index prior to reactivate the corresponding foreign table
primary key index.
Can't gbak include an option to force primary key and foreign key
indexes, at least, to be reactivated ?
Best regards
--
Pierre Y. KeyID : 0x7890CFE9