Add a configuration to the Database Cleanup utility


To add a configuration to the Database Cleanup utility, use the following syntax as a reference.

object myobj consists of table R1, which contains the following columns: col1, col2, lastupdate, and col3. To configure the Database Cleanup utility to delete all objects with col1 > 10, and where lastupdate is n days ago:

For DB2, open a db2 command window and run...

db2 insert into cleanconf 
    (objectname, 
     type, 
     statement, 
     namearg, 
     sequence, 
     daysarg) 
values 
    ('myobj', 
     'obsolete', 
     'delete from r1 where col1 > 10 and (days(CURRENT TIMESTAMP) - days(lastupdate)) > ?', 
     'no', 
     1, 
     'yes')

For Oracle, open a SQLPlus command window and run...

insert into cleanconf 
    (objectname, 
     type, 
     statement, 
     namearg, 
     sequence, 
     daysarg) 
values 
    ('myobj', 
     'obsolete', 
     'delete from r1 where col1 > 10 and (sysdate - lastupdate) > ?', 
     'no', 
     1, 
     'yes')

...where...

Use other words, but use the same word in the -type argument when you invoke the Database Cleanup utility.

For example, To invoke the Database Cleanup utility to clean the records which have been in existence for two days from the new table, type the following:

./dbclean.sh -object myobj -db dbname -dbuser user -type obsolete -days 2 -loglevel LOGLEVEL

Where LOGLEVEL is NONE, ERROR, WARNING, NORMAL, INFO (or VERBOSE), or DEBUG. The default is DEBUG.

For Oracle, run...

./dbclean.sh -object myobj -db dbname -type obsolete -days 2 -loglevel 1 -dbtype oracle -dbuser user -dbpasswd password

For the dbname parameter, use host:port:sid. For example, myhost:1521:mydb.

 

Related Concepts

Database Cleanup utility