Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sawa_Ito
Product and Topic Expert
Product and Topic Expert
0 Kudos
このブログは、2023 年 3 月 23 日に SAP ジャパン公式ブログに掲載されたものを SAP ジャパン公式ブログ閉鎖に伴い転載したものです。




このブログは、c.baker が執筆したブログ「Adding a DR node to ASE Always-on for a Custom Application (Part 2)」(2022 年 12 月 9 日)の抄訳です。




 



(… パート 1 からの続きです)


 


HADR クラスターへのデータベースの追加


 

既存のデータベースをレプリケーションを利用して HADR クラスターに追加するには、以下の 2 つの方法があります。

  • レスポンスファイル「setuphadr 」を使用してデバイスとデータベースを作成する。

  • Replication Management Agent (RMA) コマンド「sap_update_replication」と「sap_materialize」を使用する。


最初の方法は、パート 1 で紹介したレスポンスファイルを使用して <SID> データベースを HADR クラスターと DR ノードに追加する方法です。

データベース追加のステップは以下のとおりです。

 

  1. 最初にデータベースを作成するか、プライマリー(アクティブ)ノードにすでにデータベースが存在している必要があります。

  2. スタンバイ(と DR ノード)にプライマリーと同じサイズのデータベースを作成します。

  3. マスターデータベースがすでにレプリケートされているので、dbo の新しい SUID もレプリケートされますが、dbo への変更については、それぞれのターゲットデータベースインスタンスでも実行する必要があります。

  4. DR_maint (マスターにすでにある SUID)も、データベースのターゲットインスタンスごとの dbo のエイリアスとして追加する必要があります。これは 「sap_update_replication」 (以下)では行われません。

  5. データベースオプションへの変更はすべて、ターゲットインスタンスごとに実行する必要があります。

  6. 「sap_update_replication」RMA マンドを実行すると、データベースがスタンバイと DR ノードに追加されます。

  7. データベースは、ターゲットインスタンスごとに別の「sap_materialize」 RMA コマンドを発行することで、ターゲットインスタンスに対してマテリアライズされている必要があります。


 

例えば、

上記のステップ 1) や 2) では、isql を使用して、以下のコマンドを各インスタンス(PRIMARY_ASE、COMPANION_ASE、DR_ASE)で実行します。

 
disk init name="tpccdata",physname="/data/ASE/data/tpccdata.dat",size="2048M"
go
disk init name="tpcclog",physname="/data/ASE/data/tpcclog.dat",size="2048M"
go
create database tpcc on tpccdata = "2048M" log on tpcclog = "2048M"
go
sp_dboption tpcc, 'trunc. log on chkpt.', true
go

 

アウトプットは以下のようになります。

 
PRIMARY_ASE:

CREATE DATABASE: allocating 131072 logical pages (2048.0 megabytes) on disk 'tpccdata' (131072 logical pages requested).
CREATE DATABASE: allocating 131072 logical pages (2048.0 megabytes) on disk 'tpcclog' (131072 logical pages requested).
Processed 103 allocation unit(s) out of 1024 units (allocation page 143104). 10% completed.
Processed 205 allocation unit(s) out of 1024 units (allocation page 156160). 20% completed.
Processed 308 allocation unit(s) out of 1024 units (allocation page 169216). 30% completed.
Processed 410 allocation unit(s) out of 1024 units (allocation page 182272). 40% completed.
Processed 512 allocation unit(s) out of 1024 units (allocation page 66560). 50% completed.
Processed 615 allocation unit(s) out of 1024 units (allocation page 208384). 60% completed.
Processed 717 allocation unit(s) out of 1024 units (allocation page 92928). 70% completed.
Processed 820 allocation unit(s) out of 1024 units (allocation page 234240). 80% completed.
Processed 922 allocation unit(s) out of 1024 units (allocation page 247296). 90% completed.
Processed 1024 allocation unit(s) out of 1024 units (allocation page 261888). 100% completed.
Database 'tpcc' is now online.
Database option 'trunc. log on chkpt.' turned ON for database 'tpcc'.
Running CHECKPOINT on database 'tpcc' for option 'trunc. log on chkpt.' to take effect.
(return status = 0)

COMPANION_ASE:

CREATE DATABASE: allocating 131072 logical pages (2048.0 megabytes) on disk 'tpccdata' (131072 logical pages requested).
CREATE DATABASE: allocating 131072 logical pages (2048.0 megabytes) on disk 'tpcclog' (131072 logical pages requested).
Processed 103 allocation unit(s) out of 1024 units (allocation page 143104). 10% completed.
Processed 205 allocation unit(s) out of 1024 units (allocation page 156160). 20% completed.
Processed 308 allocation unit(s) out of 1024 units (allocation page 40192). 30% completed.
Processed 410 allocation unit(s) out of 1024 units (allocation page 53248). 40% completed.
Processed 512 allocation unit(s) out of 1024 units (allocation page 66304). 50% completed.
Processed 615 allocation unit(s) out of 1024 units (allocation page 208640). 60% completed.
Processed 717 allocation unit(s) out of 1024 units (allocation page 221696). 70% completed.
Processed 820 allocation unit(s) out of 1024 units (allocation page 105728). 80% completed.
Processed 922 allocation unit(s) out of 1024 units (allocation page 118784). 90% completed.
Processed 1024 allocation unit(s) out of 1024 units (allocation page 261888). 100% completed.
Database 'tpcc' is now online.
Database option 'trunc. log on chkpt.' turned ON for database 'tpcc'.
Running CHECKPOINT on database 'tpcc' for option 'trunc. log on chkpt.' to take effect.
(return status = 0)

DR_ASE:

CREATE DATABASE: allocating 131072 logical pages (2048.0 megabytes) on disk 'tpccdata' (131072 logical pages requested).
CREATE DATABASE: allocating 131072 logical pages (2048.0 megabytes) on disk 'tpcclog' (131072 logical pages requested).
Processed 103 allocation unit(s) out of 1024 units (allocation page 13824). 10% completed.
Processed 205 allocation unit(s) out of 1024 units (allocation page 26880). 20% completed.
Processed 308 allocation unit(s) out of 1024 units (allocation page 169472). 30% completed.
Processed 410 allocation unit(s) out of 1024 units (allocation page 182528). 40% completed.
Processed 512 allocation unit(s) out of 1024 units (allocation page 195584). 50% completed.
Processed 615 allocation unit(s) out of 1024 units (allocation page 79360). 60% completed.
Processed 717 allocation unit(s) out of 1024 units (allocation page 92416). 70% completed.
Processed 820 allocation unit(s) out of 1024 units (allocation page 235008). 80% completed.
Processed 922 allocation unit(s) out of 1024 units (allocation page 248064). 90% completed.
Processed 1024 allocation unit(s) out of 1024 units (allocation page 261888). 100% completed.
Database 'tpcc' is now online.
Database option 'trunc. log on chkpt.' turned ON for database 'tpcc'.
Running CHECKPOINT on database 'tpcc' for option 'trunc. log on chkpt.' to take effect.
(return status = 0)

 

最初に HADR クラスター(プライマリーとコンパニオン) を作成した時点で、DR_admin とDR_maint ASE ログインが作成されています。DR ノードを追加することでもこれらのログインが作成されます。全て同じSUIDを持たせるため、コンパニオンと DR ASE インスタンスは新たに作成する必要があります。

最終的にデータベースを所有することになるユーザーをプライマリー (アクティブ)ノードのみに追加します。

 
create login tpcc with password "<password>" default database tpcc
go

 

マスターデータベースは他のノードにレプリケーションされているため、これもレプリケーションされます。しかしながら、特定の db_options、所有者変更、エイリアスコマンドについては、各ノードで発行する必要があります。そのため、以下のコマンドは各ノード(プライマリー、コンパニオン、DR)の ASE インスタンスで発行されます。

 
use tpcc
go
sp_changedbowner tpcc, true
go
sp_addalias DR_maint, dbo
go

 

コマンドが成功したかどうかは、以下を実行することでチェックすることができます。

 
use tpcc
go
sp_helpuser dbo
go

Users_name ID_in_db Group_name Login_name
---------- -------- ---------- ----------
dbo 1 public tpcc

(1 row affected)
Users aliased to user.
Login_name
----------
DR_maint
(return status = 0)

 

これで全ての 3 ノードにデータベースが存在することになります。しかし、レプリケーションは行われず、コンパニオンと DR ノード(このケースではプライマリーも)はデータは空です。

プライマリー RMA(ASE ではなく)にコマンドを発行することで、HADR 環境にデータベースが追加されます。

 

レプリケーションのために HADR 環境にデータベースを追加する

 
isql -UDR_admin -P<password> -Sprimarynode:7001 -w999

1> sap_update_replication add_db, tpcc
2> go
TASKNAME TYPE VALUE
-------------------------------------- --------------------- -------------------------------------------------------------------------------------------------
Update Replication Start Time Thu Dec 01 19:32:39 UTC 2022
Update Replication Elapsed Time 00:00:02
DRExecutorImpl Task Name Update Replication
DRExecutorImpl Task State Running
DRExecutorImpl Short Description Update configuration for a currently replicating site.
DRExecutorImpl Long Description Started task 'Update Replication' asynchronously.
DRExecutorImpl Additional Info Please execute command 'sap_status task' to determine when task 'Update Replication' is complete.
UpdateReplication Task Name Update Replication
UpdateReplication Task State Running
UpdateReplication Short Description Update configuration for a currently replicating site.
UpdateReplication Long Description Add database 'tpcc' into Replication Servers.
UpdateReplication Current Task Number 1
UpdateReplication Total Number of Tasks 4
UpdateReplication Task Start Thu Dec 01 19:32:39 UTC 2022
UpdateReplication Hostname primarynode.openstack.na-ca-1.cloud.sap
AddASEDatabaseForDisasterRecovery Task Name Add Database to Replication
AddASEDatabaseForDisasterRecovery Task State Running
AddASEDatabaseForDisasterRecovery Short Description Add an ASE database to the Replication System for Disaster Recovery support.
AddASEDatabaseForDisasterRecovery Long Description Adding database 'tpcc' to the replication server on host 'primarynode'.
AddASEDatabaseForDisasterRecovery Current Task Number 0
AddASEDatabaseForDisasterRecovery Total Number of Tasks 20
AddASEDatabaseForDisasterRecovery Hostname primarynode.openstack.na-ca-1.cloud.sap
AddLocalASEDatabaseForDisasterRecovery Task Name Add Local Database to Replication
AddLocalASEDatabaseForDisasterRecovery Task State Running
AddLocalASEDatabaseForDisasterRecovery Short Description Add an ASE database to the local Replication System for Disaster Recovery support.
AddLocalASEDatabaseForDisasterRecovery Long Description Adding database 'tpcc' to the replication server on host 'primarynode'.
AddLocalASEDatabaseForDisasterRecovery Hostname primarynode.openstack.na-ca-1.cloud.sap
ResumeDSI Task Name Resume DSI Connection
ResumeDSI Task State Running
ResumeDSI Short Description Resume the Replication Server connection to a database.
ResumeDSI Long Description Waiting 1 seconds: Waiting 10 seconds before checking if the command executed successfully.
ResumeDSI Hostname primarynode.openstack.na-ca-1.cloud.sap

(32 rows affected)
1>

 

いくつかのコマンドは非同期で実行することが可能なため、継続する前に「sap_status task」を使用して、全てのタスクが完了しているかチェックします。

 
1> sap_status task
2> go
TASKNAME TYPE VALUE
----------------- --------------------- -------------------------------------------------------------------------
Status Start Time Thu Dec 01 19:32:39 UTC 2022
Status Elapsed Time 00:01:38
UpdateReplication Task Name Update Replication
UpdateReplication Task State Completed
UpdateReplication Short Description Update configuration for a currently replicating site.
UpdateReplication Long Description Update replication request to add database 'tpcc' completed successfully.
UpdateReplication Current Task Number 4
UpdateReplication Total Number of Tasks 4
UpdateReplication Task Start Thu Dec 01 19:32:39 UTC 2022
UpdateReplication Task End Thu Dec 01 19:34:17 UTC 2022
UpdateReplication Hostname primarynode.openstack.na-ca-1.cloud.sap

(11 rows affected)


 

「sap_status path」で、プライマリー(トロント)からセカンダリー(ロンドン)と DR(オフサイト)へのアクティブなレプリケーションパスを表示します。

 
1> sap_status path
2> go
PATH NAME VALUE INFO
---------------------- ------------------------- ----------------------- ------------------------------------------------------------------------------------
Start Time 2022-12-01 19:38:21.842 Time command started executing.
Elapsed Time 00:00:01 Command execution time.
Offsite Hostname drnode Logical host name.
Offsite HADR Status DR Standby : Inactive Identify the primary and standby sites.
Offsite Synchronization Mode Asynchronous The configured Synchronization Mode value.
Offsite Synchronization State Inactive Synchronization Mode in which replication is currently operating.
Offsite Distribution Mode Local Configured value for the distribution_mode replication model property.
Offsite Replication Server Status Active The status of Replication Server.
London Hostname companionnode Logical host name.
London HADR Status Standby : Inactive Identify the primary and standby sites.
London Synchronization Mode Synchronous The configured Synchronization Mode value.
London Synchronization State Inactive Synchronization Mode in which replication is currently operating.
London Distribution Mode Remote Configured value for the distribution_mode replication model property.
London Replication Server Status Active The status of Replication Server.
Toronto Hostname primarynode Logical host name.
Toronto HADR Status Primary : Active Identify the primary and standby sites.
Toronto Synchronization Mode Synchronous The configured Synchronization Mode value.
Toronto Synchronization State Synchronous Synchronization Mode in which replication is currently operating.
Toronto Distribution Mode Remote Configured value for the distribution_mode replication model property.
Toronto Replication Server Status Active The status of Replication Server.
London.Offsite.DEM State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.DEM Latency Time Unknown No latency information for database 'DEM'.
London.Offsite.DEM Latency Unknown No latency information for database 'DEM'.
London.Offsite.DEM Commit Time Unknown No last commit time for the database 'DEM'.
London.Offsite.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Offsite.master State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.master Latency Time Unknown No latency information for database 'master'.
London.Offsite.master Latency Unknown No latency information for database 'master'.
London.Offsite.master Commit Time Unknown No last commit time for the database 'master'.
London.Offsite.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Offsite.tpcc State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.tpcc Latency Time Unknown No latency information for database 'tpcc'.
London.Offsite.tpcc Latency Unknown No latency information for database 'tpcc'.
London.Offsite.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
London.Offsite.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.DEM State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.DEM Latency Time Unknown No latency information for database 'DEM'.
London.Toronto.DEM Latency Unknown No latency information for database 'DEM'.
London.Toronto.DEM Commit Time Unknown No last commit time for the database 'DEM'.
London.Toronto.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.master State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.master Latency Time Unknown No latency information for database 'master'.
London.Toronto.master Latency Unknown No latency information for database 'master'.
London.Toronto.master Commit Time Unknown No last commit time for the database 'master'.
London.Toronto.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.tpcc State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.tpcc Latency Time Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Latency Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
London.Toronto.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
Toronto.London.DEM State Active Path is active and replication can occur.
Toronto.London.DEM Latency Time 2022-11-25 16:16:08.560 Time latency last calculated
Toronto.London.DEM Latency 404 Latency (ms)
Toronto.London.DEM Commit Time 2022-11-25 16:16:08.560 Time last commit replicated
Toronto.London.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.DEM Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.London.master State Active Path is active and replication can occur.
Toronto.London.master Latency Time 2022-11-25 16:15:01.666 Time latency last calculated
Toronto.London.master Latency 573 Latency (ms)
Toronto.London.master Commit Time 2022-12-01 16:00:22.840 Time last commit replicated
Toronto.London.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.master Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.London.tpcc State Defined Path is defined and ready for materialization.
Toronto.London.tpcc Latency Time Unknown No latency information for database 'tpcc'.
Toronto.London.tpcc Latency Unknown No latency information for database 'tpcc'.
Toronto.London.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
Toronto.London.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.tpcc Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.DEM State Active Path is active and replication can occur.
Toronto.Offsite.DEM Latency Time 2022-11-25 16:16:08.892 Time latency last calculated
Toronto.Offsite.DEM Latency 570 Latency (ms)
Toronto.Offsite.DEM Commit Time 2022-11-25 16:16:08.892 Time last commit replicated
Toronto.Offsite.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.DEM Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.master State Active Path is active and replication can occur.
Toronto.Offsite.master Latency Time 2022-11-25 16:15:01.926 Time latency last calculated
Toronto.Offsite.master Latency 703 Latency (ms)
Toronto.Offsite.master Commit Time 2022-12-01 16:00:22.980 Time last commit replicated
Toronto.Offsite.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.master Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.tpcc State Defined Path is defined and ready for materialization.
Toronto.Offsite.tpcc Latency Time Unknown No latency information for database 'tpcc'.
Toronto.Offsite.tpcc Latency Unknown No latency information for database 'tpcc'.
Toronto.Offsite.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
Toronto.Offsite.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.tpcc Drain Status Not Applicable The drain status of the transaction logs of the primary database server.

 

アクティブ(トロント)から DR(オフサイト)への「State」は「Active」と表示されていても、これはマテリアライズされていません。アクティブからスタンバイへの「State」もまた、「Defined」されているだけであるため、マテリアライズする必要があることに注意してください。

コンパニオンと DR への個別のパスがあるため、それぞれにマテリアライズを実行します。

 

コンパニオンへデータベースをマテリアライズする

 
1> sap_materialize auto, Toronto, London, tpcc
2> go
TASKNAME TYPE VALUE
---------------- --------------------- ------------------------------------------------------------------------------------------
Materialize Start Time Thu Dec 01 19:44:04 UTC 2022
Materialize Elapsed Time 00:00:02
DRExecutorImpl Task Name Materialize
DRExecutorImpl Task State Running
DRExecutorImpl Short Description Materialize database
DRExecutorImpl Long Description Started task 'Materialize' asynchronously.
DRExecutorImpl Additional Info Please execute command 'sap_status task' to determine when task 'Materialize' is complete.
Materialize Task Name Materialize
Materialize Task State Running
Materialize Short Description Materialize database
Materialize Long Description Executing ASE dump and load task for database 'tpcc'.
Materialize Task Start Thu Dec 01 19:44:04 UTC 2022
Materialize Hostname primarynode.openstack.na-ca-1.cloud.sap
ASEDBDumpAndLoad Task Name Ase Dump and Load
ASEDBDumpAndLoad Task State Running
ASEDBDumpAndLoad Short Description Dump and Load an Adaptive Server Enterprise database
ASEDBDumpAndLoad Long Description Dumping Adaptive Server Enterprise database 'tpcc'.
ASEDBDumpAndLoad Current Task Number 1
ASEDBDumpAndLoad Total Number of Tasks 2
ASEDBDumpAndLoad Hostname primarynode.openstack.na-ca-1.cloud.sap

(20 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
----------- ----------------- ---------------------------------------------------------------------------------------------
Status Start Time Thu Dec 01 19:44:04 UTC 2022
Status Elapsed Time 00:00:51
Materialize Task Name Materialize
Materialize Task State Running
Materialize Short Description Materialize database
Materialize Long Description Waiting 10 seconds: Before checking if Replication Connection 'DEM_London.tpcc' is suspended.
Materialize Task Start Thu Dec 01 19:44:04 UTC 2022
Materialize Hostname primarynode.openstack.na-ca-1.cloud.sap

(8 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
----------- ----------------- ------------------------------------------------------------------------------------------------
Status Start Time Thu Dec 01 19:44:04 UTC 2022
Status Elapsed Time 00:01:12
Materialize Task Name Materialize
Materialize Task State Completed
Materialize Short Description Materialize database
Materialize Long Description Completed automatic materialization of database 'tpcc' from source 'Toronto' to target 'London'.
Materialize Task Start Thu Dec 01 19:44:04 UTC 2022
Materialize Task End Thu Dec 01 19:45:16 UTC 2022
Materialize Hostname primarynode.openstack.na-ca-1.cloud.sap

(9 rows affected)

 

DR へデータベースをマテリアライズする

 
1> sap_materialize auto, Toronto, Offsite, tpcc
2> go
TASKNAME TYPE VALUE
------------------------------ ----------------- ------------------------------------------------------------------------------------------------------
Materialize Start Time Thu Dec 01 19:47:23 UTC 2022
Materialize Elapsed Time 00:00:02
DRExecutorImpl Task Name Materialize
DRExecutorImpl Task State Running
DRExecutorImpl Short Description Materialize database
DRExecutorImpl Long Description Started task 'Materialize' asynchronously.
DRExecutorImpl Additional Info Please execute command 'sap_status task' to determine when task 'Materialize' is complete.
Materialize Task Name Materialize
Materialize Task State Running
Materialize Short Description Materialize database
Materialize Long Description A preventive measure to help validate the success of materialization succeeded on the database 'tpcc'.
Materialize Task Start Thu Dec 01 19:47:23 UTC 2022
Materialize Hostname primarynode.openstack.na-ca-1.cloud.sap
ConfigureInactiveSubscriptions Task Name ConfigureInactiveSubscriptions
ConfigureInactiveSubscriptions Task State Running
ConfigureInactiveSubscriptions Short Description Configure inactive subscriptions.
ConfigureInactiveSubscriptions Long Description Creating inactive subscriptions for database 'tpcc' from source 'Toronto' to target 'Offsite'.
ConfigureInactiveSubscriptions Hostname primarynode.openstack.na-ca-1.cloud.sap
ResumeDSI Task Name Resume DSI Connection
ResumeDSI Task State Running
ResumeDSI Short Description Resume the Replication Server connection to a database.
ResumeDSI Long Description Waiting 1 seconds: Waiting 10 seconds before checking if the command executed successfully.
ResumeDSI Hostname primarynode.openstack.na-ca-1.cloud.sap

(23 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
----------------- --------------------- -----------------------------------------------------
Status Start Time Thu Dec 01 19:47:23 UTC 2022
Status Elapsed Time 00:00:12
Materialize Task Name Materialize
Materialize Task State Running
Materialize Short Description Materialize database
Materialize Long Description Executing ASE dump and load task for database 'tpcc'.
Materialize Task Start Thu Dec 01 19:47:23 UTC 2022
Materialize Hostname primarynode.openstack.na-ca-1.cloud.sap
ASEDBDumpAndLoad Task Name Ase Dump and Load
ASEDBDumpAndLoad Task State Running
ASEDBDumpAndLoad Short Description Dump and Load an Adaptive Server Enterprise database
ASEDBDumpAndLoad Long Description Loading Adaptive Server Enterprise database 'tpcc'.
ASEDBDumpAndLoad Current Task Number 2
ASEDBDumpAndLoad Total Number of Tasks 2
ASEDBDumpAndLoad Hostname primarynode.openstack.na-ca-1.cloud.sap
ASESingleUserMode Task Name Change single user database option.
ASESingleUserMode Task State Running
ASESingleUserMode Short Description Change the database option single user.
ASESingleUserMode Long Description Waiting 10 seconds: Killing spid in progress.
ASESingleUserMode Hostname primarynode.openstack.na-ca-1.cloud.sap

(20 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
---------------- --------------------- -----------------------------------------------------
Status Start Time Thu Dec 01 19:47:23 UTC 2022
Status Elapsed Time 00:00:27
Materialize Task Name Materialize
Materialize Task State Running
Materialize Short Description Materialize database
Materialize Long Description Executing ASE dump and load task for database 'tpcc'.
Materialize Task Start Thu Dec 01 19:47:23 UTC 2022
Materialize Hostname primarynode.openstack.na-ca-1.cloud.sap
ASEDBDumpAndLoad Task Name Ase Dump and Load
ASEDBDumpAndLoad Task State Running
ASEDBDumpAndLoad Short Description Dump and Load an Adaptive Server Enterprise database
ASEDBDumpAndLoad Long Description Loading Adaptive Server Enterprise database 'tpcc'.
ASEDBDumpAndLoad Current Task Number 2
ASEDBDumpAndLoad Total Number of Tasks 2
ASEDBDumpAndLoad Hostname primarynode.openstack.na-ca-1.cloud.sap

(15 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
----------- ----------------- ----------------------------------------------------------------------------------------------
Status Start Time Thu Dec 01 19:47:23 UTC 2022
Status Elapsed Time 00:01:00
Materialize Task Name Materialize
Materialize Task State Running
Materialize Short Description Materialize database
Materialize Long Description Waiting 10 seconds: Before checking if Replication Connection 'DEM_Offsite.tpcc' is suspended.
Materialize Task Start Thu Dec 01 19:47:23 UTC 2022
Materialize Hostname primarynode.openstack.na-ca-1.cloud.sap

(8 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
----------- ----------------- -------------------------------------------------------------------------------------------------
Status Start Time Thu Dec 01 19:47:23 UTC 2022
Status Elapsed Time 00:01:14
Materialize Task Name Materialize
Materialize Task State Completed
Materialize Short Description Materialize database
Materialize Long Description Completed automatic materialization of database 'tpcc' from source 'Toronto' to target 'Offsite'.
Materialize Task Start Thu Dec 01 19:47:23 UTC 2022
Materialize Task End Thu Dec 01 19:48:37 UTC 2022
Materialize Hostname primarynode.openstack.na-ca-1.cloud.sap

(9 rows affected)

 

「sap_status_path」を実行すると、以下を表示します。

 
1> sap_status path
2> go
PATH NAME VALUE INFO
---------------------- ------------------------- ----------------------- ------------------------------------------------------------------------------------
Start Time 2022-12-01 19:51:20.352 Time command started executing.
Elapsed Time 00:00:01 Command execution time.
Offsite Hostname drnode Logical host name.
Offsite HADR Status DR Standby : Inactive Identify the primary and standby sites.
Offsite Synchronization Mode Asynchronous The configured Synchronization Mode value.
Offsite Synchronization State Inactive Synchronization Mode in which replication is currently operating.
Offsite Distribution Mode Local Configured value for the distribution_mode replication model property.
Offsite Replication Server Status Active The status of Replication Server.
London Hostname companionnode Logical host name.
London HADR Status Standby : Inactive Identify the primary and standby sites.
London Synchronization Mode Synchronous The configured Synchronization Mode value.
London Synchronization State Inactive Synchronization Mode in which replication is currently operating.
London Distribution Mode Remote Configured value for the distribution_mode replication model property.
London Replication Server Status Active The status of Replication Server.
Toronto Hostname primarynode Logical host name.
Toronto HADR Status Primary : Active Identify the primary and standby sites.
Toronto Synchronization Mode Synchronous The configured Synchronization Mode value.
Toronto Synchronization State Synchronous Synchronization Mode in which replication is currently operating.
Toronto Distribution Mode Remote Configured value for the distribution_mode replication model property.
Toronto Replication Server Status Active The status of Replication Server.
London.Offsite.DEM State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.DEM Latency Time Unknown No latency information for database 'DEM'.
London.Offsite.DEM Latency Unknown No latency information for database 'DEM'.
London.Offsite.DEM Commit Time Unknown No last commit time for the database 'DEM'.
London.Offsite.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Offsite.master State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.master Latency Time Unknown No latency information for database 'master'.
London.Offsite.master Latency Unknown No latency information for database 'master'.
London.Offsite.master Commit Time Unknown No last commit time for the database 'master'.
London.Offsite.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Offsite.tpcc State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.tpcc Latency Time Unknown No latency information for database 'tpcc'.
London.Offsite.tpcc Latency Unknown No latency information for database 'tpcc'.
London.Offsite.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
London.Offsite.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.DEM State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.DEM Latency Time Unknown No latency information for database 'DEM'.
London.Toronto.DEM Latency Unknown No latency information for database 'DEM'.
London.Toronto.DEM Commit Time Unknown No last commit time for the database 'DEM'.
London.Toronto.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.master State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.master Latency Time Unknown No latency information for database 'master'.
London.Toronto.master Latency Unknown No latency information for database 'master'.
London.Toronto.master Commit Time Unknown No last commit time for the database 'master'.
London.Toronto.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.tpcc State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.tpcc Latency Time Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Latency Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
London.Toronto.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
Toronto.London.DEM State Active Path is active and replication can occur.
Toronto.London.DEM Latency Time 2022-11-25 16:16:08.552 Time latency last calculated
Toronto.London.DEM Latency 400 Latency (ms)
Toronto.London.DEM Commit Time 2022-11-25 16:16:08.552 Time last commit replicated
Toronto.London.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.DEM Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.London.master State Active Path is active and replication can occur.
Toronto.London.master Latency Time 2022-11-25 16:15:01.666 Time latency last calculated
Toronto.London.master Latency 573 Latency (ms)
Toronto.London.master Commit Time 2022-12-01 16:00:22.840 Time last commit replicated
Toronto.London.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.master Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.London.tpcc State Active Path is active and replication can occur.
Toronto.London.tpcc Latency Time 2022-12-01 19:48:38.272 Time latency last calculated
Toronto.London.tpcc Latency 300 Latency (ms)
Toronto.London.tpcc Commit Time 2022-12-01 19:48:38.272 Time last commit replicated
Toronto.London.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.tpcc Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.DEM State Active Path is active and replication can occur.
Toronto.Offsite.DEM Latency Time 2022-11-25 16:16:08.884 Time latency last calculated
Toronto.Offsite.DEM Latency 566 Latency (ms)
Toronto.Offsite.DEM Commit Time 2022-11-25 16:16:08.884 Time last commit replicated
Toronto.Offsite.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.DEM Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.master State Active Path is active and replication can occur.
Toronto.Offsite.master Latency Time 2022-11-25 16:15:01.918 Time latency last calculated
Toronto.Offsite.master Latency 699 Latency (ms)
Toronto.Offsite.master Commit Time 2022-12-01 16:00:22.972 Time last commit replicated
Toronto.Offsite.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.master Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.tpcc State Active Path is active and replication can occur.
Toronto.Offsite.tpcc Latency Time 2022-12-01 19:48:38.618 Time latency last calculated
Toronto.Offsite.tpcc Latency 473 Latency (ms)
Toronto.Offsite.tpcc Commit Time 2022-12-01 19:48:38.624 Time last commit replicated
Toronto.Offsite.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.tpcc Drain Status Not Applicable The drain status of the transaction logs of the primary database server.

(92 rows affected)

 

アクティブからスタンバイと DR への全てのパスが、「Active」の状態になっています。

 


HADR をテストする


 

SQL DML および DDL ステートメントがレプリケートされているため、アプリケーションをプライマリー(アクティブ)データベースに接続しオペレーションを実行することでテストすることが可能です。ここで使用しているアプリケーションは、このブログの範疇外ですが、任意のアプリケーションを使用することも可能です。

このケースでは、SAP jConnect 16.0 を使用した Java JDBC アプリケーションを使用しており、アプリケーションは HA を認識するものではありません。ベース URL「jdbc:sybase:Tds:primarynode.watpm.c.na-ca-1.cloud.sap:5000」に対して接続プロパティは何も追加されていません。

テーブルやインデックスなどを作成するためにアプリケーションによって実行される DDL ステートメントは、全てスタンバイと DR にレプリケーションされます。これは、各 ASE インスタンス(PRIMARY_ASE、COMPANION_ASE、DR_ASE)で以下のようなコマンドを実行するだけで簡単に実証できます。

 
use tpcc
go
select name from sysobjects where type = 'U'
go

1> use tpcc
2> go
1> select name from sysobjects where type='U'
2> go
name
------------------
rs_lastcommit
rs_threads
rs_ticket_history
rs_mat_status
rs_dbversion
TPCC_CONFIG
CUSTOMER
DISTRICT
HISTORY
ITEM
NEW_ORDER
ORDERS
ORDER_LINE
STOCK
STOCK_PHOTO
WAREHOUSE

(16 rows affected)

 

同様に、DML では、バッチインサート (java.sql.PreparedStatement.addBatch(), java.sql.PreparedStatement.executeBatch()) を使用してデータをロードした後、アプリケーションを実行してデータ変更 (java.sql.PreparedStatement.executeUpdate()) を行うと、各インスタンスで各テーブルの行数が合致します。

例えば以下のとおりです。

 
1> use tpcc
2> go
1> select count(*) from ORDER_LINE
2> go

-----------
900016

 


 

計画的フェールオーバー


 

計画的なフェールオーバーを実行するには、以下のコマンドをプライマリーまたはコンパニオン RMA に発行して 4 つのステップで行います。

  1. sap_failover <primary>, <companion>, <timeout>

  2. sap_failover_drain_to_dr <timeout>

  3. sap_host_available <dr site>

  4. sap_host_available <primary>


次のステップに進む前に、「sap_status path」 をそれぞれのコマンド間で発行して、全てのタスクが完了していることを確認する必要があります。

 

1. フェールオーバーを開始する

 
1> sap_failover Toronto, London, 120
2> go
TASKNAME TYPE VALUE
-------------- --------------------- -------------------------------------------------------------------------------------------------------
Failover Start Time Tue Dec 06 16:13:35 UTC 2022
Failover Elapsed Time 00:00:02
DRExecutorImpl Task Name Failover
DRExecutorImpl Task State Running
DRExecutorImpl Short Description Failover makes the current standby ASE as the primary server.
DRExecutorImpl Long Description Started task 'Failover' asynchronously.
DRExecutorImpl Additional Info Please execute command 'sap_status task' to determine when task 'Failover' is complete.
Failover Task Name Failover
Failover Task State Running
Failover Short Description Failover makes the current standby ASE as the primary server.
Failover Long Description Issuing commands to verify the DSI thread in the replication server at host 'London' is up and running.
Failover Current Task Number 3
Failover Total Number of Tasks 18
Failover Task Start Tue Dec 06 16:13:35 UTC 2022
Failover Hostname primarynode.openstack.na-ca-1.cloud.sap

(15 rows affected)
> sap_status task
2> go
TASKNAME TYPE VALUE
---------- --------------------- -----------------------------------------------------------------------------------------------------------------------
Status Start Time Tue Dec 06 16:13:35 UTC 2022
Status Elapsed Time 00:00:10
Failover Task Name Failover
Failover Task State Completed
Failover Short Description Failover makes the current standby ASE as the primary server.
Failover Long Description Failover from source 'Toronto' to target 'London' is complete. The target may be unquiesced.
Failover Additional Info Please run command 'sap_failover_drain_to_dr <number_of_seconds_before_timout>' to complete the failover for all hosts.
Failover Current Task Number 15
Failover Total Number of Tasks 15
Failover Task Start Tue Dec 06 16:13:35 UTC 2022
Failover Task End Tue Dec 06 16:13:45 UTC 2022
Failover Hostname primarynode.openstack.na-ca-1.cloud.sap

 

2. DR : 残りのトランザクションを DR に排出する

 
1> sap_failover_drain_to_dr 120
2> go
TASKNAME TYPE VALUE
--------------------- --------------------- -----------------------------------------------------------------------------------------------------
Failover drain to DR. Start Time Tue Dec 06 16:16:16 UTC 2022
Failover drain to DR. Elapsed Time 00:00:02
DRExecutorImpl Task Name Failover drain to DR.
DRExecutorImpl Task State Running
DRExecutorImpl Short Description Failover drain to DR deactivate old replication path and activate new replication path for all hosts.
DRExecutorImpl Long Description Started task 'Failover drain to DR.' asynchronously.
DRExecutorImpl Additional Info Please execute command 'sap_status task' to determine when task 'Failover drain to DR.' is complete.
FailoverRemaining Task Name Failover drain to DR.
FailoverRemaining Task State Running
FailoverRemaining Short Description Failover drain to DR deactivate old replication path and activate new replication path for all hosts.
FailoverRemaining Long Description Issuing command to resume the DIST.
FailoverRemaining Current Task Number 5
FailoverRemaining Total Number of Tasks 7
FailoverRemaining Task Start Tue Dec 06 16:16:16 UTC 2022
FailoverRemaining Hostname primarynode.openstack.na-ca-1.cloud.sap

(15 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
----------------- --------------------- -----------------------------------------------------------------------------------------------------
Status Start Time Tue Dec 06 16:16:16 UTC 2022
Status Elapsed Time 00:00:05
FailoverRemaining Task Name Failover drain to DR.
FailoverRemaining Task State Completed
FailoverRemaining Short Description Failover drain to DR deactivate old replication path and activate new replication path for all hosts.
FailoverRemaining Long Description Marking old replication path finished.
FailoverRemaining Additional Info Please run command 'sap_host_available' to complete the failover operation.
FailoverRemaining Current Task Number 7
FailoverRemaining Total Number of Tasks 7
FailoverRemaining Task Start Tue Dec 06 16:16:16 UTC 2022
FailoverRemaining Task End Tue Dec 06 16:16:21 UTC 2022
FailoverRemaining Hostname primarynode.openstack.na-ca-1.cloud.sap

(12 rows affected)
1>

 

現在アクティブなノード(コンパニオン)からスタンバイ(プライマリー)と DR へのレプリケーションは、「suspended」として表示されます。

 
1> sap_status path
2> go
PATH NAME VALUE INFO
---------------------- ----------------------------- ----------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Start Time 2022-12-06 16:17:51.325 Time command started executing.
Elapsed Time 00:00:01 Command execution time.
Offsite Hostname drnode Logical host name.
Offsite HADR Status DR Standby : Inactive Identify the primary and standby sites.
Offsite Synchronization Mode Asynchronous The configured Synchronization Mode value.
Offsite Synchronization State Inactive Synchronization Mode in which replication is currently operating.
Offsite Distribution Mode Local Configured value for the distribution_mode replication model property.
Offsite Replication Server Status Active The status of Replication Server.
London Hostname companionnode Logical host name.
London HADR Status Primary : Active Identify the primary and standby sites.
London Synchronization Mode Synchronous The configured Synchronization Mode value.
London Synchronization State Unknown Replication Synchronization Mode is currently operating as 'Unknown' instead of the configured value 'Synchronous'. Please refer to Replication Server logs for more details.
London Distribution Mode Remote Configured value for the distribution_mode replication model property.
London Replication Server Status Active The status of Replication Server.
Toronto Hostname primarynode Logical host name.
Toronto HADR Status Standby : Inactive Identify the primary and standby sites.
Toronto Synchronization Mode Synchronous The configured Synchronization Mode value.
Toronto Synchronization State Inactive Synchronization Mode in which replication is currently operating.
Toronto Distribution Mode Remote Configured value for the distribution_mode replication model property.
Toronto Replication Server Status Active The status of Replication Server.
London.Offsite.DEM State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.DEM Additional Info Additional Info The REPLICATION AGENT connection in the Replication Server on the primarynode host to 'DEM_London_R1.DEM' is suspended.
London.Offsite.DEM Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Offsite host to 'DEM_Offsite.DEM' is suspended.
London.Offsite.DEM Latency Time 2022-12-06 16:17:52.326 Time latency last calculated
London.Offsite.DEM Latency 246257 Latency (ms)
London.Offsite.DEM Commit Time 2022-11-25 16:15:36.420 Time last commit replicated
London.Offsite.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Offsite.master State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.master Additional Info Additional Info The REPLICATION AGENT connection in the Replication Server on the primarynode host to 'DEM_London_R1.master' is suspended.
London.Offsite.master Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Offsite host to 'DEM_Offsite.master' is suspended.
London.Offsite.master Latency Time 2022-12-06 16:17:52.512 Time latency last calculated
London.Offsite.master Latency 246350 Latency (ms)
London.Offsite.master Commit Time 2022-11-25 16:14:36.426 Time last commit replicated
London.Offsite.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Offsite.tpcc State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.tpcc Additional Info Additional Info The REPLICATION AGENT connection in the Replication Server on the primarynode host to 'DEM_London_R1.tpcc' is suspended.
London.Offsite.tpcc Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Offsite host to 'DEM_Offsite.tpcc' is suspended.
London.Offsite.tpcc Latency Time 2022-12-06 16:17:52.712 Time latency last calculated
London.Offsite.tpcc Latency 246450 Latency (ms)
London.Offsite.tpcc Commit Time 2022-12-01 19:48:05.546 Time last commit replicated
London.Offsite.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.DEM State Incomplete Failover is incomplete.
London.Toronto.DEM Additional Info Additional Info Path has been activated by failover. Replication cannot occur until the standby host 'Toronto' is made available.
London.Toronto.DEM Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Toronto host to 'DEM_Toronto.DEM' is suspended.
London.Toronto.DEM Latency Time Unknown No latency information for database 'DEM'.
London.Toronto.DEM Latency Unknown No latency information for database 'DEM'.
London.Toronto.DEM Commit Time 2022-11-15 20:50:41.794 Time last commit replicated
London.Toronto.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.master State Incomplete Failover is incomplete.
London.Toronto.master Additional Info Additional Info Path has been activated by failover. Replication cannot occur until the standby host 'Toronto' is made available.
London.Toronto.master Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Toronto host to 'DEM_Toronto.master' is suspended.
London.Toronto.master Latency Time Unknown No latency information for database 'master'.
London.Toronto.master Latency Unknown No latency information for database 'master'.
London.Toronto.master Commit Time 2022-11-15 20:49:07.954 Time last commit replicated
London.Toronto.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.tpcc State Incomplete Failover is incomplete.
London.Toronto.tpcc Additional Info Additional Info Path has been activated by failover. Replication cannot occur until the standby host 'Toronto' is made available.
London.Toronto.tpcc Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Toronto host to 'DEM_Toronto.tpcc' is suspended.
London.Toronto.tpcc Latency Time Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Latency Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Commit Time 2022-12-01 19:34:05.980 Time last commit replicated
London.Toronto.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
Toronto.London.DEM State Suspended Path is suspended (DSI). Transactions are not being replicated.
Toronto.London.DEM Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the London host to 'DEM_London.DEM' is suspended.
Toronto.London.DEM Latency Time Unknown No latency information for database 'DEM'.
Toronto.London.DEM Latency Unknown No latency information for database 'DEM'.
Toronto.London.DEM Commit Time Unknown No last commit time for the database 'DEM'.
Toronto.London.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.DEM Drain Status Drained The drain status of the transaction logs of the primary database server.
Toronto.London.master State Suspended Path is suspended (DSI). Transactions are not being replicated.
Toronto.London.master Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the London host to 'DEM_London.master' is suspended.
Toronto.London.master Latency Time Unknown No latency information for database 'master'.
Toronto.London.master Latency Unknown No latency information for database 'master'.
Toronto.London.master Commit Time Unknown No last commit time for the database 'master'.
Toronto.London.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.master Drain Status Drained The drain status of the transaction logs of the primary database server.
Toronto.London.tpcc State Suspended Path is suspended (DSI). Transactions are not being replicated.
Toronto.London.tpcc Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the London host to 'DEM_London.tpcc' is suspended.
Toronto.London.tpcc Latency Time Unknown No latency information for database 'tpcc'.
Toronto.London.tpcc Latency Unknown No latency information for database 'tpcc'.
Toronto.London.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
Toronto.London.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.tpcc Drain Status Drained The drain status of the transaction logs of the primary database server.
Toronto.Offsite.DEM State Suspended Path is suspended (DSI). Transactions are not being replicated.
Toronto.Offsite.DEM Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Offsite host to 'DEM_Offsite.DEM' is suspended.
Toronto.Offsite.DEM Latency Time Unknown No latency information for database 'DEM'.
Toronto.Offsite.DEM Latency Unknown No latency information for database 'DEM'.
Toronto.Offsite.DEM Commit Time Unknown No last commit time for the database 'DEM'.
Toronto.Offsite.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.DEM Drain Status Drained The drain status of the transaction logs of the primary database server.
Toronto.Offsite.master State Suspended Path is suspended (DSI). Transactions are not being replicated.
Toronto.Offsite.master Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Offsite host to 'DEM_Offsite.master' is suspended.
Toronto.Offsite.master Latency Time Unknown No latency information for database 'master'.
Toronto.Offsite.master Latency Unknown No latency information for database 'master'.
Toronto.Offsite.master Commit Time Unknown No last commit time for the database 'master'.
Toronto.Offsite.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.master Drain Status Drained The drain status of the transaction logs of the primary database server.
Toronto.Offsite.tpcc State Suspended Path is suspended (DSI). Transactions are not being replicated.
Toronto.Offsite.tpcc Failing Command Error Message Failing Command Error Message The DSI connection in the Replication Server on the Offsite host to 'DEM_Offsite.tpcc' is suspended.
Toronto.Offsite.tpcc Latency Time Unknown No latency information for database 'tpcc'.
Toronto.Offsite.tpcc Latency Unknown No latency information for database 'tpcc'.
Toronto.Offsite.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
Toronto.Offsite.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.tpcc Drain Status Drained The drain status of the transaction logs of the primary database server.

(110 rows affected)

 

現在アクティブな(コンパニオン)ノードから変更を受け取ることが可能なホストをマークするために、さらに 2 つのコマンドが発行されます。

 

3/4. ノードがトランザクションを受け入れられるようにする。

 
1> sap_host_available Offsite
2> go
TASKNAME TYPE VALUE
------------- --------------------- -------------------------------------------------------------------------------------------------------
HostAvailable Start Time Tue Dec 06 16:21:33 UTC 2022
HostAvailable Elapsed Time 00:00:56
HostAvailable Task Name HostAvailable
HostAvailable Task State Completed
HostAvailable Short Description Resets the original source logical host when it is available after failover.
HostAvailable Long Description Completed the reset process of logical host 'Offsite' receiving replication from logical host 'London'.
HostAvailable Current Task Number 14
HostAvailable Total Number of Tasks 14
HostAvailable Task Start Tue Dec 06 16:21:33 UTC 2022
HostAvailable Task End Tue Dec 06 16:22:29 UTC 2022
HostAvailable Hostname primarynode.openstack.na-ca-1.cloud.sap

(11 rows affected)
1> sap_host_available Toronto
2> go
TASKNAME TYPE VALUE
------------- --------------------- -------------------------------------------------------------------------------------------------------
HostAvailable Start Time Tue Dec 06 16:23:09 UTC 2022
HostAvailable Elapsed Time 00:01:07
HostAvailable Task Name HostAvailable
HostAvailable Task State Completed
HostAvailable Short Description Resets the original source logical host when it is available after failover.
HostAvailable Long Description Completed the reset process of logical host 'Toronto' receiving replication from logical host 'London'.
HostAvailable Current Task Number 13
HostAvailable Total Number of Tasks 13
HostAvailable Task Start Tue Dec 06 16:23:09 UTC 2022
HostAvailable Task End Tue Dec 06 16:24:16 UTC 2022
HostAvailable Hostname primarynode.openstack.na-ca-1.cloud.sap

(11 rows affected)

 

スタンバイノード(プライマリー)はネットワーク接続可能なため、sa_role 以外でログインしようとすると、アクティブ(コンパニオン)ノードにリダイレクトされます。以前のアプリケーションを変更せずに実行すると、ログインはアクティブ(コンパニオン)ノードに自動的にリダイレクトされます。
繰り返しになりますが、これは各ノードで比較クエリーを実行してデータをチェックすることで確認できます。
簡単な例を以下に紹介します。

 
1> select count(*) from ORDER_LINE
2> go

-----------
900230

(1 row affected)


 

計画的フェールバック


 

計画的なフェールオーバーと同様、計画的なフェールバックも、以下のようにプライマリーまたはコンパニオン RMA に対して発行されるコマンドを使用した 4 つのステップで行います。

  1. sap_failover <companion>, <primary>, <timeout>

  2. sap_failover_drain_to_dr <timeout>

  3. sap_host_available <dr site>

  4. sap_host_available <companion>


 

同様に、次のステップに進む前に「sap_status task」を各コマンド間で発行して全てのタスクが完了しているか確認する必要があります。

 

1. フェールバックを開始する

 
1> sap_failover London, Toronto, 120
2> go
TASKNAME TYPE VALUE
-------------- --------------------- ---------------------------------------------------------------------------------------------------
Failover Start Time Tue Dec 06 18:37:42 UTC 2022
Failover Elapsed Time 00:00:02
DRExecutorImpl Task Name Failover
DRExecutorImpl Task State Running
DRExecutorImpl Short Description Failover makes the current standby ASE as the primary server.
DRExecutorImpl Long Description Started task 'Failover' asynchronously.
DRExecutorImpl Additional Info Please execute command 'sap_status task' to determine when task 'Failover' is complete.
Failover Task Name Failover
Failover Task State Running
Failover Short Description Failover makes the current standby ASE as the primary server.
Failover Long Description Sending end of data markers to participating databases in the source ASE for logical host 'London'.
Failover Current Task Number 5
Failover Total Number of Tasks 18
Failover Task Start Tue Dec 06 18:37:42 UTC 2022
Failover Hostname primarynode.openstack.na-ca-1.cloud.sap

(15 rows a1> sap_status task
2> go
TASKNAME TYPE VALUE
---------- --------------------- -----------------------------------------------------------------------------------------------------------------------
Status Start Time Tue Dec 06 18:37:42 UTC 2022
Status Elapsed Time 00:00:09
Failover Task Name Failover
Failover Task State Completed
Failover Short Description Failover makes the current standby ASE as the primary server.
Failover Long Description Failover from source 'London' to target 'Toronto' is complete. The target may be unquiesced.
Failover Additional Info Please run command 'sap_failover_drain_to_dr <number_of_seconds_before_timout>' to complete the failover for all hosts.
Failover Current Task Number 15
Failover Total Number of Tasks 15
Failover Task Start Tue Dec 06 18:37:42 UTC 2022
Failover Task End Tue Dec 06 18:37:51 UTC 2022
Failover Hostname primarynode.openstack.na-ca-1.cloud.sap

(12 rows affected)
ffected)

 

2. 残りのトランザクションを DR に排出する

 
1> sap_failover_drain_to_dr 120
2> go
TASKNAME TYPE VALUE
--------------------- --------------------- -----------------------------------------------------------------------------------------------------
Failover drain to DR. Start Time Tue Dec 06 18:39:52 UTC 2022
Failover drain to DR. Elapsed Time 00:00:02
DRExecutorImpl Task Name Failover drain to DR.
DRExecutorImpl Task State Running
DRExecutorImpl Short Description Failover drain to DR deactivate old replication path and activate new replication path for all hosts.
DRExecutorImpl Long Description Started task 'Failover drain to DR.' asynchronously.
DRExecutorImpl Additional Info Please execute command 'sap_status task' to determine when task 'Failover drain to DR.' is complete.
FailoverRemaining Task Name Failover drain to DR.
FailoverRemaining Task State Running
FailoverRemaining Short Description Failover drain to DR deactivate old replication path and activate new replication path for all hosts.
FailoverRemaining Long Description Issuing command to resume the DIST.
FailoverRemaining Current Task Number 5
FailoverRemaining Total Number of Tasks 7
FailoverRemaining Task Start Tue Dec 06 18:39:52 UTC 2022
FailoverRemaining Hostname primarynode.openstack.na-ca-1.cloud.sap

(15 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
----------------- --------------------- -----------------------------------------------------------------------------------------------------
Status Start Time Tue Dec 06 18:39:52 UTC 2022
Status Elapsed Time 00:00:04
FailoverRemaining Task Name Failover drain to DR.
FailoverRemaining Task State Completed
FailoverRemaining Short Description Failover drain to DR deactivate old replication path and activate new replication path for all hosts.
FailoverRemaining Long Description Marking old replication path finished.
FailoverRemaining Additional Info Please run command 'sap_host_available' to complete the failover operation.
FailoverRemaining Current Task Number 7
FailoverRemaining Total Number of Tasks 7
FailoverRemaining Task Start Tue Dec 06 18:39:52 UTC 2022
FailoverRemaining Task End Tue Dec 06 18:39:56 UTC 2022
FailoverRemaining Hostname primarynode.openstack.na-ca-1.cloud.sap

(12 rows affected)

 

3/4. ノードがトランザクションを受け入れられるようにする

 
1> sap_host_available Offsite
2> go
TASKNAME TYPE VALUE
------------- --------------------- --------------------------------------------------------------------------------------------------------
HostAvailable Start Time Tue Dec 06 18:44:18 UTC 2022
HostAvailable Elapsed Time 00:00:55
HostAvailable Task Name HostAvailable
HostAvailable Task State Completed
HostAvailable Short Description Resets the original source logical host when it is available after failover.
HostAvailable Long Description Completed the reset process of logical host 'Offsite' receiving replication from logical host 'Toronto'.
HostAvailable Current Task Number 14
HostAvailable Total Number of Tasks 14
HostAvailable Task Start Tue Dec 06 18:44:18 UTC 2022
HostAvailable Task End Tue Dec 06 18:45:13 UTC 2022
HostAvailable Hostname primarynode.openstack.na-ca-1.cloud.sap

(11 rows affected)
1> sap_host_available London
2> go
TASKNAME TYPE VALUE
------------- --------------------- -------------------------------------------------------------------------------------------------------
HostAvailable Start Time Tue Dec 06 18:46:23 UTC 2022
HostAvailable Elapsed Time 00:01:07
HostAvailable Task Name HostAvailable
HostAvailable Task State Completed
HostAvailable Short Description Resets the original source logical host when it is available after failover.
HostAvailable Long Description Completed the reset process of logical host 'London' receiving replication from logical host 'Toronto'.
HostAvailable Current Task Number 13
HostAvailable Total Number of Tasks 13
HostAvailable Task Start Tue Dec 06 18:46:23 UTC 2022
HostAvailable Task End Tue Dec 06 18:47:30 UTC 2022
HostAvailable Hostname primarynode.openstack.na-ca-1.cloud.sap

(11 rows affected)

 

変更なしでアプリケーションを再度実行すると(つまり、現在アクティブなプライマリーノードに対して)、同じ行数が得られます。

 
1> use tpcc
2> go
1> select count(*) from ORDER_LINE
2> go

-----------
900456

 

どのノードの RMA インスタンスへ接続しても、アクティブなインスタンスはプライマリーノード上の ASE インスタンスであることがわかります。

 
1> sap_status path
2> go
PATH NAME VALUE INFO
---------------------- ------------------------- ----------------------- ------------------------------------------------------------------------------------
Start Time 2022-12-06 21:03:57.040 Time command started executing.
Elapsed Time 00:00:01 Command execution time.
Offsite Hostname drnode Logical host name.
Offsite HADR Status DR Standby : Inactive Identify the primary and standby sites.
Offsite Synchronization Mode Asynchronous The configured Synchronization Mode value.
Offsite Synchronization State Inactive Synchronization Mode in which replication is currently operating.
Offsite Distribution Mode Local Configured value for the distribution_mode replication model property.
Offsite Replication Server Status Active The status of Replication Server.
London Hostname companionnode Logical host name.
London HADR Status Standby : Inactive Identify the primary and standby sites.
London Synchronization Mode Synchronous The configured Synchronization Mode value.
London Synchronization State Inactive Synchronization Mode in which replication is currently operating.
London Distribution Mode Remote Configured value for the distribution_mode replication model property.
London Replication Server Status Active The status of Replication Server.
Toronto Hostname primarynode Logical host name.
Toronto HADR Status Primary : Active Identify the primary and standby sites.
Toronto Synchronization Mode Synchronous The configured Synchronization Mode value.
Toronto Synchronization State Synchronous Synchronization Mode in which replication is currently operating.
Toronto Distribution Mode Remote Configured value for the distribution_mode replication model property.
Toronto Replication Server Status Active The status of Replication Server.
London.Offsite.DEM State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.DEM Latency Time Unknown No latency information for database 'DEM'.
London.Offsite.DEM Latency Unknown No latency information for database 'DEM'.
London.Offsite.DEM Commit Time Unknown No last commit time for the database 'DEM'.
London.Offsite.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Offsite.master State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.master Latency Time Unknown No latency information for database 'master'.
London.Offsite.master Latency Unknown No latency information for database 'master'.
London.Offsite.master Commit Time Unknown No last commit time for the database 'master'.
London.Offsite.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Offsite.tpcc State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Offsite.tpcc Latency Time Unknown No latency information for database 'tpcc'.
London.Offsite.tpcc Latency Unknown No latency information for database 'tpcc'.
London.Offsite.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
London.Offsite.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Offsite.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.DEM State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.DEM Latency Time Unknown No latency information for database 'DEM'.
London.Toronto.DEM Latency Unknown No latency information for database 'DEM'.
London.Toronto.DEM Commit Time Unknown No last commit time for the database 'DEM'.
London.Toronto.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.master State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.master Latency Time Unknown No latency information for database 'master'.
London.Toronto.master Latency Unknown No latency information for database 'master'.
London.Toronto.master Commit Time Unknown No last commit time for the database 'master'.
London.Toronto.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.tpcc State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.tpcc Latency Time Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Latency Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
London.Toronto.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
Toronto.London.DEM State Active Path is active and replication can occur.
Toronto.London.DEM Latency Time 2022-12-06 18:47:31.286 Time latency last calculated
Toronto.London.DEM Latency 383 Latency (ms)
Toronto.London.DEM Commit Time 2022-12-06 18:47:31.292 Time last commit replicated
Toronto.London.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.DEM Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.London.master State Active Path is active and replication can occur.
Toronto.London.master Latency Time 2022-12-06 18:47:31.292 Time latency last calculated
Toronto.London.master Latency 386 Latency (ms)
Toronto.London.master Commit Time 2022-12-06 18:47:31.292 Time last commit replicated
Toronto.London.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.master Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.London.tpcc State Active Path is active and replication can occur.
Toronto.London.tpcc Latency Time 2022-12-06 18:47:31.292 Time latency last calculated
Toronto.London.tpcc Latency 386 Latency (ms)
Toronto.London.tpcc Commit Time 2022-12-06 19:33:53.852 Time last commit replicated
Toronto.London.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.tpcc Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.DEM State Active Path is active and replication can occur.
Toronto.Offsite.DEM Latency Time 2022-12-06 18:47:31.472 Time latency last calculated
Toronto.Offsite.DEM Latency 476 Latency (ms)
Toronto.Offsite.DEM Commit Time 2022-12-06 18:47:31.472 Time last commit replicated
Toronto.Offsite.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.DEM Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.master State Active Path is active and replication can occur.
Toronto.Offsite.master Latency Time 2022-12-06 18:47:31.466 Time latency last calculated
Toronto.Offsite.master Latency 473 Latency (ms)
Toronto.Offsite.master Commit Time 2022-12-06 18:47:31.466 Time last commit replicated
Toronto.Offsite.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.master Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.Offsite.tpcc State Active Path is active and replication can occur.
Toronto.Offsite.tpcc Latency Time 2022-12-06 18:47:31.472 Time latency last calculated
Toronto.Offsite.tpcc Latency 476 Latency (ms)
Toronto.Offsite.tpcc Commit Time 2022-12-06 19:33:53.160 Time last commit replicated
Toronto.Offsite.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.Offsite.tpcc Drain Status Not Applicable The drain status of the transaction logs of the primary database server.

(92 rows affected)

 

(パート 3 に続きます…)