473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

export to pipe

I am attempting to move data between 2 DB2 Linux databases using a
pipe. I can't seem to get it working. Any assistance is appreciated.

I first issue:

mkfifo -m777 mypipe
db2 "connect to src_db"
db2 "export to mypipe of DEL MODIFIED BY COLDEL, MESSAGES exp.msg
select * from myschema.old_table"

Followed by:

db2 "connect to target_db"
db2 "import from mypipe of DEL MODIFIED BY COLDEL, MESSAGES imp.msg
replace into myschema.new_tbl"

The pipe gets created with proper permissions. I can issue a unix
"cat" command and the data comes back to the screen nice. The export
even completes successful when I issue the "cat".

However, When I issue the import commadn, I get the following on the
export side "

SQL3001C An I/O error (reason = "sqlofopn -2029060074") occurred while

opening the output file.

If I set up my test using an actual file instead of a pipe, it works
fine as well.

Any ideas are appreciated. Thanks.

Dec 29 '06 #1
2 16682
Ian
mike_dba wrote:
I am attempting to move data between 2 DB2 Linux databases using a
pipe. I can't seem to get it working. Any assistance is appreciated.

I first issue:

mkfifo -m777 mypipe
db2 "connect to src_db"
db2 "export to mypipe of DEL MODIFIED BY COLDEL, MESSAGES exp.msg
select * from myschema.old_table"

Followed by:

db2 "connect to target_db"
db2 "import from mypipe of DEL MODIFIED BY COLDEL, MESSAGES imp.msg
replace into myschema.new_tbl"

The pipe gets created with proper permissions. I can issue a unix
"cat" command and the data comes back to the screen nice. The export
even completes successful when I issue the "cat".

However, When I issue the import commadn, I get the following on the
export side "

SQL3001C An I/O error (reason = "sqlofopn -2029060074") occurred while

opening the output file.

If I set up my test using an actual file instead of a pipe, it works
fine as well.

Any ideas are appreciated. Thanks.
The error occurs because of how DB2 opens the file (pipe) for the
import utility. You can do:

mkfifo exportpipe
mkfifo importpipe

db2 "export to exportpipe ... "
cat < exportpipe importpipe &
db2 "import from importpipe ..."

Note, you'll have to execute the import and export from separate shells
because of the architecture of the DB2 CLP.

Exporting/importing through pipes is a kludge, however.

If you're moving a small amount of data (and I expect you are, if you
are using IMPORT), just export to a file and then import from the file.

If you're moving a large amount of data, try setting up a nickname in
the target database that points to your source database and then use the
LOAD FROM CURSOR functionality. Much better.

Dec 29 '06 #2
Ian,

Thanks for the reply. I suspected something on the open as you point
out. I think I will try the latter proposal of Federating the two
databases.

Much appreciated !

Ian wrote:
mike_dba wrote:
I am attempting to move data between 2 DB2 Linux databases using a
pipe. I can't seem to get it working. Any assistance is appreciated.

I first issue:

mkfifo -m777 mypipe
db2 "connect to src_db"
db2 "export to mypipe of DEL MODIFIED BY COLDEL, MESSAGES exp.msg
select * from myschema.old_table"

Followed by:

db2 "connect to target_db"
db2 "import from mypipe of DEL MODIFIED BY COLDEL, MESSAGES imp.msg
replace into myschema.new_tbl"

The pipe gets created with proper permissions. I can issue a unix
"cat" command and the data comes back to the screen nice. The export
even completes successful when I issue the "cat".

However, When I issue the import commadn, I get the following on the
export side "

SQL3001C An I/O error (reason = "sqlofopn -2029060074") occurred while

opening the output file.

If I set up my test using an actual file instead of a pipe, it works
fine as well.

Any ideas are appreciated. Thanks.

The error occurs because of how DB2 opens the file (pipe) for the
import utility. You can do:

mkfifo exportpipe
mkfifo importpipe

db2 "export to exportpipe ... "
cat < exportpipe importpipe &
db2 "import from importpipe ..."

Note, you'll have to execute the import and export from separate shells
because of the architecture of the DB2 CLP.

Exporting/importing through pipes is a kludge, however.

If you're moving a small amount of data (and I expect you are, if you
are using IMPORT), just export to a file and then import from the file.

If you're moving a large amount of data, try setting up a nickname in
the target database that points to your source database and then use the
LOAD FROM CURSOR functionality. Much better.
Jan 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alex | last post by:
Hi, is there a way to display the table in CSV format or write a query in csv to a file ? Alex ---------------------------(end of broadcast)--------------------------- TIP 2: you can get...
1
by: mark.heyden | last post by:
Hi Frends, I am facing problems while trying to export data into pipe format. In fact I am fetching records from mysql database and then trying to create a text file ( using pipe as delimeter) ,...
3
by: chudson007 | last post by:
Can somebody help me with a delimiter problem I have. I have several PIPE (|) delimted text files which I need to import to SQL. With one of the files I keep encountering the following error;...
6
by: jefftyzzer | last post by:
Friends: Let's say I'd like perform a delete, but before I delete, I'd like to export the target rows. I could use an export whose SELECT clause references the OLD TABLE of a DELETE, but the...
2
by: dogman_2000 | last post by:
Hi All I am using the docmd.transfertext to export my query as a .csv file. I am using an export spec which is seperated by a pipe. The problem I have is that I added an extra column onto the...
1
by: bhapate1 | last post by:
Hi all, I Have a Table with 10 Columns, Among those i have Data in just 3 Columns. Rest of columns wil be blank. I want to Export that Table as a Pipe Delimited Text File. I am using...
1
by: db2admin | last post by:
Hello, I am wondering if someone have done comparison of loading data using cursor VS. Pipe. Please share your experience. which one is faster ? regards
5
by: The Pipe | last post by:
Hello I have a table that I need to export to a .asc file format. I have had several attempts at getting this to work but with no luck. Basically the file would need to have every record...
4
by: klaul | last post by:
I'm hoping that this is going to be an easy one to solve, but I've been trawling google and have had no luck at all! I'm using Access 2003, and am trying to export the contents of a table into a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.