Skip to Content
Author's profile photo Frank Bannert

HANA System Replication – Switching back and forth

Many people asked me what the correct order is when using hdbnsutil commands in the context of system replication.

If you have no clue what I am talking about you might want to press ALT+F4 or have a look into following how-to guide:

How to Perform System Replication for SAP HANA

Let me try to make it as clear as crystal…while keeping it simple.

ENVIRONMENT

SITEA=first and preferred data center

SITEB=second data center

PRIM=HANA system which acts as primary in system replication mode

SEC=HANA system which acts as secondary in system replication mode

INITIAL SETUP TO ENABLE SYSTEM REPLICATION BETWEEN SITEA AND SITEB

SITEA> hdbnsutil -sr_enable –name=SITEA (HANA system started, SITEA=PRIM)

SITEB> hdbnsutil -sr_register –name=SITEB –… (HANA system stopped, SITEB=SEC)

SITEB> sapcontrol -nr <instance> -function StartSystem (system replication will start when SITEB is completely started)

DISASTER IN SITEA OCCURS

SITEB> hdbnsutil -sr_takeover (SITEB=PRIM)

now recovery of A is performed and when done next step

SITEA> hdbnsutil -sr_register –name=SITEA –… (HANA system stopped, SITEA=SEC)

SITEA> sapcontrol -nr <instance> -function StartSystem (system replication will start when SITEA is completely started, HANA will determine if a complete sync is necessary or a delta will do)

FAIL BACK

Now SITEA=SEC SITEB=PRIM and systems are in sync. You might want to fail back to the original setup SITEA=PRIM and SITEB=SEC for various reasons

SITEA> hdbnsutil -sr_takeover (HANA system started, SITEA=PRIM)

SITEB> sapcontrol -nr <instance> -function StopSystem

SITEB> hdbnsutil -sr_register –name=SITEB –… (HANA system stopped, SITEB=SEC)

SITEB> sapcontrol -nr <instance> -function StartSystem (system replication will start when SITEB is completely started)

yes, this is the only way to fail back, also if you ask me 10 more times 😉

SIDE STORY: DISASTER IN SITEB OCCURS WHILE SITEB=SEC

Not much to do, once SITEB is recovered and restarted system replication will re-sync

Happy XMAS and bye for now,

Frank

PS: Executing this commands in the wrong order might lead into a HANA system which does not start anymore. So be careful! And I know what I am talking about after searching for hours to find the root cause and then figuring out it was created by myself.

Assigned Tags

      13 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Tammy Powlas
      Tammy Powlas

      Happy holidays, Frank.

      I enjoyed seeing this:

      PS: Executing this commands in the wrong order might lead into a HANA system which does not start anymore. So be careful! And I know what I am talking about after searching for hours to find the root cause and then figuring out it was created by myself.

      I create several problems myself as well 🙂

      Author's profile photo Nicholas Chang
      Nicholas Chang

      Thanks Frank!

      Would appreciate if you can write a blog regards to hdbnsutil -sr_unregister as the  1945676 - Correct usage of hdbnsutil -sr_unregister

      is very confusing.

      eg; in scenario 1, it said we need to stop secondary system in order to run hdbnsutil -sr_unregister, however, the commnad need to run whilst database is online.

      also, running hdbnsutil -sr_unregister is not clearing the replication parameter in global.ini, and the status is "red" in Hana Studio -> Overview tab.

      Cheers,

      Nicholas Chang

      Author's profile photo Nicholas Chang
      Nicholas Chang

      Moreover, we also found out that even we switch off preload_column_tables for both primary and secondary instance, secondary instance size are almost identical to primary after sync completed.

      Author's profile photo Frank Bannert
      Frank Bannert
      Blog Post Author

      Off topic...but did you also set the parameter global_allocation_limit  with the correct value as explained in the guide How to Perform System Replication for SAP HANA ?

      Author's profile photo Nicholas Chang
      Nicholas Chang

      HI Frank,

      Thanks for the reply. Yes we did.

      Cheers,

      Nicholas

      Author's profile photo Frank Bannert
      Frank Bannert
      Blog Post Author

      The way sr_unregister is described in the note is the correct way! If you have issues doing it this way please create an OSS...

      Author's profile photo Nicholas Chang
      Nicholas Chang

      just for clarification, hdbnsutil -sr_unregister is run when 2ndary instance is shutdown? What's the return message get? I've tested according to the note, run hdbnsutil -sr_unregister when 2ndary instance is down, the error message return with "hdbnsutil -sr_unregister can't run on an offline db"

      Author's profile photo Frank Bannert
      Frank Bannert
      Blog Post Author

      Please open a support message or a thread in SAP HANA and In-Memory Business Data Management .

      We should not abuse the comment section of a blog for troubleshooting.

      /Frank

      Author's profile photo Former Member
      Former Member

      Hi Frank,

      I would like to configure system replication for scaleout systems.

      siteA/siteB each with 3 systems.

      Question is "Is it acceptable to deploy HANA with single virtual hostname for all HANA hosts?"

      I will keep only one virtual host entry in global.ini

      example: siteA

      host1=saphanadb(v.host)

      host2=saphanadb(vhost)

      host3=saphanadb(vhost)

      Site B:

      host1=saphanadb(vhost)

      host2=saphanadb(vhost)

      host3=saphanadb(vhost)

      Client can access via virtual hostname.

      Is the above configuration is acceptable or not?

      Please share your thoughts?

      Thanks for your help.

      Regards,

      Mangilal D

      Author's profile photo Former Member
      Former Member

      Thanks for highlighting the steps. I was looking for a way for installed netweaver eg erp ehp to connect to secondary site once failover happens. Any configuration needed to do that?

      Author's profile photo Former Member
      Former Member

      Hi Frank,

      We did takeover from site B to site A (which is primary and HA with worker and standby node) But after takeover, on Site A, no standby node available now, possibly all configuration came from Site B overwrite it. Did you see such situation anywhere? Any inputs will be highly appreciated.
      Amit

      Author's profile photo Frank OLSEN
      Frank OLSEN

      Hi,

      Silly question: is it possible to do a failover test and without stopping the primary server (and maybe without performing a takeover)?

      A bit like doing a System Copy based on System Replication, but to "reinstate" the secondary when the test has finished.

      In the System Admin Guide it states that you need to do a takeover in order to use the secondary as a copy, but does that not leave "meta-data" on the primary server saying that it is now a secondary? Or do you need to then apply SAP Note 1945676 to unregister the secondary (but, it is now a primary if you did a takeover). So, basically I'm still a bit confused, altough I have not yet read all the documentation.

      Frank

       

      Author's profile photo Jan Peake
      Jan Peake

      Hi Frank,

      great info thanks.  In the last paragraph: "SIDE STORY: DISASTER IN SITEB OCCURS WHILE  ITEB=SEC" you state that not much to do.  We have experienced the clients connection to the primary being interrupted when the Secondary comes back online unless we are able to intervene and switch it into maintenance mode first.  Is this normal behavior?

       

      Thanks,

      Jan