Steps to run Purge Script for CMS data and runs from APP node:
--------------------------------------------------------------
The CMS data deletion involves Workorders, Titles and Metadata enhancement requrest deletion.

1. Login as edb user on the CMS DB server.

2. Change directory to 

        cd /opt/db/scripts/cms


3. Parameters of the purge scripts.

   a) Title purge script:
      --------------------
          TITLES_TOBE_DELETED      = Number of (soft deleted) titles are to be deleted under the batch from CMS database permanently.
          TITLE_RETENTION_MARGIN   = Number of days that a title must be soft deleted before selection for physical delete. 

   b) Work order purge script:
      ------------------------
          WORKORDER_RETENTION_DAYS = Number of days back from sysdate to retain the workorder data in CMS.

   c) Metadata Enhancement Request purge script:
      -------------------------------------------
          ME_REQUESTS_RETENTION_DAYS = Number of days back from sysdate to retain the Metadata Enhancement requests data in CMS.

   d) Work order Elastic search purge script:
      ---------------------------------------
          No parameters are required for this script to run.  This script purges work orders from the Elastic search database for the same Work Orders that were purged from the EDB database.


4. Running purge scripts based on your requirement:

 (I) Purging Titles, WOs and ME Request data (all three):  
 
	  /opt/db/scripts/cms/purge_cms_data.sh {TITLES_TOBE_DELETED} {TITLE_RETENTION_MARGIN} {WORKORDER_RETENTION_DAYS} {ME_REQUESTS_RETENTION_DAYS} >> /opt/db/scripts/cms/purge_cms.log


 (II) Purging only Titles data, run the script as follows.

         /opt/db/scripts/cms/purge_cms_titles.sh {TITLES_TOBE_DELETED} {TITLE_RETENTION_MARGIN} >> /opt/db/scripts/cms/purge_titles.log



 (III) Purging only Work order data, run the script as follows.

         /opt/db/scripts/cms/purge_cms_wos.sh {WORKORDER_RETENTION_DAYS} >> /opt/db/scripts/cms/purge_wo.log



 (IV) Purging only Metadata Enhancement Requests data, run the script as follows.

         /opt/db/scripts/cms/purge_cms_me.sh {ME_REQUESTS_RETENTION_DAYS} >> /opt/db/scripts/cms/purge_cms_me.log


 (v) Purging Work orders Data from Elastic search based for the ids purged in EDB database.

         /opt/db/scripts/cms/purge_elasticsearch_wos.sh >> /opt/db/scripts/cms/purge_elasticsearch.log


Important Note: The purge script should only be run during periods of low or no activity on CMS application server.
