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 your 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:
- (DB2) 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:
update users set prevlastsession = current timestamp - 30 days where prevlastsession is null and registertype = 'G'- (Oracle) 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
update users set prevlastsession = sysdate - 30 days where prevlastsession is null and registertype = 'G' ;
To delete user objects:
- From the WC_installdir/bin directory, type the following:
- (DB2)
./dbclean.sh -object user -type typename -db dbname -dbuser user -days daysold -loglevel loglevel -instancexml WC_installdir/instances/instance/xml/ instance.xml
- Windows: dbclean -object user -type typename -db dbname -days daysold -loglevel loglevel -instancexml WC_installdir/instances/instance/xml/ instance.xml
- (Oracle)
./dbclean.sh -object user -type typename -db dbname -days daysold -loglevel loglevel -dbtype oracle -dbuser user -dbpasswd password -instancexml WC_installdir/instances/instance/xml/ instance.xml
- Windows: dbclean -object user -type typename -db dbname -days daysold -loglevel loglevel -dbtype oracle -dbuser user -dbpasswd password -instancexml WC_installdir/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_installdir/instances/instance/logs/DBClean/DBClean. timestamp.log file.
Related Concepts
Database Cleanup utility