Bill64bits
2007-04-27 17:01:18 UTC
I am using IDS 9.4 TC2
I would like to move all indexes to a new dbspace on another drive
and, at the same time give them all meaningful names.
This includes primary keys, foreign keys, and unique constraints.
There are about 1400 indexes in all, so I don't wish to do them one at a time.
I can easily write the code to generate all the "add constraints" and "create unique index" statements.
I have done that before in Perl and now in C#. That runs in a few seconds.
But dropping them all first is a bit hairy because of the way an index gets renamed when constraints
are dropped and one cannot drop an index with a leading space in its name.
One solution is to export, paste the bottom of the db.sql into another file, kill all of the new file
except the procedures, functions, views, sequences, grants,
and then drop the database, run the index builds and referential constraint adds,
then run the second sql file and then update statistics.
I am also thinking about killing all lines in the "create table" statements that declare a unique column
and letting a unique index be added by the second sql file. Is that a bad idea?
Is there a better way to do this without dropping the database?
Time is not a problem since this database will reload in 20 minutes and it is not running 24/7 .
I just don't like the idea of dropping a production database. That just makes me nervous.
I would like to move all indexes to a new dbspace on another drive
and, at the same time give them all meaningful names.
This includes primary keys, foreign keys, and unique constraints.
There are about 1400 indexes in all, so I don't wish to do them one at a time.
I can easily write the code to generate all the "add constraints" and "create unique index" statements.
I have done that before in Perl and now in C#. That runs in a few seconds.
But dropping them all first is a bit hairy because of the way an index gets renamed when constraints
are dropped and one cannot drop an index with a leading space in its name.
One solution is to export, paste the bottom of the db.sql into another file, kill all of the new file
except the procedures, functions, views, sequences, grants,
and then drop the database, run the index builds and referential constraint adds,
then run the second sql file and then update statistics.
I am also thinking about killing all lines in the "create table" statements that declare a unique column
and letting a unique index be added by the second sql file. Is that a bad idea?
Is there a better way to do this without dropping the database?
Time is not a problem since this database will reload in 20 minutes and it is not running 24/7 .
I just don't like the idea of dropping a production database. That just makes me nervous.