19 DBMS_APP_CONT_ADMIN

This package provides a collection dba level admin operations in relation to Application Continuity.

This chapter contains the following topics:

19.1 DBMS_APP_CONT_ADMIN Security Model

Applications must have the EXECUTE privilege on the DBMS_APP_CONT_ADMIN package.

19.2 Summary of DBMS_APP_CONT_ADMIN Subprograms

This topic lists the DBMS_APP_CONT_ADMIN subprograms in alphabetical order and briefly describes them.

Table 19-1 DBMS_APP_CONT_ADMIN Package Subprograms

Subprogram Description
ACCHK_PURGE Procedure This procedure purges all previously collected ACCHK information.
ACCHK_SET Procedure This procedure enables or disables data collection for acchk protection for your application when using Application Continuity or Transparent Application Continuity. The DISABLE_TIME parameter is used to extend the runtime. Default is 10 minutes.

ADD_SQL_CONNECTION_TEST Procedure

This procedure adds a new connection test that is used during draining sessions before planned maintenance begins.

DELETE_SQL_CONNECTION_TEST Procedure

This procedure deletes a connection test that is no longer needed for planned draining. Removing a test applies immediately to all RAC instances where the PDB is open.

DISABLE_CONNECTION_TEST Procedure

This procedure disables usage of a connection test during draining of sessions.
DISABLE_FAILOVER Procedure This procedure disables failover on a given service.
ENABLE_AC Procedure This procedure enables Application Continuity (AC) on a given service.
ENABLE_CONNECTION_TEST Procedure

This procedure enables usage of a connection test for draining database sessions before planned maintenance. Enabling a test applies immediately to all RAC instances where the PDB is open.

ENABLE_TAC Procedure This procedure enables Transparent Application Continuity (TAC) on a given service.
ENABLE_TAF Procedure This procedure enables Transparent Application Failover (TAF) for a given service.
ENABLE_TG Procedure This procedure enables Transaction Guard on a given service.
   
SET_DRAINING Procedure This procedure configures draining options for your service, such as timeout value and stop option.
SET_LOAD_BALANCING_GOAL Procedure This procedure configures load balancing options for your service.

19.2.1 ACCHK_PURGE Procedure

This procedure purges all previously collected ACCHK information.

  • You should call ACCHK_PURGE before ACCHK_SET, which loads the filters.
  • ACCHK_PURGE is set at the PDB level.

Syntax

DBMS_APP_CONT_ADMIN.ACCHK_PURGE (
   start_time IN DATE    DEFAULT NULL,
   end_time   IN DATE    DEFAULT NULL,
   purge_all  IN BOOLEAN DEFAULT FALSE);

Parameters

Table 19-2 ACCHK_PURGE Procedure Parameters

Parameter Description

start_time

The start time from which you want to purge the ACCHK information.

end_time

The end time till when you want to purge the ACCHK information.

purge_all
This parameter is used to delete all ACCHK information.
  • TRUE- enables deletion of all ACCHK information.
  • FALSE- disables deletion of all ACCHK information. When this parameter is set to FALSE, then only the specified ACCHK information is deleted.

Examples

The following examples illustrate how to purge all ACCHK information:
SQL> execute dbms_app_cont_admin.acchk_purge(purge_all => TRUE);

19.2.2 ACCHK_SET Procedure

This procedure enables or disables data collection for acchk protection reports for your application when using Application Continuity or Transparent Application Continuity. The DISABLE_TIME parameter is used to extend the runtime. Default value is 10 minutes.

Enabling or disabling data collection applies to the level connected, that is, a CDB or a PDB.
  • acchk is enabled/disabled at your CDB if connected to the container.
  • acchk is enabled/disabled at your PDB only when connected to the PDB.

Data collection applies to new sessions only.

Once enabled, data is collected for the workload run under this service. You can then view this data in the ACCHK_REPORTs and can also be mined in the ACCHK views.

Syntax

DBMS_APP_CONT_ADMIN.ACCHK_SET (
   enabled                  IN BOOLEAN,
   disable_time_in_seconds  DEFAULT 600);

Parameters

Table 19-3 ACCHK_SET Procedure Parameters

Parameter Description

enabled

This parameter is used to enable or disable data collection at a CDB or PDB level.
  • TRUE-enables data collection at this level.
  • FALSE-explicitly disables data collection.

disable_time_in_seconds

Optional parameter used to disable ACCHK tracing automatically in a given number of seconds.

The maximum value that you can specify is 3600 seconds.

The default value is 600 seconds.

Usage Notes

  • This procedure is owned by SYS at CDB$ROOT or PDB level, or by SYS when not multitenant
  • The acchk activation is enabled across all instances of RAC supporting that service.
  • Enabling is persistent to allow for failover and restart tests, that is, implementation uses ALTER SESSION SET EVENTS ….. SCOPE=BOTH. The enable is per database. For Data Guard, enable and disable must be at each database.

Examples

Application Continuity Protection Check is not enabled by default. Follow this procedure to enable or disable ACCHK and generate reports to check protection level for the applications.

  1. Grant read access to the users, who will run the Application Continuity Protection Check report and views, using the ACCHK_READ role:

    GRANT ACCHK_READ TO USER;
  2. Enable Application Continuity tracing for your applications using the dbms_app_cont_admin.acchk_set(true) procedure:
    SQL> execute dbms_app_cont_admin.acchk_set(true);

    By default, ACCHK is disabled automatically after 600 seconds. You can specify a lower number to reduce the auto disable time. For example, to disable ACCHK after 300 seconds:

    SQL> dbms_app_cont_admin.acchk_set(true,300);

    The dbms_app_cont_admin.acchk_set(true) procedure enables Application Continuity tracing at the database level to which you are connected. If you are connected at the CDB level, then tracing is enabled for the CDB, and if you are connected at the PDB level, then tracing is enabled for the PDB.

    Note:

    Set the COMPATIBLE parameter to 12.2.0 or greater.
  3. To disable Application Continuity tracing for new sessions in your applications:

    SQL> execute dbms_app_cont_admin.acchk_set(false);

    Note:

    The tracing will not be disabled for the current sessions until the sessions are terminated.

19.2.3 ADD_SQL_CONNECTION_TEST Procedure

This procedure adds a new connection test that is used during draining sessions before planned maintenance begins. Use this procedure when the SQL connection test is not covered by standard tests. The test is enabled when added. If the optional service name qualifier is provided, the test only applies only to that service name.

Syntax

DBMS_APP_CONT_ADMIN.ADD_SQL_CONNECTION_TEST (
   connection_test          IN VARCHAR2
   service_name             IN VARCHAR2   DEFAULT NULL);

Parameters

Table 19-4 ADD_SQL_CONNECTION_TEST Procedure Parameters

Parameter Description

CONNECTION_TEST

The SQL text used to test and drain connections.

SERVICE_NAME

Optional service name qualifier.

Usage Notes

The ADD_SQL_CONNECTION_TEST Procedure adds a connection test for the purpose of draining sessions before planned maintenance begins. The connection test is used by the application to test connections that are marked for draining. Sessions are set for draining at stop and relocate operations for services or PDBs. When set the RDBMS closes the connection while draining so the application sees no errors during planned maintenance. You can enter as many CONNECTION TESTs as needed. They are used only during planned maintenance. The tests apply to all RAC instances.

Check online documentation for latest updates on service qualifier availability.

Added connection can be viewed by querying the view DBA_CONNECTION_TESTS.

This procedure is owned by SYS and is granted to users for execution at CDB$ROOT or PDB levels, or when not multitenant, at dictionary level.

19.2.4 DELETE_SQL_CONNECTION_TEST Procedure

This procedure deletes a connection test that is no longer needed for planned draining. Removing a test applies immediately to all RAC instances where the PDB is open.

Syntax

DBMS_APP_CONT_ADMIN.DELETE_SQL_CONNECTION_TEST (
   connection_test          IN VARCHAR2
   service_name             IN VARCHAR2   DEFAULT NULL);

Parameters

Table 19-5 DELETE_SQL_CONNECTION_TEST Procedure Parameters

Parameter Description

CONNECTION_TEST

The SQL text used to test and drain connections.

SERVICE_NAME

Optional service name qualifier.

If the optional SERVICE_NAME qualifier is provided, only the test for that service name is deleted.

Usage Notes

If you are not certain if a test should be deleted, you can disable the test using DISABLE_CONNECTION_TEST Procedure. Only custom SQL tests can be deleted. Predefined tests cannot be deleted. Check for latest updates on service qualifier availability.

This procedure is owned by SYS at CDB$ROOT or PDB level, or SYS for when not multitenant.

Connection tests and their status can be checked by querying the view DBA_CONNECTION_TESTS.

19.2.5 DISABLE_CONNECTION_TEST Procedure

This procedure disables usage of a connection test during draining of sessions. Disabling a test applies immediately to all RAC instances where the PDB is open.

Syntax

DBMS_APP_CONT_ADMIN.DISABLE_CONNECTION_TEST (
   connection_test_type     IN VARCHAR2,
   connection_test          IN VARCHAR2,
   service_name             IN VARCHAR2   DEFAULT NULL);

Parameters

Table 19-6 DISABLE_CONNECTION_TEST Procedure Parameters

Parameter Description

CONNECTION_TEST_TYPE

The permitted values are:

  • DBMS_APP_CONT_ADMIN.SQL_TEST

  • DBMS_APP_CONT_ADMIN.PING_TEST

  • DBMS_APP_CONT_ADMIN.ENDREQUEST_TEST

CONNECTION_TEST

The SQL text used to test and drain connections.

This parameter is allowed only if the value of CONNECTION_TEST_TYPE is SQL_TEST.

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, only the test for that service name is enabled. A disable at service name level takes precedence over an enable at PDB level. That is the PDB can be enabled, and the service disabled.

Usage Notes

This procedure is owned by SYS and is granted to users for execution at CDB$ROOT or PDB levels, or when not multitenant, at dictionary level.

Connection tests and their status can be checked by querying the view DBA_CONNECTION_TESTS.

19.2.6 DISABLE_FAILOVER Procedure

This procedure disables failover on a given service.

Syntax

DBMS_APP_CONT_ADMIN.DISABLE_FAILOVER (
    service_name IN VARCHAR2);

Parameters

Table 19-7 DISABLE_FAILOVER Procedure Parameters

Parameter Description

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, then failover is disabled only for that service name.

Usage Notes

  • You must have the PDBADMIN user permissions to use this procedure.
  • Use the full service name on which you want to disable the failover.

Examples

The following example illustrates how to disable failover for a service:
SQL> execute dbms_app_cont_admin.disable_failover('TPURGENT');

19.2.7 ENABLE_AC Procedure

This procedure enables Application Continuity (AC) on a given service.

Syntax

DBMS_APP_CONT_ADMIN.ENABLE_AC (
   service_name              IN VARCHAR2,
   failover_restore          IN VARCHAR2       DEFAULT 'LEVEL1'
   replay_initiation_timeout IN BINARY_INTEGER DEFAULT 300);

Parameters

Table 19-8 ENABLE_AC Procedure Parameters

Parameter Description

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, AC is enabled only for the specified service. An enable at service name level overrides any higher-level disables. That is, the PDB can be disabled, and the service enabled.

FAILOVER_RESTORE

Failover restore. Possible values are NONE or LEVEL1.

REPLAY_INITIATION_TIMEOUT

Replay timeout that specifies how many seconds after a request is submitted to allow that request to replay.

Usage Notes

  • You must have the PDBADMIN user permissions to use this procedure.
  • Use the full service name on which you want to enable AC.

Examples

The following example illustrates how to enable Application Continuity for your service:
SQL> execute dbms_app_cont_admin.enable_ac('TPURGENT', 'LEVEL1', 600);

19.2.8 ENABLE_CONNECTION_TEST Procedure

This procedure enables usage of a connection test for draining database sessions before planned maintenance. Enabling a test applies immediately to all RAC instances where the PDB is open.

Syntax

DBMS_APP_CONT_ADMIN.ENABLE_CONNECTION_TEST (
   connection_test_type     IN VARCHAR2,
   connection_test          IN VARCHAR2,
   service_name             IN VARCHAR2   DEFAULT NULL);

Parameters

Table 19-9 ENABLE_CONNECTION_TEST Procedure Parameters

Parameter Description

CONNECTION_TEST_TYPE

The connection type used when managing connection tests for draining before planned maintenance. See ADD, DELETE, ENABLE, DISABLE procedures for connection tests.

The permitted values are:

  • DBMS_APP_CONT_ADMIN.SQL_TEST

  • DBMS_APP_CONT_ADMIN.PING_TEST

  • DBMS_APP_CONT_ADMIN.ENDREQUEST_TEST

CONNECTION_TEST

The SQL text used to test and drain connections at the RDBMS before planned maintenance starts.

This parameter is allowed only if the value of CONNECTION_TEST_TYPE is SQL_TEST.

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, only the test for that service name is enabled. An enable at service name level overrides any higher-level disables. That is, the PDB can be disabled, and the service enabled.

Usage Notes

  • This procedure is owned by SYS and is granted to users for execution at CDB$ROOT or PDB levels, or when not multitenant, at dictionary level

  • ENABLE_CONNECTION_TEST enables a connection test for draining sessions during planned maintenance. The enable operation applies to all RAC instances where the PDB is open. It persists across database restarts.

  • This procedure is owned by SYS and is granted to users for execution at CDB$ROOT or PDB levels, or when not multitenant, at dictionary level.

19.2.9 ENABLE_TAC Procedure

This procedure enables Transparent Application Continuity (TAC) on a given service.

Syntax

DBMS_APP_CONT_ADMIN.ENABLE_TAC (
   service_name              IN VARCHAR2,
   failover_restore          IN VARCHAR2       DEFAULT 'AUTO'
   replay_initiation_timeout IN BINARY_INTEGER DEFAULT 300
   session_state_consistency IN VARCHAR2       DEFAULT 'AUTO');

Parameters

Table 19-10 ENABLE_TAC Procedure Parameters

Parameter Description

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, TAC is enabled only for the specified service. An enable at service name level overrides any higher-level disables. That is, the PDB can be disabled, and the service enabled.

FAILOVER_RESTORE

Failover restore. Possible values are AUTO or LEVEL1.

REPLAY_INITIATION_TIMEOUT

Replay timeout that specifies how many seconds after a request is submitted to allow that request to replay.

SESSION_STATE_CONSISTENCY

Session State Consistency. Possible values are AUTO or HYBRID.

Exceptions

  • When FAILOVER_RESTORE is set to NULL or FAILOVER_RESTORE is not set to AUTO or LEVEL1: ORA-20000 - Invalid failover_restore parameter.
  • When SESSION_STATE_CONSISTENCY is set to NULL or SESSION_STATE_CONSISTENCY is not set as AUTO: ORA-20000 - Invalid session_state_consistency parameter.

Usage Notes

  • You must have the PDBADMIN user permissions to use this procedure.
  • Use the full service name on which you want to enable TAC.

Examples

The following example illustrates how to enable Transparent Application Continuity for your service:
SQL> execute dbms_app_cont_admin.enable_tac('TPURGENT', 'AUTO', 600, 'AUTO');

19.2.10 ENABLE_TAF Procedure

This procedure enables Transparent Application Failover (TAF) for a given service.

Syntax

DBMS_APP_CONT_ADMIN.ENABLE_TAF (
   service_name      IN VARCHAR2,
   failover_type     IN VARCHAR2  DEFAULT 'AUTO'
   failover_restore  IN VARCHAR2  DEFAULT 'LEVEL1');

Parameters

Table 19-11 ENABLE_TAF Procedure Parameters

Parameter Description

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, TAF is enabled only for the specified service. An enable at service name level overrides any higher-level disables. That is, the PDB can be disabled, and the service enabled.

FAILOVER_TYPE

Failover type. Possible values are LOW, MEDIUM, or HIGH.

FAILOVER_RESTORE

Failover restore. Possible values are NONE or LEVEL1.

Usage Notes

  • You must have the PDBADMIN user permissions to use this procedure.
  • Use the full service name on which you want to enable TAF.

Examples

The following example illustrates how to enable TAF SELECT for the current service:
SQL> execute dbms_app_cont_admin.enable_taf(`LOW`);
The following example illustrates how to enable TAF BASIC for the current service:
SQL> execute dbms_app_cont_admin.enable_taf(`MEDIUM`, `SESSION`);

19.2.11 ENABLE_TG Procedure

This procedure enables Transaction Guard on a given service.

Syntax

DBMS_APP_CONT_ADMIN.ENABLE_TG (
   service_name IN VARCHAR2);

Parameters

Table 19-12 ENABLE_TG Procedure Parameters

Parameter Description

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, AC is enabled only for the specified service. An enable at service name level overrides any higher-level disables. That is, the PDB can be disabled, and the service enabled.

Usage Notes

  • You must have the PDBADMIN user permissions to use this procedure.
  • Use the full service name on which you want to enable Transaction Guard.

Examples

The following example illustrates how to enable Transaction Guard for your service:
SQL> execute dbms_app_cont_admin.enable_tg('TPURGENT');

19.2.12 SET_DRAINING Procedure

This procedure configures draining options for your service, such as timeout value and stop option.

Syntax

DBMS_APP_CONT_ADMIN.SET_DRAINING (
   service_name  IN VARCHAR2,
   drain_timeout IN BINARY_INTEGER DEFAULT 300
   stop_option   IN VARCHAR2       DEFAULT 'NONE');

Parameters

Table 19-13 SET_DRAINING Procedure Parameters

Parameter Description

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, draining is set only for that service.

DRAIN_TIMEOUT

Specify the time, in seconds, allowed for resource draining to be completed. Accepted values are an empty string (""), 0, or any positive integer.

STOP_OPTION

Specify the method of stopping the service. Available options are NONE, IMMEDIATE, or TRANSACTIONAL.

Examples

The following example illustrates how to set draining options for your service:
SQL> execute dbms_app_cont_admin.set_draining('TPURGENT', 300, 'IMMEDIATE');

19.2.13 SET_LOAD_BALANCING_GOAL Procedure

This procedure configures load balancing options for your service.

Syntax

DBMS_APP_CONT_ADMIN.SET_LOAD_BALANCING_GOAL (
   service_name IN VARCHAR2,
   goal         IN VARCHAR2);

Parameters

Table 19-14 SET_LOAD_BALANCING Procedure Parameters

Parameter Description

SERVICE_NAME

Optional service name qualifier. If the optional service name qualifier is provided, load balancing is set only for the specified service.

GOAL
Load balancing goal. Possible values are:
  • CLBGOAL- Connection Load Balancing Goal.
  • RLBGOAL- Runtime Load Balancing Goal.

Examples

The following example illustrates how to set load balancing goal for your service:
SQL> execute dbms_app_cont_admin.set_load_balancing('TPURGENT', 'CLBGOAL');