14.3.1 Setting Up the Scripts in the Database

To archive and purge OAA data, you must set up one time scripts as follows:
  1. Enter a bash shell for the OAA management container:
    kubectl exec -n <namespace> -ti <oaamgmt-pod> -- /bin/bash
    For example:
    kubectl exec -n oaans -ti oaamgmt-oaa-mgmt-7dfccb7cb7-lj6sv -- /bin/bash
  2. Inside the management container, navigate to the /u01/oracle/db_purge/archive directory and login to the OAA database as a SYSDBA user. For example:
    cd /u01/oracle/db_purge/archive
    sqlplus sys/<password>@//db.example.com:1521/orcl.example.com as sysdba
  3. Grant the following privileges to the OAA schema, for example DEV_OAA, so that stored procedures can be created and executed:
    GRANT create any procedure TO <schema_name>;
    GRANT create any table TO <schema_name>;
    GRANT create any index TO <schema name>;
    GRANT create procedure TO <schema_name>;
    GRANT execute any procedure TO <schema_name>;
    exit;
  4. Login to the database as the OAA schema user, for example DEV_OAA:
    sqlplus <schema_name>/<password>@//db.example.com:1521/orcl.example.com
  5. Run the create_purge_proc.sql script to create the purge procedures:
    SQL> @create_purge_proc.sql
    When running the create_purge_proc.sql script, the script asks for the following inputs:
    Enter the value for oaam_data_tbs: <schema_name>_TBS_DATA
    Enter the value for oaam_indx_tbs: <schema_name>_TBS_INDX
  6. Validate the stores procedures to make sure they are valid and without errors:
    SELECT object_name,object_type FROM user_objects WHERE status='INVALID' and
          object_type='PROCEDURE';

Next steps: Running the Archive and Purge Scripts.