If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to use Export command inside SQL procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-19-11, 05:30
super_mpk super_mpk is offline
Registered User
 
Join Date: May 2011
Posts: 15
Red face How to use Export command inside SQL procedure

Hi all,

I am new DB2 user. I am having 3 databases prod, Dev , Test. and I want to synchronize these 3 databases. I want to take data from prod database and put it into test and devp.

I tried a lot using cursors, arrays, but I didn't get any solution.

Please give me the solution. it is argent.

thanks.
Reply With Quote
  #2 (permalink)  
Old 05-19-11, 08:59
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What DB2 version and OS are you using. Have you looked at the db2move utility?

Andy
Reply With Quote
  #3 (permalink)  
Old 05-19-11, 10:14
super_mpk super_mpk is offline
Registered User
 
Join Date: May 2011
Posts: 15
Red face Export command inside SQL procedure >DB2 version 8 and os is windows.

I am using DB2 version 8 and os is windows.

I am synchronizing the three databases.

CONNECT TO CAEEDMP USER "caeedm" USING password;
EXPORT TO "C:file1.txt" OF DEL MESSAGES "C:\file_error.txt" SELECT * FROM schema.tablename
CONNECT RESET;

CONNECT TO CAEEDMT USER "caeedm" USING password;
DELETE FROM schema.tablename;
IMPORT FROM "C:\file1.txt" OF DEL METHOD P (1, 2, 3) MESSAGES "C:\file_error.txt" INSERT INTO schema.tablename (ID, "NAME", DESCRIPTION);
CONNECT RESET;

CONNECT TO CAEEDMD USER "caeedm" USING password;
DELETE FROM schema.tablename;
IMPORT FROM "C:\file1.txt" OF DEL METHOD P (1, 2, 3) MESSAGES "C:\file_error.txt" INSERT INTO schema.tablename(ID, "NAME", DESCRIPTION);
CONNECT RESET;


this is the code for a single table .

but I want to do this for a list of tables .
The code should be in a loop

I got the list of table. but can't process further.

Last edited by super_mpk; 05-19-11 at 10:26.
Reply With Quote
  #4 (permalink)  
Old 05-19-11, 10:29
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
First V8 has been out of service from IBM for a few years now. You should look into updating to the latest version (9.7). Read the manual for the db2move utility. It should do what you want.

Andy
Reply With Quote
  #5 (permalink)  
Old 05-23-11, 11:19
super_mpk super_mpk is offline
Registered User
 
Join Date: May 2011
Posts: 15
Hi thanks for your valuable reply.

Please will you tell me from where the db2move utility can run.

I tried into command window, CLP , command Editor but It is giving error.

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On