IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Cloning of tables


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ram_vizag

Active User


Joined: 21 Aug 2008
Posts: 112
Location: hyd

PostPosted: Wed Sep 28, 2011 5:34 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 28, 2011 6:00 pm
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
Reply with quote

Refer - 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--><


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

Moderator Emeritus


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

PostPosted: Wed Sep 28, 2011 8:45 pm
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

Active User


Joined: 21 Aug 2008
Posts: 112
Location: hyd

PostPosted: Wed Sep 28, 2011 11:13 pm
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

Moderator Emeritus


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

PostPosted: Thu Sep 29, 2011 1:02 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Need to fetch data from so many DB2 t... DB2 9
No new posts How to: PK does not exist in several ... DB2 6
No new posts Discrepancy b/w SYSIBM tables and BMC... DB2 0
No new posts SYSIBM Tables Query DB2 8
No new posts Column names in SYSIBM tables DB2 5
Search our Forums:

Back to Top