[Sybase] Working w/ named pipes for Dumping and Loading Databases

Named pipes can be useful for a lot of things. I recently used a named pipe to dump and load a database at the same time. Usually I would first dump the database to a file, then load a second database from the dumped file. With named pipes this operation can be done in one-shot without the need of creating a dump file. Obviously one may not want to use a named pipe if they intended to make a database backup. Using a named pipe to dump and load may be faster depending on your environment or if the database being dumped is too large to fit on a file system.

To create our named pipe, we do the following:

$ mkfifo -m 666 /dump/DB.pipe
prw-rw-rw- 1 swinful 0 Jul 8 21:04 DB.pipe|

From within a Sybase server, we can dump to the named pipe just created, which cause the dump process to block until the pipe is read from.

1> dump database DB1 to "compress::/dump/DB.pipe"
2> go
Backup Server: 4.132.1.1: Attempting to open byte stream device: 'compress::/dump/DB.pipe::00'

As you can see, our process is being blocked until the pipe is read from. Opening another terminal load from the named pipe:

1> load database DB2 from "compress::/dump/DB.pipe"

change request from the Backup Server.
Backup Server: 4.132.1.1: Attempting to open byte stream device: 'compress::/dump/DB.pipe::00'
Backup Server: 6.28.1.1: Dumpfile name 'DB1061891297B ' section number 1 mounted on byte stream 'compress::/dump/DB.pipe::00'
Backup Server: 4.58.1.1: Database DB2: 6832 kilobytes LOADed.
Backup Server: 4.58.1.1: Database DB2: 12710 kilobytes LOADed.
Backup Server: 4.58.1.1: Database DB2: 18576 kilobytes LOADed.
Backup Server: 4.58.1.1: Database DB2: 25322 kilobytes LOADed.
Backup Server: 4.58.1.1: Database DB2: 33132 kilobytes LOADed.
...
Backup Server: 3.42.1.1: LOAD is complete (database DB2).
Use the ONLINE DATABASE command to bring this database online; SQL Server will not bring it online automatically.

1> online database DB2
2> go

From the dump window you will also see a similar output like the above:

...
Backup Server: 4.58.1.1: Database DB1: 87250 kilobytes DUMPed.
Backup Server: 4.58.1.1: Database DB1: 96488 kilobytes DUMPed.
Backup Server: 3.43.1.1: Dump phase number 1 completed.
Backup Server: 3.43.1.1: Dump phase number 2 completed.
Backup Server: 3.43.1.1: Dump phase number 3 completed.
Backup Server: 4.58.1.1: Database DB1: 96592 kilobytes DUMPed.
Backup Server: 3.42.1.1: DUMP is complete (database DB1).
Advertisements
This entry was posted in Sybase. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s