Purging Metadata Labels Using Fusion Middleware Control To metadata labels

Managing the Metadata Repository 14-31

14.5.2.2.1 Loading the Oracle WebCenter Purge Package Before you run the script for the

first time, you must install the purge package into the database by running the analytics_purge_package script: 1. Log in to the database as the schema user for the ACTIVITIES schema. 2. Execute the analytics_purge_package script. For example, for an Oracle Database: ORACLE_HOMEoracle_commoncommonsqloracleanalytics_purge_package.sql For a DB2 database, use the following command: db2 -td -f analytics_purge_package.sql

14.5.2.2.2 Running the Oracle WebCenter Purge Script The location of the analytics_purge_

facts.sql script differs depending on the type of database used: ■ Oracle Database: ORACLE_HOMEoracle_commoncommonsqloracleanalytics_purge_facts.sql ■ SQL Server: ORACLE_HOMEoracle_commoncommonsqlsqlserveranalytics_purge_facts.sql ■ DB2: ORACLE_HOMEoracle_commoncommonsqldb2analytics_purge_facts.sql The analytics_purge_facts.sql script takes the following parameters: ■ Month From: The script purges data that was created after the beginning of the specified month. Enter the month in the format MM. For example, 08 to specify August. ■ Year From: With the Month From parameter, the script purges data that was created after the beginning of the specified month in the specified year. Enter the year in YYYY format. For example, 2010. ■ Month To: The script purges data that was created through the end of the specified month. Enter the month in the format MM. For example, if you specify 09 for September, the script purges all data that was created before the end of September. ■ Year To: With the Month To parameter, the script purges data that was created through the end of the specified month in the specified year. Enter the year in YYYY format. For example, 2010. ■ Record Batch Size: The maximum size of records to commit at one time. ■ Max Run Time: The maximum amount of time, in minutes, that the you want the process to run. When the process reaches this time, it stops, regardless of the progress of the purge. When you are using an Oracle Database or a DB2 database, the script prompts you for input for each parameter. When you are using a SQL Server database, you must edit the analytics_purge_ facts.sql script to specify the criteria for purging data. Note: You cannot delete the current month. If you specify the current month, the script returns an error. 14-32 Oracle Fusion Middleware Administrators Guide The following shows an example of the script for SQL Server that deletes all Analytics fact database records from August 1, 2010 through November 30, 2010: CALL ANALYTICS_PURGE 8, --from month 2010, --from year 11, --to month 2010, --to_year 1000, --commit batch size 60 --max run time minutes ; To use the script: 1. If you are using a SQL Server database, edit the script to specify the criteria. 2. Execute the script. For example, to execute the script on an Oracle Database: sqlplus analytics_useranalytics_user_pwd analytics_purge_facts.sql Enter value for month_from: 8 old 4: ANALYTICS_PURGE.PURGE_ANALYTICS_INSTANCES month_from, -- MM format new 4: ANALYTICS_PURGE.PURGE_ANALYTICS_INSTANCES 8, -- MM format Enter value for year_from: 2010 old 5: year_from, -- YYYY format new 5: 2010, -- YYYY format Enter value for month_to: 11 old 6: month_to, -- MM format new 6: 11, -- MM format Enter value for year_to: 2010 old 7: year_to, -- YYYY format new 7: 2010, -- YYYY format Enter value for record_commit_batch_size: 1000 old 8: record_commit_batch_size, new 8: 1000, Enter value for max_minutes_run: 60 old 10: max_minutes_run ; new 10: 60 ; Log 09-12-2010 08:27:49 Purge Process Started . . . Log 09-12-2010 08:27:49 Log 09-12-2010 08:27:49 Purge Process Finished PLSQL procedure successfully completed.

14.5.2.3 Partitioning Oracle WebCenter Analytics Data

When you use the Oracle Fusion Middleware Metadata Repository Creation Utility RCU to create schemas, you can specify that Activity Graph and Analytics tables are partitioned see the Custom Variables screen in RCU. If you chose to partition the tables, Oracle WebCenter uses the native partitioning of the database to automatically create partitions. Oracle WebCenter provides a partition manager process, which runs once every 24 hours as a separate thread. It creates partitions on each Analytics fact table ASFACT_ in the database. Initially, the process generates six partitions in advance, with each partition corresponding to a month in the future. Whenever a new month starts, the partition manager creates a new partition. Managing the Metadata Repository 14-33 Partitioning the data makes it easier to purge data, because you can purge the data by dropping the older partitions that the partition manager creates. Thus, in a partitioned environment, the recommended method for purging data is simply to drop the month-based partitions that are no longer required. For example, to drop older partitions for a table, use the following SQL command: alter table table_name drop partition partition_name; Note: The WC_Utilities Managed Server must be started for the partition manager process to run.