Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Cloning of tables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ram_vizag

New User


Joined: 21 Aug 2008
Posts: 92
Location: hyd

PostPosted: Wed Sep 28, 2011 5:34 pm    Post subject: Cloning of tables
Reply with quote

Hi,

there are two tables base_table and clone_table respectively.what i need to do is exchange the data between base table and clone table. then need to unload from clone table and after unload need to delete the records in the clone table...can any one suggest me...
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7308

PostPosted: Wed Sep 28, 2011 6:00 pm    Post subject: Reply to: cloning of tables????
Reply with quote

After such a full and sincere apology to enrico - and rapid, mustn't forget - maybe this is worth some consideration.

Why can't you simplify the requirement? Write it down on paper, look at what data ends where (forget the names of tables or anything, just call the data A and B, in the database and not). Why can't you do it that way? If you can't, why didn't you already tell us?

Did you read what enrico wrote about asking good questions?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Sep 28, 2011 6:12 pm    Post subject:
Reply with quote

Refer - http://db2portal.blogspot.com/2007/07/clone-tables-db2-9-for-zos.html

This is accomplished using the new EXCHANGE SQL statement. After running an EXCHANGE the clone becomes the real table and the previously “real” table becomes the clone - - and you can repeat the process.

Code:
>>-EXCHANGE DATA BETWEEN TABLE--table-name1--AND--table-name2--><


http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.sqlref%2Fsrc%2Ftpc%2Fdb2z_sql_exchange.htm
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Sep 28, 2011 8:45 pm    Post subject:
Reply with quote

Hello,

I'm must be really late to this party . . . . Actually, it appears to begin "in the middle" icon_confused.gif And there is no "topic split" info. . .

Is there an existing "clone" that has unwanted rows? Why not simply empty the clone table? What is the reason to get all of the data from the base table into the clone if the next step is to remove it?

Probably i'm missing something here. . .
Back to top
View user's profile Send private message
ram_vizag

New User


Joined: 21 Aug 2008
Posts: 92
Location: hyd

PostPosted: Wed Sep 28, 2011 11:13 pm    Post subject:
Reply with quote

Hi,

Generally when we need a table to be available 24X7 round the clock to load or update, and in order to ensure that there should be no downtime for uploading etc...we need a clone table for a base table...generally created as
ALTER MY_BASE_TABLE CLONE MY_CLONE_TABLE (similarly will be like this)

process:

suppose a base table and clone is there.
so we create a clone table and then exchange the data.
so during this the table space of base table(suppose tablespace.B for base table) is switched to table space of clone table.

when you can access clone table now...when base table is down...and vice versa...but here if at all any duplicate values are inserted system may not prompt -803...once i find the material...i'll share...try from ur end also...i'm searching out....

is enrico active over here right now...need to see what he comment now....
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 29, 2011 1:02 am    Post subject:
Reply with quote

Hello,

Quote:
Generally when we need a table to be available 24X7 round the clock to load or update, and in order to ensure that there should be no downtime for uploading etc...
Many places believe they simply must have 24x7 uptime for one database or another. I have not yet spoken with an organization that would go out of business if there was a scheduled maintenanance window periodically (and i have spoken with many).

Everyone needs to understand that due one reason or another, there will be an outage periodically. I believe it is much better to plan/schedule these rather than them generating an instant crisis.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts To know activities on db2 tables ashek15 DB2 4 Fri Mar 03, 2017 11:23 pm
No new posts ERM-Diagram of SysIBM-Catalog-Tables Auryn DB2 2 Fri Feb 17, 2017 6:22 pm
No new posts Getting list of tables defined under ... kishpra DB2 2 Wed Aug 24, 2016 10:36 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us