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 > Deleting data from table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-13-06, 18:27
venky5436 venky5436 is offline
Registered User
 
Join Date: Jul 2005
Posts: 47
Deleting data from table

Hi,

I am working on AIX platform and V8.2 UDB.Can you please help me with solutions for the following.Thanx in advance

1)How do you write a stored procedure for the application team to execute.They need to delete data from a table depending on a particular condition and should not log into the logs.For Ex a table has millions of rows and I want to delete rows which have the date 12/06/2006.How can it be done any idea. I could delete all the data from a table using the alter table activate not logged initially with empty table.But I want to delete for a month.


2)How do you delete data from a parent table not logging into the logs as the data are in millions of rows.And I do not want to delete data from the child just the data form the parent which have foreign keys or constraints.

Thanx
Venky
Reply With Quote
  #2 (permalink)  
Old 06-14-06, 03:24
Wim Wim is offline
Registered User
 
Join Date: Nov 2004
Posts: 1,279
Quote:
2)How do you delete data from a parent table not logging into the logs as the data are in millions of rows.And I do not want to delete data from the child just the data form the parent which have foreign keys or constraints.
Do you mean you want to have a situation in which the referential integrity (RI) rules do not apply ? You could create the FK with the NOT ENFORCED option, but I would only do that if I was sure the RI rule still holds.
__________________
With kind regards . . . . . SQL Server 2000/2005/2008/2008 R2 Earned beers: 16
Wim
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages
Reply With Quote
  #3 (permalink)  
Old 06-18-06, 14:19
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by venky5436
... and should not log into the logs.
Why would you want to do that?
That means that it would be impossible afterwards to restore to the current database situation from an earlier backup!
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #4 (permalink)  
Old 06-19-06, 11:27
jthakrar jthakrar is offline
Registered User
 
Join Date: Mar 2004
Posts: 46
1) MDC (Multi-Dimension Clustering) with the appropriate fixpack (not sure whether its 8 or 10) can probably help you with 1.

In MDC, if your query has an exact match for one of the dimensions, then the deletes will (may) not log the actual rows/records being deleted, but just the data/index page information.

Look up the online DB2 documentation for details -
http://publib.boulder.ibm.com/infoce...n/r0009949.htm

Note that you will need the right fixpack AND the DB2_MDC_ROLLOUT registry variable set to ON (note that this is a ONE-WAY street - it can't be undone).

You can get more info on the DB2 profile registry variable at
http://publib.boulder.ibm.com/infoce...n/r0009949.htm

2) For this I think the only way out would be to NOT enforce your constraint.
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