Re: How to copy a database
Posted in 1996
Kevin Brand wrote:
>
> Why use SQL:UNLOAD or dbexport, which both need filesystem space large
> enough to hold your data? Simply use tbunload (v5.x)/onunload (v7.x) to
> a tape device and then tbload/onload into the test area. This can be done
> across the network to another machine, across instances of Online, or locally
> on the production server. The only draw-back I can think of is that during
> the unload process, your database will be locked exclusively.
>
> You may even use the filesystem by 'touch'ing a file and using its name as
> the tape device on the command line.
>
> Try this:
>
> cd /tmp
> mknode mypipe p # a named UNIX pipe ( FIFO )
>
> echo "\\n" | onunload -t /tmp/mypipe -b 8192 -s some_large_number database_name &
>
> onload -t /tmp/mypipe -b 8192 -s same_number -d dbspace_name database_name>
> Here you have a file, 'mypipe' that will act as a pipe between the
> unloader and the loader. This is somewhat slower than using a tape but
> requires very little filesystem space.
>
> Using tb/onunload and tb/onload is nearly always faster than any other method
> because they read and write informix pages in binary format, not rows!!!
>
> Kevin Brand
Do NOT use onload or onunload, since it's not reliable.
Don't even use 4MM DAT, because it's even less reliable.
A good method to unload a table (or tables for a database) is this :
mkfifo fifo
dd if=fifo|compress|of=table.unl.Z &
echo "unload to fifo select * from table"|dbaccess database
After the completion of the unload, you have an unl file in compressed
format...Since unl files are text files, the compression rate can rise
up to 10:1 (depends on the contents of your columns).
If you have online 7.20, try and use the ipload, which loads and unloads
table at a terrific speed....
Bye.
Valery Fouques - SYSADM Gosport/FRANCE