>copying databases
Posted in 1992
>I want to take a copy a informix database, so that the users can get
>access to both the old and the new copy by setting DBPATH.
>Is it ok to use cp to copy the database files to another directory,
>or does the db files contain absolute pathnames?
>
>Is there a better way to copy the database?
>
I recently moved our entire database (~ 50 tables, 225 Meg), from one
machine to other. This is what I did:
1. create new database.
2. do "dbschema -t all -d dbname -f fn" to get structure of all tables.
3. run the file fn in the new database to create all tables:
a. It preserves owner, etc....
b. I ran it as informix so all the files (.dat and .idx) were
owned by informix.
4. Now to copy all the data:
unload to "db1.out"
select tabname, dirpath
from systables
where tabname not matches "sys*"
and tabtype <> "V"
order by tabname
This will give the respective filenames for all tables. Run it on
both dbs. You've got table name and file names for those tables
in both databases. All you've got to do now is copy from old
filename to newfilename; I wrote a shell script to do this.
5. Run: update statistics to update stats of all tables in the new db.
You are all done......
I had created some fine mess trying to do a straight copy/del of
db/tables when I worked on Rdb on VAX. I had spent hours trying to
fix it. The above seems safe.
Hope this helps..
Mukesh
(mukesh@elsouth.wsnc.org)