Recreate Index
Posted in 2003
Topics: Server Administration
Hi,
I want to migrate indexes from one dbs to another, where the name and the
odrer to create indexes are stored, so i can generate all sql odrers to do
that using awk tool.
One way is :
1 - Dbschema of the database to obtain : dbname.sql
2 - G'n'rate un sql file to drop indexes : cat dbname.sql|grep 'create
index'|awk '{printf("drop %s;\\n",$3)}'> dropindx.sql
3 - Drop indexes : dbaccess dbname dropindx.sql
4 - Edit the dbname.sql, remove all orderes exept 'create index...' orderes
and add before ';' 'in indexdbs'.
Is there an easier why to do that.
Tanks for your help.
sending to informix-list
On Mon, 20 Oct 2003 10:37:42 -0400, Hamid HABZI wrote:
If the indexes are detached you can:
ALTER FRAGMENT ON INDEX indexnameINIT IN newdbspacename_or_fragment_expressions;
Art S. Kagel
> Hi,
> I want to migrate indexes from one dbs to another, where the name and the
> odrer to create indexes are stored, so i can generate all sql odrers to do
> that using awk tool.
> One way is :
> 1 - Dbschema of the database to obtain : dbname.sql 2 - G'''n'''rate un sql file
> to drop indexes : cat dbname.sql|grep 'create index'|awk '{printf("drop
> %s;\\n",$3)}'> dropindx.sql 3 - Drop indexes : dbaccess dbname dropindx.sql 4 -
> Edit the dbname.sql, remove all orderes exept 'create index...' orderes and
> add before ';' 'in indexdbs'.
>
> Is there an easier why to do that.
> Tanks for your help.
>
> sending to informix-list