Administer > Database Cleanup utility > Clean the database
Delete user objects
Records in the USERS database table that correspond to guest customers are populated with a timestamp value in the PREVLASTSESSION column. However, if you have migrated from WebSphere Commerce 5.1 or 5.4, some of the migrated guest customer records may have a null value in this column.
To properly run the Database Cleanup utility, ensure that each guest customer record contains a timestamp value for the PREVLASTSESSION column, since this column value is used to determine the age of the user object.
To determine if the database currently contains records that need to be populated, run the following SQL statement:
select users_id, prevlastsession from users where prevlastsession is null and registertype = 'G'
If this SQL query returns one or more records, run the following SQL statement to populate the PREVLASTSESSION column within the USERS database table:
update users set prevlastsession = current timestamp - timestamp_value where prevlastsession is null and registertype = 'G'
For example, to set the timestamp to be 30 days before the current date, run the following statement:
update users set prevlastsession = current timestamp - 30 days where prevlastsession is null and registertype = 'G'
update users set prevlastsession = sysdate - timestamp_value where prevlastsession is null and registertype = 'G' ;
For example, to set the timestamp to be 30 days before the current date, run the following statement:
update users set prevlastsession = sysdate - 30 days where prevlastsession is null and registertype = 'G' ;
Procedure
- From the WC_INSTALL/bin directory, run the following script:
- ./dbclean.sh -object user -type typename -db dbname -dbuser user -days daysold -loglevel loglevel -instancexml WC_INSTALL/instances/instance/xml/ instance.xml
- dbclean -object user -type typename -db dbname -days daysold -loglevel loglevel -instancexml WC_INSTALL/instances/instance/xml/ instance.xml
- ./dbclean.sh -object user -type typename -db dbname -days daysold -loglevel loglevel -dbtype oracle -dbuser user -dbpasswd password -instancexml WC_INSTALL/instances/instance/xml/ instance.xml
- dbclean -object user -type typename -db dbname -days daysold -loglevel loglevel -dbtype oracle -dbuser user -dbpasswd password -instancexml WC_INSTALL/instances/instance/xml/ instance.xml
Use host:port:sid for the database name. For example, myhost:1521:mydb.
Notes:
- For the -type parameter, you can specify guest to indicate a guest customer or registered to indicate a registered customer.
- For details on the syntax and parameters for the dbclean script, see Database Cleanup utility script.
- Examine the WC_INSTALL/instances/instance/logs/DBClean/DBClean. timestamp.log file.
Related concepts
Related reference
Database Cleanup utility objects