Shell scripts are provided  to delete old object versions that are no more needed. Deleting old object versions will restore database storage space and therefore improve database performance.

There are 2 shell scripts provided:

$TOP/src/maintenance/estimate_old_versions.sh
$TOP/src/maintenance/delete_old_versions.sh

The estimate_old_versions.sh script provides a size estimate for the number of old object versions in various WebSphere Product Center database tables. 

The delete_old_versions.sh script deletes the old object versions in various WebSphere Product Center database tables and will not delete the objects that belong to the latest version. This script has same parameters as of estimate_old_versions.sh

Scripts are designed to be executed when WebSphere Product Center is running. Because of potential performance impacts, you should run this script when the WebSphere Product Center application is lightly used, for example during night time or weekends.

To improve database performance and to minimize the size of your database, you should run this script at least once a week to delete old object versions.

***********
* WARNING *
***********

It is recommended to back up the database before running the delete_old_versions.sh script.

Script usage:
-------------

./estimate_old_versions.sh --code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS> [--ctg=<Catalog_ID>] [--start_date=<YYYY-MM-DD.HH24:MI:SS>] [--confirm_db=no]

./delete_old_versions.sh --code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS> [--ctg=<Catalog_ID>] [--start_date=<YYYY-MM-DD.HH24:MI:SS>] [--confirm_db=no]

Mandatory parameters:
---------------------

code: Company code that is used to log in to WebSphere Product Center.

end_date: Old objects that are created before this date are estimated or deleted.

Optional parameters:
--------------------

ctg: Catalog ID that should be checked for old object versions. This ID can be retrieved using the following SQL query: "select * from ctg"

start_date: Old objects that are created after this date and until the end_date are estimated or deleted.

confirm_db: Confirmation flag to proceed with script execution with or without confirmation prompt. If no is specified, the script will not prompt for database user confirmation.

Examples:
---------

./estimate_old_versions.sh --code=ibm --end_date=2009-01-31.18:30:30

./estimate_old_versions.sh --code=ibm --end_date=2009-01-31.18:30:30 --start_date=2008-01-31.18:30:30

./estimate_old_versions.sh --code=ibm --end_date=2009-01-31.18:30:30  --ctg=2063

./estimate_old_versions.sh --code=ibm --end_date=2009-01-31.18:30:30 --start_date=2008-01-31.18:30:30 --ctg=2063

./delete_old_versions.sh --code=ibm --end_date=2009-01-31.18:30:30

./delete_old_versions.sh --code=ibm --end_date=2009-01-31.18:30:30 --start_date=2008-01-31.18:30:30

./delete_old_versions.sh --code=ibm --end_date=2009-01-31.18:30:30  --ctg=2063

./delete_old_versions.sh --code=ibm --end_date=2009-01-31.18:30:30 --start_date=2008-01-31.18:30:30 --ctg=2063


Actions done by various combination of parameters are below:

estimate_old_version.sh	--code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS>	
Action: Provides an estimate of old version objects that exist in the given company code and created before the end_date

estimate_old_version.sh	--code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS> --start_date=<YYYY-MM-DD.HH24:MI:SS> 	
Action: Provides an estimate of old version objects that exist in the given company code and created between start_date and end_date

estimate_old_version.sh	--code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS> --ctg=<Catalog_ID>	
Action: Provides an estimate of old version objects that exist in the given company code, catalog and created before the end_date

estimate_old_version.sh	--code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS> --ctg=<Catalog_ID> --start_date=<YYYY-MM-DD.HH24:MI:SS> 	
Action: Provides an estimate of old version objects that exist in the given company code, catalog and created between start_date and end_date

delete_old_version.sh	--code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS>	
Action: Deletes old version objects that exist in the given company code and created before the end_date

delete_old_version.sh	--code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS> --start_date=<YYYY-MM-DD.HH24:MI:SS> 	
Action: Deletes old version objects that exist in the given company code and created between start_date and end_date

delete_old_version.sh	--code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS> --ctg=<Catalog_ID>	
Action: Deletes old version objects that exist in the given company code, catalog and created before the end_date

delete_old_version.sh	--code=<Company_code> --end_date=<YYYY-MM-DD.HH24:MI:SS> --ctg=<Catalog_ID> --start_date=<YYYY-MM-DD.HH24:MI:SS> 	
Action: Deletes old version objects that exist in the given company code, catalog and created between start_date and end_date
