Skip to content

/AWS1/CL_NEP=>SWITCHOVERGLOBALCLUSTER()

About SwitchoverGlobalCluster

Switches over the specified secondary DB cluster to be the new primary DB cluster in the global database cluster. Switchover operations were previously called "managed planned failovers."

Promotes the specified secondary cluster to assume full read/write capabilities and demotes the current primary cluster to a secondary (read-only) cluster, maintaining the original replication topology. All secondary clusters are synchronized with the primary at the beginning of the process so the new primary continues operations for the global database without losing any data. Your database is unavailable for a short time while the primary and selected secondary clusters are assuming their new roles.

This operation is intended for controlled environments, for operations such as "regional rotation" or to fall back to the original primary after a global database failover.

Method Signature

IMPORTING

Required arguments:

iv_globalclusteridentifier TYPE /AWS1/NEPGLOBALCLUSTERID /AWS1/NEPGLOBALCLUSTERID

The identifier of the global database cluster to switch over. This parameter isn't case-sensitive.

Constraints: Must match the identifier of an existing global database cluster.

iv_targetdbclusteridentifier TYPE /AWS1/NEPSTRING /AWS1/NEPSTRING

The Amazon Resource Name (ARN) of the secondary Neptune DB cluster that you want to promote to primary for the global database.

RETURNING

oo_output TYPE REF TO /aws1/cl_nepswitchoverglbcls01 /AWS1/CL_NEPSWITCHOVERGLBCLS01

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_nep~switchoverglobalcluster(
  iv_globalclusteridentifier = |string|
  iv_targetdbclusteridentifier = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_globalcluster = lo_result->get_globalcluster( ).
  IF lo_globalcluster IS NOT INITIAL.
    lv_globalclusteridentifier = lo_globalcluster->get_globalclusteridentifier( ).
    lv_string = lo_globalcluster->get_globalclusterresourceid( ).
    lv_string = lo_globalcluster->get_globalclusterarn( ).
    lv_string = lo_globalcluster->get_status( ).
    lv_string = lo_globalcluster->get_engine( ).
    lv_string = lo_globalcluster->get_engineversion( ).
    lv_booleanoptional = lo_globalcluster->get_storageencrypted( ).
    lv_booleanoptional = lo_globalcluster->get_deletionprotection( ).
    LOOP AT lo_globalcluster->get_globalclustermembers( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_string = lo_row_1->get_dbclusterarn( ).
        LOOP AT lo_row_1->get_readers( ) into lo_row_2.
          lo_row_3 = lo_row_2.
          IF lo_row_3 IS NOT INITIAL.
            lv_string = lo_row_3->get_value( ).
          ENDIF.
        ENDLOOP.
        lv_boolean = lo_row_1->get_iswriter( ).
      ENDIF.
    ENDLOOP.
    lo_failoverstate = lo_globalcluster->get_failoverstate( ).
    IF lo_failoverstate IS NOT INITIAL.
      lv_failoverstatus = lo_failoverstate->get_status( ).
      lv_string = lo_failoverstate->get_fromdbclusterarn( ).
      lv_string = lo_failoverstate->get_todbclusterarn( ).
      lv_boolean = lo_failoverstate->get_isdatalossallowed( ).
    ENDIF.
  ENDIF.
ENDIF.