Named Pipe & Oracle imp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Named Pipe & Oracle imp
# 1  
Old 02-24-2012
Named Pipe & Oracle imp

Hi,

I have a little knowledge about mkfifo, first-in-first-out, a special file, a named pipe and it involves inter-process communication,
as multiple processes can write data into a single file.

Here, I would like to know how this is helpful in executing the below Oracle 'imp' command which reads from an export dump file.

mkfifo /home/tst_pipe
gunzip < /home/exp_dump.exp.gz > /home/tst_pipe &
imp / file=/home/tst_pipe log=/home/imp_dump.log fromuser=xyz touser=abc

At step #1, we create a named pipe file, step #2 unzip the exp dump into the pipe in the background and step #3 does the actual import job.

Step #2, extracts from a big zip file in the background, how at step #3, we are able to process the import command without waiting for the unzip
process to complete.

Does it mean, both gunzip and imp shares the same file parallely, whatever unzip has completed, it is processed by imp on a first-in-first-out basis.

Please give a brief overview about 'mkfifo' and how the above 3 statements work together well, thank you.

---------- Post updated at 01:59 PM ---------- Previous update was at 01:43 PM ----------

Hi,

I forgot to add one more point.

Here, we can import directly from the exp dump, after totally unzipping it. I have heard that, if the dump is too big, we have limited space in the mount point, we cannot extract it fully and import it.

So, in this situation, we can go for the above mentioned solution using mkfifo, it does the job well with very limited space restriction as well, please throw light on this aspect as well, thank you.
# 2  
Old 02-24-2012
The trick for named pipes is that until one side has a server, the other side will not open. I forget which, but easy to try in the shell. The /sbin/mknod command makes named pipes on some systems. The serving process needs to open and serve enough times to satisfy all the clients that open.

I do not use named pipes but once in a blue moon, as in ksh and bash, you can make a named pipe that evaporates on its own with prameters of the form "<(commands that write to a pipe being read)" or ">( commands that read from the pipe being written". For instance: "comm -13 <(sort file1) <(sort file2)" makes sorted version of files on named pipes as comm input files to show lines that are new (comm -13 means output is minus (-) deleted (1) and common(3) ). (On systems without something like /dev/fd/0, bash makes named pipes in /var/tmp, and never cleans them up, unless the bash people acted on my bug report and you have that patch!)

You can also, on UNIX that have /dev/fd/ visible file descriptors, use /dev/stdin with a leading pipe, like this trivial example: "cat file1 file2 | sort /dev/stdin", and /dev/stdout with a trailing pipe, like this trivial example: "sort -o /dev/stdout file1 file2 | uniq -d". We had a 32 bit file program and a file over 4g, that ran fine with "old_prog -i /dev/stdin <big_file", because the shell opened the big file open64() and the old_prog opened the named pipe with open(). Technically, this is not a named pipe, but a cue to the kernel to dup() an inherited, already open, flat file fd as the open(). The /dev/fd/# or /proc/fd/# inodes are fake, honored by special kernel handling. This solution is simpler, runs faster and with less CPU, than "cat big_file | old_prog -i /dev/stdin", which is a real pipe. Of course, if you have a program that either reads stdin or writes stdout, either by default or when given a '-', you can use the unnamed pipe '|', like this trivial example: "gunzip <xxx.tgz | tar tf -".

So, between these shell/kernel helps, one wonders if you really need a named pipe, or just like it because if feels more file-like! Admittedly, some of my pipe processing shell trees did scare the kids! However, no file space was used, no space limits hit, no write or read disk overhead, no pages loaded with cached file data, and pipeline parallelism -- what's not to like! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to test named pipe file?

Hi ALL, How can I test a given file name exists and if it is a named pipe file in shell script ? Thanks............ (2 Replies)
Discussion started by: mycode.in
2 Replies

2. UNIX for Dummies Questions & Answers

Named pipe hanging?

Ok, I can't seem to figure this out or find anything on the web about this. I'm on Sun Solaris, UNIX. I have the following test script: #!/bin/ksh touch test.file LOG=./tmp.log rm -f ${LOG} PIPE=./tmp.pipe mkfifo ${PIPE} trap "rm -f ${PIPE}" EXIT tee -a ${LOG} < ${PIPE} & ... (17 Replies)
Discussion started by: Ditto
17 Replies

3. Programming

Named pipe behavior in Linux

Hi All ! I try to collect importent events from syslog and in my syslog conf, there is something like this: *.* |/logs/ipes/SLpipe1 I have a program, which opens this pipe and reads the messages from it. But how this pipe works ? Where can I probably read something about the details,... (3 Replies)
Discussion started by: mabra
3 Replies

4. Shell Programming and Scripting

Named pipe performance

Hi, I am getting data into a Named pipe. Does Named pipe have any size restriction; I know it does not have any storage and it just passes on the data to the next process. I want to know, if there will be a difference in the Named pipe performance if the data input is more. (I am using DB2... (1 Reply)
Discussion started by: sudvishw
1 Replies

5. UNIX for Dummies Questions & Answers

Filtering mail into a named pipe

Hello, On my machine, all mail is stored in my /var/spool/mail. IS there a way to direct all mail that goes there into a namep pipe? Thank you, Dado (4 Replies)
Discussion started by: dadoprso
4 Replies

6. Shell Programming and Scripting

Help required to parse Oracle imp show=y output to DDL Commands

Hi, I generated an Oracle schema DDL script file using the show=y option of the Oracle import utility but the file that it generates needs a little more formating before we can run this as simple DDL comands to generate the schema at Target using the script file.Here is the simplified output of... (1 Reply)
Discussion started by: rajan_san
1 Replies

7. UNIX for Dummies Questions & Answers

fifo or named pipe working?

Can someone explain to me the working of fifo() system call using simple C programs so that I can implement them in the UNIX environement? (1 Reply)
Discussion started by: lvkchaitanya
1 Replies

8. UNIX for Dummies Questions & Answers

Named PIPE

Gurus, I've a File Transaction Server, which communicates with other servers and performs some processing.It uses many Named PIPE's. By mistake i copied a named PIPE into a text file. I heard that PIPE files shouldn't be copied.Isn't it? Since it's a production box, i'm afraid on... (2 Replies)
Discussion started by: Tamil
2 Replies

9. Programming

IPC using named pipe

Hi All, I am facing a vague issue while trying to make two process talk to each other using named pipe. read process ========= The process which reads, basically creates FIFO using mkfifo - ret_val = mkfifo(HALF_DUPLEX, 0666) func. It then opens the pipe using open func - fd = open... (2 Replies)
Discussion started by: sharanbr
2 Replies

10. UNIX for Advanced & Expert Users

IPC using named pipe

Hi All, I am facing a vague issue while trying to make two process talk to each other using named pipe. read process ========= The process which reads, basically creates FIFO using mkfifo - ret_val = mkfifo(HALF_DUPLEX, 0666);) func. It then opens the pipe using open func - fd =... (1 Reply)
Discussion started by: sharanbr
1 Replies
Login or Register to Ask a Question