The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Definition for the UNIX term Pipe dfrost126 UNIX for Dummies Questions & Answers 5 04-14-2008 07:17 PM
Encoding Problem while using "|" (PIPE) as delimiter from Mainframe to Unix seshendra UNIX for Dummies Questions & Answers 1 02-20-2008 05:36 AM
splitting a pipe delimited file in unix ddedic Shell Programming and Scripting 4 03-20-2007 01:16 AM
unix pipe in C meh High Level Programming 1 10-16-2006 07:34 PM
Compress while wrting to a file using a unix pipe booyena1 HP-UX 2 10-26-2005 12:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-12-2005
akrathi akrathi is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 41
UNIX Pipe

Hi ,
I want to understand how the PIPE works in unix . Precisely what I am doing is this .

1. Creating a Named PIPE with the command

mknod sqlldr.dat p

2. Directing a file output to the PIPE file in the background

cat abc > sqlldr.dat
3.SQL Loader in oracle is reading the data from this .

Now I want to undertsnad how it's really working ?

My concern is file abc is going to be a big one . Does this cause any memory problem

Links to how pipe works will be helfful

Does any body has a idea of reading a PIPE file from utl_file in oracle ?
  #2 (permalink)  
Old 10-12-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,720
a pipe is an intermediate file that allows to separate process to communicate.
The file uses FIFO I/O - first-in first-out. The last thing written to the file is the first thing read from the file.

I don't see any advantage to invoking sqlldr with a pipe. In fact, it may be a problem because pipes have a limit on "record" size - see /usr/include/limits.h _POSIX_PIPE_BUF and PIPE_BUF - and tables with several long columns will cause a problem with overflow.

One way pipes are really useful is to have two separate Oracle sessions comminuicating to one another using DBMS_PIPE
  #3 (permalink)  
Old 10-12-2005
akrathi akrathi is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 41
I had an issue like this .

I have to delete few records from the file in the unix box and then load the data into the database .Precisely the records whose size is less then 250 . I think there is nothing in the sql loader which offers this . Checked when cluase etc .

What I am doing now is this : Read file and copy all the records with 250 chracters to a temp file . Then load the data from the temp file

I thougt the pipe will be useful in this case .

Thanks
Ashok
  #4 (permalink)  
Old 10-12-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Pipes and fifos cannot overflow. A fifo, aka named pipe, is more of a interprocess communication mechanism than a file. Unlimited writes to fifos are required by Posix. If you exceed PIPE_BUF, you lose the guarantee of atomicity. This only has an effect in the case of multiple writing processes. Some people wanted a PIPE_MAX and such a constant is available but it is the same as the max value in a ssize_t field. Setting O_NONBLOCK and writing more than PIPE_BUF will result in partial writes and a poorly designed application could lose data under those circumstances, but that is not exactly an overflow.

With one process reading from a pipe and another writing to a pipe, they will take turns running. In theory, a pipeline like:
yes | cat > /dev/null
can run for all eternity and that continues to be true if a fifo is used instead.
  #5 (permalink)  
Old 10-12-2005
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683
Quote:
Pipes and fifos cannot overflow.
...
With one process reading from a pipe and another writing to a pipe, they will take turns running.
In fact, this sort of mechanism works very well when having to export Oracle data when the data exceeds 2 GB and the Oracle exp utility doesn't support large filesystems.
Code:
mknod pipefile p
compress < pipefile > exp.dmp.Z &
exp file=pipefile
  #6 (permalink)  
Old 10-12-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,720
FWIW -
Under HPUX 11.0 Oracle 9.2.0.4.0 - 64bit Production - sqlldr does exactly that - when
the length of the logical record exceeds PIPE_BUF, data is sometimes lost and log errors about incomplete or lost data show up.

Overflow is not the right technical word - but I wasn't sure what the OP's level of understanding was. pipes really can't overflow, just lose track of EOR.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0