UNIX named pipes and oracle EXPort/IMPort utility

 

The following is a trick when you want to run oracle export utility and realize that you have no space for the dump file. What you can utilize at this point is Unix named pipes. It allows you to send the output of the exp utility straight into the compress command. That way the file will exist in the file system only in compressed state. Compression for the dump files is typically very good (unless you have lots of LOBs) and you can shrink the size of the file up to 10 times.

The other neat use of the named pipes is to use it in conjunction with Oracle IMPort utility. A lot of times, clients send me a compressed dump file from which I have to import few tables or schemas. I can’t uncompress it because it will just take too much space. Also it may take too long, and then logging few hours later, at night, to kick off the IMPort.

Lets proceed with the example of the EXPort:

#First lets create a named pipe:
/usr/sbin/mknod my_named_pipe p
#now we are going to kick off the gzip (compress command) to run in the background.
#It will be waiting for the exp command to start sending data into the pipe
gzip < my_named_pipe > my_exp_output_file.gz &
#and now lets start the EXPort
exp \"/ as sysdba\" file my_named_pipe buffer=500000 statistics=none compress=N full=Y consistent=Y

Now lets look at the example of the IMPort:

# lets create a named pipe
/usr/sbin/mknod my_named_pipe p
#kick off the gunzip in the background
gunzip < my_exp_output_file.gz > my_named_pipe &
#and start the import
imp \"/ as sysdba\" file= my_named_pipe

Unix named pipes are very powerful, so don’t’ limit their use just for Oracle exports and imports. Here is a link to the doc with more examples:

http://en.wikipedia.org/wiki/Named_pipe#Named_pipes_in_Unix

 

Copyright © 2007, All rights reserved by RudnikConsulting Inc