Database Cleanup utility
The Database Cleanup utility (dbclean) will delete objects from the database.
IBM recommends running database cleanup periodically, especially if you have changed a lot of information in your database and have unused tables or rows.
When dbclean deletes an object, the records in the object's tables are deleted to preserve the referential integrity of the database.
dbclean deletes records in child tables based on the delete rule of the referential integrity definition in the database schema. Your DBA can set the delete rule to...
- on delete cascade
- on delete set null
- on delete restrict
If you add new tables, ensure that the referential integrity and delete rule is properly defined. Otherwise, dbclean cannot work with your new tables.
If you are migrating from an existing version of WebSphere Commerce, you can run dbclean after your migration. Remember to evaluate the types of data on your system and how they affect database maintenance; typically, user and order data can be quite large, resulting in large database tables. When you clean the database, this will be time consuming since it can fill up your database transaction log files or potentially lock database tables when your store is running.
If you are running dbclean on a staging server it should only be run on the staglog object. The production-ready database is different from the production database. The production-ready database only has configuration data without the operation data. Deleting configuration data might cause a cascade delete on the operation data. When the Stage Propagate utility propagates the deletion to the production database, this might cause a cascade delete to the operation data (which you want to keep).
To clean configuration data...
- Run DB2 REORGCHK
- Run dbclean on the production database
For better performance, run dbclean on the USRTRAFFIC, MEMBER, and ADDRESS tables on the WebSphere Commerce database.
Log info is written to...
WC_installdir/instances/instance/logs/DBClean/DBClean.timestamp.log
The log level for the cleanup can be...
- NONE
- ERROR
- WARNING
- NORMAL
- INFO/VERBOSE
- DEBUG
By default the log level is set to DEBUG.
In the case of a fatal error during cleanup, refer to...
WC_installdir/instances/instance/logs/DBClean/System.timestamp.Properties
JVM properties are stored in this file.
To delete obsolete files associated with data assets...
WC_installdir/instances/instance/logs/DBClean/clean.asset.object.type.timestamp.sh
dbclean is also 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 dbclean 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 your database schema by creating new tables, use dbclean to clean your new tables. If you have changed your 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), review and possibly modify or add SQL statements in the CLEANCONF table so DBClean will behave correctly in the new schema.
Related tasks
Set the PATH environment variables for WebSphere Commerce utilities
Configure databases for use with the staging utilities
Cleaning the database
Add a configuration to the Database Cleanup utility
Dbclean utility script
Database Cleanup utility objects
Examples: Deleting objects