Skip to Content

Hi,

In this blog we are trying to perform takeover and fail back testing.

We have database on two different server melcoprd and melcodev. Our database is in mcod scenario in which it has 3 tenant database.

  
MELCODEV                                                                        MELCOPRD

We have melcodev hana box in which 3 database instances are installed namely.

HD1-> development database

HQ1-> quality database

HP1-> production database

We have melcoprd hana box in which only one  database instance is  installed namely.

HP1-> production database

We have installed the hana database with virtual IP/virtual host name for production.

SAP application are also installed with virtual IP/virtual host name in production scenario. Application used to connect to database using the virtual IP .

Instance number of these database are

00 for production

02 for development

04 for quality

We have not used 01 or 03 as instance number because the port used with instance number is used for replication.

ENVIRONMENT

SITE1 = HP1 on melcoprd is site 1 or primary site for preferred data center.

SITE2 = HP1 on melcodev is site 2 or secondary site for second data center.

melcoprdHP1 = HANA system which acts as primary in replication mode

melcodevHP1 = HANA system which acts as secondary in replication mode

Prerequisite for System Replication

1. The hana database on primary and secondary systems are both installed and configured. We have to verified that both are independently up and running.

2. The number of node on primary must be equal to the secondary.

3. The HANA version must be same on both primary and secondary system.

4. The secondary system must have identical SAP system ID and instance number as the primary system.

5. The initial db backup has to be executed before starting the system replication.

System Replication for HP1

Target Solution Overview

All the command are executed with <SID>adm user.

So, here we will discuss 3 scenario.

1. Takeover the database from primary to secondary.

2. Register the primary as secondary site for replication.

3. Take-back to the original primary system.

 

Before performing a takeover, we will check the replication is working fine.

Verifying the system replication

STEP 1

Verify that system replication is running on melcoprd

enter the following command  —–>   hdbnsutil -sr_state

this command will show information about the system replication status.

Here we can see our primary site name is melcoprdHP1 and Id is 1.

now we will run python command to check the system replication status

command ——>  python systemReplicationStatus.py

Here we can see that data is being replicated from melcoprd to melcodev. Nameserver  service contain all the processed data, so it is being replicated.

Now we will verify the replication status on melcodev

enter the following command  —–>   hdbnsutil -sr_state

this command will show information about the system replication status.

As we can see that the secondary site is melcodevHP1 with Id 2.

now we will run python command to check the system replication status

command ——>  python systemReplicationStatus.py

Since replication is happening from melcoprd. We cannot see the replication status since it is not primary site.

1.   Takeover the database from melcoprd to melcodev

In our case for takeover we stopped the server.

shutdown melcoprd

command ——> shutdown -h now

SAP application server stop working

takeover the database from melcoprd to melcodev

login to melcodev

command ———->  hdbnsutil -sr_takeover

It will switch the system replication primary site to the secondary site.

It will take over the database from melcoprd to melcodev.

this command will take some time.

SAP application start working.

2.   Register the melcoprd as a secondary site for replication

Starts the melcoprd server

Stop the database

command ——-> HDB stop

Now we login the melcodev to check the system replication status.

command ———>  python systemReplicationStatus.py

Since no replication is happening as we have not register the melcoprd as secondary database.

So. we will register the melcoprd as secondary site.

Registering the melcoprd as secondary site for replication

command ———–>  hdbnsutil -sr_register –name=melcoprdHP1 –remoteHost=melcodev —

remoteInstance=00 –replicationMode=sync –operationMode=delta_datashipping

name—> melcoprdHP1   -> The system to which data will be replicated.
remoteHost—-> melcodev  -> The remote host from where the data will be replicated.
remoteInstance —> The instance number of hana database.
replicationMode —-> We can give the mode of replication.
operationMode —-> operation mode may be delta_shipping or logreplay

check the state on melcoprd

command —->  hdbnsutil  -sr_state

As we can see primary is melcodev and secondary is melcoprd

 

Check the replication status from melcodev to melcoprd


login on to melcodev

command ———–>  python systemRelicationStatus.py

 

Start the database on melcoprd

HDB start



3.     Take-back to the original primary system

 

check the status of replication

login to melcoprd

command ———-> hdbnsutil -sr_state


Takeover the database from melcodev to melcoprd

command ———–> hdbnsutil -sr_takeover

login to melcodev and check the system replication status

command ———> python systemReplicationStatus.py

system replication is not active

Making melcodev as secondary system
stop the database

login on melcodev

HDB stop

Registering the melcodev as secondary site for replication

login to melcodev

hdbnsutil -sr_register –name=melcodevHP1 –remoteHost=melcoprd –remoteInstance=00 —

replicationMode=sync –operationMode=delta_datashipping



checking the system replication on melcodev

command ————>  hdbnsutil -sr_state

Now we can see that our primary site is melcoprd and secondary site is melcodev

 

Checking the system replication status on melcoprd

command ——–> hdbnsutil -sr_state

Start the database on melcodev

login on melcodev

HDB start

check the system replication status on melcoprd

login to melcoprd

python systemReplicationStatus.py

We can see replication is working fine.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply