Warning: While the replication and operation modes may be changed for the secondary replication site, the user should never perform a manual takeover or switchover of SAP HANA System Replication outside of LifeKeeper. Doing so will result in an error state in which the SAP HANA System Replication modes do not align with the modes that LifeKeeper is expecting on the Active/Standby servers. This error state is represented in the LifeKeeper GUI with the following resource states:

While in this state, all monitoring for the SAP HANA resource will be suspended until the resource is brought in-service in LifeKeeper on the server that is intended to be the primary replication site.

Changing the Replication Mode

The SAP HANA System Replication mode can be changed by using the “hdbnsutil -sr_changemode” command, even while the database is running on the secondary replication site.

  1. Execute the following command on the secondary replication site:

su – <sid>adm -c “hdbnsutil -sr_changemode ––mode=[sync|syncmem|async]”

where <sid> is the lower-case SAP System ID for the SAP HANA installation and the desired replication mode (sync, syncmem, or async) is provided in the —mode option. The database can be running or stopped on the secondary site when this command is executed.

  1. To confirm that the replication mode was changed successfully, execute the following command on the secondary replication site:

su – <sid>adm -c “hdbnsutil -sr_state”

and verify that the “mode” parameter has been updated to the new replication mode.

After the next quickCheck interval (default 2 minutes), LifeKeeper will automatically detect the change and update the info fields for all equivalent SAP HANA resources to contain the new replication mode. This can be verified by inspecting the info field for the HANA resource using the following command:

/opt/LifeKeeper/bin/ins_list -d <HostName> -t <Tag> -f: | cut -d: -f6 | tr ‘\002’ ‘:’

where <HostName> is the host name of the server to obtain information on and <Tag> is the tag name of the SAP HANA resource in LifeKeeper (e.g., HANA-SPS_HDB00) on the given server.

The currently stored secondary replication mode is the third field in the output of this command:

SPS:HDB00:sync:shiba:logreplay

Changing the Operation Mode

Note: Changing the operation mode from logreplay or logreplay_readaccess to delta_datashipping will require a full data shipping from the primary site to the secondary site when replication resumes. This full data shipping will be performed automatically by SAP HANA when one of these operation mode changes is detected.

Changing the operation mode in SAP HANA System Replication typically requires stopping the database on the secondary site, re-registering it with the new operation mode, and restarting the database on the secondary site. In order to prevent LifeKeeper from automatically restarting the database on the secondary site during this process, it is recommended to suspend monitoring for the HANA resource until the database has been successfully re-registered with the new operation mode.

  1. Suspend monitoring of the HANA resource by creating the corresponding nomonitor flag on the server where the resource is currently Active (ISP):

/opt/LifeKeeper/bin/flg_create -f ‘nomonitor_<Tag>’

where <Tag> is the HANA resource tag in LifeKeeper on that server (e.g., HANA-SPS_HDB00). Once finished with this process, it is very important to remember to resume monitoring of the resource by removing the nomonitor flag with the command:

/opt/LifeKeeper/bin/flg_remove -f ‘nomonitor_<Tag>’

Warning: Failure to remove this flag after performing the maintenance operations will cause any failures of the SAP HANA database to go undetected by LifeKeeper.

  1. Ensure that the SAP HANA database is stopped on the backup server by executing the following command:

su – <sid>adm -c “sapcontrol -nr <HDB Inst# > -function StopSystem HDB

where <HDB Inst#> is the instance number for the SAP HANA database instance (e.g., for an instance named HDB00, the instance number is 00).

  1. Execute the following command on the backup server with the desired replication and operation modes to re-register it as a secondary replication site:

su – <sid>adm -c “hdbnsutil -sr_register ––name=<SecondarySiteName> ––remoteHost=<PrimaryHost> ––remoteInstance=<PrimaryInst#> ––replicationMode=[sync|syncmem|async] ––operationMode=[delta_datashipping|logreplay|logreplay_readaccess]”

where <SecondarySiteName> is the alias to be used by SAP HANA System Replication to identify the secondary replication site, <PrimaryHost> is the host name of the server which is currently registered as the primary replication site, and <PrimaryInst#> is the instance number for the HDB instance on the primary replication site. Note: It is not necessary to unregister the secondary site with the “hdbnsutil -sr_unregister” command before re-registering it with a new replication or operation mode.

  1. To verify that the backup server was successfully re-registered as a secondary replication site with the new operation mode, execute the following command on the backup server:

su – <sid>adm -c “hdbnsutil -sr_state”

and verify that “is secondary/consumer system” is true and that the parameter “operation mode” has been updated to the new operation mode.

  1. Once the backup server has been successfully registered as a secondary replication site, start the database by executing the following command on the backup server:

where su – <sid>adm -c “sapcontrol -nr <HDB Inst#> -function StartSystem HDB

where <HDB Inst#> is the instance number for the SAP HANA database instance.

  1. Once the process is complete, remove the nomonitor flag that was created in Step 1 in order to resume LifeKeeper monitoring of the HANA resource:

where /opt/LifeKeeper/bin/flg_remove -f ‘nomonitor_<Tag>’

Warning: Failure to remove this flag will cause any failures of the SAP HANA database to go undetected by LifeKeeper.

After the next quickCheck interval (default 2 minutes), LifeKeeper will automatically detect the change and update the info fields for all equivalent SAP HANA resources to contain the new operation mode. This can be verified by inspecting the info field for the HANA resource using the following command:

/opt/LifeKeeper/bin/ins_list -d <HostName> -t <Tag> -f: | cut -d: -f6 | tr ‘\002’ ‘:’

where <HostName> is the host name of the server to obtain information on and <Tag> is the tag name of the SAP HANA resource in LifeKeeper (e.g., HANA-SPS_HDB00) on the given server.

The currently stored secondary replication mode is the fifth field in the output of this command:

SPS:HDB00:sync:shiba:logreplay

Feedback

Thanks for your feedback.

Post your comment on this topic.

Post Comment