Administer > Database Cleanup utility
Add a configuration to the Database Cleanup utility
The Database Cleanup utility is configurable. Aside from the preset cleanup configurations, you can add new objects to the database table to define which tables and rows to clean, by updating the Database Cleanup utility configuration data in the CLEANCONF table. To extend the Database Cleanup utility, specify values for the jdbcDriver and jdbcUrlPrefix parameters when running the utility.If you have extended the database schema by creating new tables, you can use the Database Cleanup utility to clean your new tables. If you have changed the database schema (such as adding new columns to one table, changing the foreign key primary key relationship, or adding a new child table to the referential integrity path), you must review and possibly modify or add SQL statements in the CLEANCONF table so DBClean will behave correctly in the new schema.
You should create new configurations instead of altering the existing ones. That way, changes are not lost on a fix pack installation.
Configure dblean.sh to delete all objects with col1 > 10, and where lastupdate is n days ago
Object o1 consists of table R1, which contains the following columns: col1, col2, lastupdate, and col3.
insert into cleanconf (objectname, type, statement, namearg, sequence, daysarg) values ('o1', 'obsolete', 'delete from r1 where col1 > 10 and (days(CURRENT TIMESTAMP) - days(lastupdate)) > ?', 'no', 1, 'yes')
db2 insert into cleanconf (objectname, type, statement, namearg, sequence, daysarg) values ('o1', 'obsolete', 'delete from r1 where col1 > 10 and (days(CURRENT TIMESTAMP) - days(lastupdate)) > ?', 'no', 1, 'yes')
insert into cleanconf (objectname, type, statement, namearg, sequence, daysarg) values ('o1', 'obsolete', 'delete from r1 where col1 > 10 and (sysdate - lastupdate) > ?', 'no', 1, 'yes')
Where ? is replaced by the -days parameter from the following command line. The 'no' indicates that the name parameter is not used in the statement. The 'yes' indicates that the -days parameter is used in the statement. 'obsolete' describes the cleanup type for object o1. Use other words, but use the same word in the -type argument when you invoke the Database Cleanup utility.
Clean records which have been in existence for two days from the new table
./dbclean.sh -object o1 -db dbname -dbuser user -type obsolete -days 2 -loglevel LOGLEVEL
dbclean -object o1 -db dbname -type obsolete -days 2 -loglevel LOGLEVEL
Where LOGLEVEL is NONE, ERROR, WARNING, NORMAL, INFO (or VERBOSE), or DEBUG. The default is DEBUG.
./dbclean.sh -object o1 -db dbname -type obsolete -days 2 -loglevel 1 -dbtype oracle -dbuser user -dbpasswd password
dbclean -object o1 -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
Configure databases for use with the staging utilities
Set the PATH environment variables for WebSphere Commerce utilities
Clean the database
Dbclean utility script
Database Cleanup utility objects
Examples: Deleting objects