One of great secrets of UNIX has to be the named pipe. A named pipe is a special type of device (or file) that...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
allows data to written to it, and then manipulated by another command. Oracle exports are a perfect application for named pipes. The usual procedure is to run an export, and then compress the export file. The problem with this approach is that you need enough free filesystem space for the export, and the compressed file. By using a named pipe, you only need to have enough space for the compressed file. This approach can also speed up exports where the writing of the export file is the bottleneck.
The first step is to create the named pipe (do yourself a favor, and add /usr/sbin to your path, it also includes useful commands like ping):
/usr/sbin/mknod full.dmp p
Next start a background process that reads all data that comes through the named pipe (using the 'cat' command), and then compresses the data (for portability, I use compress). Remember that the data coming into compress is from stdin, so you need redirect the output of compress to a file. This command will run in the background until the cat command receives the end of file character.
cat full.dmp | compress > full.dmp.Z &
Finally, start your export, using the named pipe as the output file.
exp system/manager file=full.dmp full=y log=full.log
You will notice that after the export finishes, the cat/compress job will finish also.
Make sure that you remove the pipe from your backup directory
I have seen this done another way, which I think looks a little more elegant:
mknod exp.pipe p gzip < exp.pipe > db.exp.gz & exp system/manager file=exp.pipe full=y log=db.exp.log rm exp.pipe
Deepender G. writes: This is really a good tip but it would be nice if the author gave more inputs in case the file size limit is 2 GB and the compressed size of the export dump is more than 2 GB.
About the AuthorJames Giordano is an Oracle database administrator. He has been working with Oracle for about seven years, and also has experience with UNIX and PeopleSoft/Oracle financials.
For More Information
- Feedback: E-mail the editor with your thoughts about this tip.
- More tips: Hundreds of free Oracle tips and scripts.
- Tip contest: Have an Oracle tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize -- submit your tip today!
- Ask the Experts: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.
- Forums: Ask your technical Oracle questions--or help out your peers by answering them--in our active forums.
- Best Web Links: Oracle tips, tutorials, and scripts from around the Web.