Subject | Re: help: reactivate indexes after gbak -inactive |
---|---|
Author | Adam |
Post date | 2006-04-12T11:16:12Z |
> >There are some 372 indexes in this db, counting primary and foreignIS NULL
> >keys and extra indexes.
> >the question is;
> >how can I activate all these indexes 'programmatically', i.e. without
> >explicitly activating each one of them via IBConsole?!
>
> >TIA,
> >Luca.
>
> >I'm not 100% sure about this one, since I haven't tried it, but a quick
> inspection of
>
> >the system tables leads me to guess something like this:
>
>
>
> >Update RDB$INDICES Set RDB$INDEX_INACTIVE=0 where RDB$SYSTEM_FLAG
> >AND RDB$INDEX_ACTIVE=1NULL
>
> Make that
>
> Update RDB$INDICES Set RDB$INDEX_INACTIVE=0 where RDB$SYSTEM_FLAG IS
> AND RDB$INDEX_INACTIVE=1side-effects
>
> Somebody else might want to comment on the possible dangers or
>The dangers are that you are directly manipulating the system table
> of using the system tables like this if there are any.
data and risk corruption. Whether this particular statement would
cause an issue I can not comment. If you do decide to directly play
with the system tables, make a backup before you do. Also, once you
have made the change, do a backup-restore to make sure nothing is corrupt.
A better way to go is to run a query to get the index names from the
system tables and generate the DDL to do it properly. Here is a start
select 'ALTER INDEX ' || RDB$INDEX_NAME || ' ACTIVE;'
from RDB$INDICES
Run it in iSQL and then copy the output into clipboard, then run it.
The safest and perhaps most boring way is to use a data pumping tool
(IBDataPump etc) to fix these sorts of problems. If you can get an
empty database with the same structure (which you can often use gbak
-m) that is the hardest part.
Adam