Saturday, July 08, 2006

Working with Named pipes and Sybase ASE

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 Sybase dump to the named pipe just created. Doing so cause the dump process to block until the pipe is read from. To read from the pipe we do the following:


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).

Tuesday, July 04, 2006

Open Source Web Design

It has been a while. My first post since 2006! Guess I have been really busy.

First and foremost I want to thank Open Source Web Design for making avaliable such fantastic templates such as the one I am using now by Carlo Forghieri. The design is simple and to the point easy on the eyes. Excellent job Carlo!