Purging Database Tables and Modifying Retention > Customize Data Purging Retention Periods for SDK User-Defined Database Objects
  
Version 10.2.01P10
Customize Data Purging Retention Periods for SDK User-Defined Database Objects
Because data collection continuously adds data to the database, management of the database size becomes an essential task. For objects created via the SDK, a data retention period can be defined along with the database schema, to align with your IT Analytics reporting requirements. Data retention (purging rules) described in this section apply only to user-defined objects defined by an SDK project; API and database objects are handled by system parameters.
Purging rules (data retention periods) are specific to an object, such as array disk performance, and they are used to maintain corresponding database tables. These rules are configured at the beginning of the object’s definition in the schema template json file.
Best Practice: Configure retention days for objects that accumulate historical data over time, such as array performance. Other objects should not have data retention days.
In multi-tenancy environments, where IT Analytics domains partition client data, data retention periods can be configured for each domain. The data retention period for a domain applies to that domain and all of its sub-domains. For systems collected by traditional Data Collectors, use the procedure described in: Configure Data Retention Periods.
To enable purging for a user-defined object for a specific domain, take the following steps.
1. Log in to the Portal Server as user aptare.
2. Type the following command:
sqlplus <portal_user>/<portal_password>
where <portal_user> and <portal_password> are portal credentials to connect to the database.
3. At the command line, execute the following SQL statement, substituting relevant values for the variables shown < > in the syntax. See also, Find the Domain ID and Database Table Names, Example of a Retention Period Update for Multi-Tenancy Environments, and Example of a Retention Period Update for SDK User-Defined Objects.
INSERT INTO apt_purge_rules (table_name, product_type, table_description, date_column_name, retention_days, default_retention_days, domain_id, creation_date, last_updated)
SELECT table_name, product_type, table_description, date_column_name, <NewRetentionDays>, default_retention_days, <domain_id_value>, SYSDATE, SYSDATE
FROM apt_purge_rules
WHERE domain_id IS NULL
AND table_name = <tableName>;
Commit;
Find the Domain ID and Database Table Names
<domain_id_value>
Most environments have only one Domain ID; however, multi-tenancy environments, such as Managed Service Providers (MSPs), will have a different Domain ID for each of their customers.
To list the currently configured Domain IDs, use the following SQL SELECT statement:
SQL> SELECT * from apt_domain;
<tableName>
Find the relevant database table name for the retention period you want to change in Data Retention Periods for Historical and Performance Data.
Example of a Retention Period Update for SDK User-Defined Objects
The following example illustrates an update for a Pure Storage performance database table.
INSERT INTO apt_purge_rules (table_name, product_type, table_description, date_column_name, retention_days, default_retention_days, domain_id, creation_date, last_updated)
SELECT table_name, product_type, table_description, date_column_name, 50, default_retention_days, 100007, SYSDATE, SYSDATE
FROM apt_purge_rules
WHERE domain_id IS NULL
AND table_name = 'SDK_PURE_STORAGEARRAY_PERF';
Commit;