Deleting user objects

You can use the Database Cleanup utility to delete user objects when the objects are no longer required.

About this task

Records in the USERS database table that correspond to guest customers are populated with a time stamp value in the PREVLASTSESSION column. However, if your site is migrated from WebSphere Commerce 5.1 or 5.4, some of the guest customer records can have a null value in this column. To run the Database Cleanup utility, ensure that each guest customer record contains a time stamp value for the PREVLASTSESSION column. This column value is used to determine the age of the user object. To determine whether 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 time stamp 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'
  • Oracle
    update users set prevlastsession = sysdate - timestamp_value where prevlastsession is null and registertype = 'G' ; 
    For example, to set the time stamp 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

  1. From the WC_installdir/bin directory, run the following script:
    • DB2
      • LinuxAIXFor IBM i OS operating system  ./dbclean.sh -object user -type typename -db dbname -dbuser user -days daysold -loglevel loglevel -instancexml WC_installdir/instances/instance_name/xml/instance_name.xml
      • Windows dbclean -object user -type typename -db dbname -days daysold -loglevel loglevel -instancexml WC_installdir/instances/instance_name/xml/instance_name.xml
    • Oracle
      • AIX ./dbclean.sh -object user -type typename -db dbname -days daysold -loglevel loglevel -dbtype oracle -dbuser user -dbpasswd password -instancexml WC_installdir/instances/instance_name/xml/instance_name.xml
      • Windows dbclean -object user -type typename -db dbname -days daysold -loglevel loglevel -dbtype oracle -dbuser user -dbpasswd password -instancexml WC_installdir/instances/instance_name/xml/instance_name.xml

      Use host:port:sid for the database name. For example, myhost:1521:mydb.

    where:

    type
    guest
    Guest customer.
    registered
    Registered customer.
  2. Examine the WC_installdir/instances/instance_name/logs/DBClean/DBClean.timestamp.log file.