Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

data cleanup for customtables in production system.

Former Member
0 Kudos

Hai,

My requirement is a list of custom tables data should be deleted in production system based on some selection-criteria.

Any one can suggest how we can achive this.

Shall I write any Zprogram or any other way.

I have written code for one table .

Reprot ZTesdel.

Tables : YDCS_COMP_CR.

DATA itab1 type STANDARD TABLE OF YDCS_COMP_CR.

SELECT * FROM YDCS_COMP_CR INTO TABLE ITAB1.

DELETE YDCS_COMP_CR from table ITAB1.

Please any one can tell the same code will work for deleting records from YDCS_COMP_CR or any other piece of needs to added?

Regards,

Krishna

2 REPLIES 2

ThomasZloch
Active Contributor
0 Kudos

Depending on the nature of the data, there might be a legal retention period to be observed.

Also check for dependencies to other tables, foreign keys, so you don't end up with a corrupt database.

If it is data in the GB range, don't delete in one chunk, or the redo buffers might overflow. Instead fetch packages of x records, delete them and do a commit work before reading the next package. Use OPEN CURSOR WITH HOLD and function DB_COMMIT for this purpose.

Thomas

Edit: just saw this is a continuation of

Please now work with the information provided so far before coming back with more questions.

Former Member
0 Kudos

Hai

Now i need to get an excel dump of all the data that currently exists within the system so that we can keep it as backup before deleting also.

After that i need to delete the data based on selection - criteria.

Please let me know to how to do it. Any one can tell above code is ok or any performance issues.

Regards,

Krishna