Re: Dbexport
Posted in 2003
Howard,
We have 7.31 Informix, so I am speaking from my version. If you have 9.xxx
I assume the process is basically the same, but I'm not sure.
The dbexport creates a directory called "databasename.exp" in the
directory where you run the dbexport command, (or where you told it to
save) and inside that directory is a file called "databasename.sql". For
instance, if your database name is mercury, the directory will be
"mercury.exp" and inside that is a file named "mercury.sql". It is in
plain text, and you can edit the databasename to anything you want. There
are also permission statements, which you may not need - you can remove
those and keep only the necessary ones.
But the database is not just data, it is also the table schemas (what the
tablenames are, what columns are used, what datatypes they are, who owns
the tables, etc.), and the triggers, views, and so forth. So the schemas
are also in the sql file. The data is stored in the "mercury.exp"
directory, each table by itself, with a unique name, that is different
from the database table names. The sql output file lists the tables and
the unique names so you can map the table to the filename.
This solution depends on what you want to do - if you want to create a new
database for only archive purposes, you must (minimum) have both table
schemas and data, and of course, user "informix" needs permissions, which
I think it does have even if you don't specify so...but I'm not 100% sure
on that. If you just want data, then all of the data is in the unload
tables in the "mercury.exp" directory, but you cannot build a database
with that alone.
When you are done editing the "mercury.sql" file, you can run the dbimport
command to create a new database, under whatever database name you used in
the sql file. Just make sure you DO rename it in the file as when you run
the dbimport it will try to import it over the top of the current db. This
is the line to edit:
{ DATABASE mercury delimiter | }
becomes
{ DATABASE mercury_backup delimiter | } or something like it.
This is how I do a dbexport:
dbexport -ss -q -o /usr/mercury mercury
The ss parameter keeps table locations, lock modes and fragmentation
schemes if you need them.
Oh, yes, you will also need to modify the directory name that you saved
the dbexport into, or tell dbimport what directory to use.
dbimport mercury_backup -q -d dbspacename -i /usr/mercury.exp
Here are the usages, notice you may also want to specify some other
parameters.
Usage:
dbexport <database> [-X] [-c] [-q] [-d] [-ss]
[{ -o <dir> | -t <tapedev> -b <blksz> -s <tapesz> [-f
<sql-command-file>] }]
NOTE: arguments to dbexport are order independent.
Usage:
dbimport <database> [-X] [-c] [-q] [-d <dbspace>]
[-l [{ buffered | <log-file> }] [-ansi]]
[{ -i <dir> | -t <tapedev> [ -b <blksz> -s <tapesz> ] [-f <script-file>]
}]
NOTE: <log-file> must be a complete path
arguments to dbimport are order independent
C Geier
System Admin/IS support
St. Paul, MN
"Howard Jones" <howie_lfc@hotmail.com>
Sent by: owner-informix-list@iiug.org
11/24/2003 09:26 AM
Please respond to
"Howard Jones" <howie_lfc@hotmail.com>
To
informix-list@iiug.org
cc
Subject
Dbexport
Hello all,
IDS 9.21.FC4
HPUX11.0
The customer has requested the archive data we have currently within a
dbspace be moved to a seperate database within the live instance. Any
ideas....I was planning on using dbexport to tape but I have just read
that
a dbexport exports the whole database which is not feasable.
So to recap I wish to create a new database and populate it with the
excisting data from a dbspace.
sending to informix-list