Re: Creating separate schema for indexes
Posted in 1996
Dick,
This is baling wire and matchsticks but how about:
dbschema -d dbname -t tablename|grep -v -E "XYZ| \\);"|grep -E
"create|\\);"|grep -v "create table"
This is pasted in from a real working command line under 7.11.uc1
where the create index lines run into a second line.
It assumes that you don't having any lines with a string of XYZ in them
Of course, it is a single command line though it is displayed as
two above.
The first grep excludes the " );" line that comes after column definitions.
AIX grep doesn't like the exclusion syntax excluding a single
string with unbalanced parentheses like grep -v " \\;". Of course, if
you have a line with "XYZ" a line, that like will be excluded, too.
The second grep includes any line with "create" or ");" which gets
all "create table" and "create" index lines and in the case of long index
creations, the second line with it. Of course if your index creation
goes beyond two lines, you have a problem.
The third grep excludes the "create table" line. Because of the possibility
of "create unique", "create cluster",etc, you can't simply inclue
"create index" in the second grep.
This assumes unix won't play with the sequence of lines where a high
volume of lines is involved.
Good luck;
use at your own risk,
caveat emptor,
and notary sojac.
--
Con Woodall Colorado St. U.; Veterinary Teach. Hosp.; Ft. Collins CO 80523,
USofA; 970-491-1244 FAX 970-491-4100 cwoodall@vth1.vth.colostate.edu
"Ask me about my vow of silence!"
--
On Wed, 18 Sep 1996, Dick Counsell wrote:
> Hi all -
>
> Does anyone have a utility or other solution to
> this problem?
>
> I want to copy a 7.13 Informix database over to a
> 7.20 instance. If I create the new database with
> indexes, this will take forever to load. So, I
> would like to create two schemas; one with all the
> sql to create tables without indexes and another
> with the sql for the indexes.
>
> I used to accomplish this by grepping the output of
> dbschema for 'create index' or 'create unique
> index' and directing the output to a file. This
> doesn't work now because a lot of my 'create index'
> lines are now actually two lines and the grep will
> just get the incomplete first line.
>
> I hope this make sense to someone and doesn't
> appear to be the incoherent ramblings of a rookie
> (even though it is).
>
> Thanks,
>
> Dick Counsell
>