Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
bhargav_bhatt
Active Participant
0 Kudos
392

Hello All,

This blog will explain you details on how to copy HANA database using tenant copy procedure.

It can be helpful in various scenario's like

  • Database Homogenous Migration.
  • Refreshing Database.
  • Creating New system from existing one.

It follow similar mechanism as that of HANA Database Replication.

Prerequisite's for doing HANA tenant copy.

  • Verify TLS/SSL Configuration of Internal Communication Channels (Optional)
  • Set Up Trust Relationship Between Target and Source Systems (Optional)
  • Open Communication From Target to Source System (Mandatory)
  • Create Credential for Authenticated Access to Source System (Mandatory)

Unlike HSR we don't need OS access for doing tenant copy. we need SYSTEM user credentials for both target and source HANA database.

In our scenario, we did our HEC to RISE migration using HANA tenant copy. So this blog will be more focused on usage of Tenant copy in Database Migration.

Setting up parameters in source system

we need to set below parameters in source system. It might be possible that these are already set on the database so please verify the same.

In our case we did not had SSL communication and trust setup between source and target hence we are disabling SSL.

 

ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('multidb', 'enforce_ssl_database_replication') = 'false' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication_communication', 'enable_ssl') = 'off' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('communication', 'ssl') = 'off' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('communication', 'listeninterface') = '.global' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication', 'logshipping_async_buffer_size') = '1073741824' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication', 'logshipping_timeout') = '30' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('persistence', 'log_mode') = 'normal' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('inifile_checker', 'enable') = 'true' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('inifile_checker', 'replicate') = 'false' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('indexserver.ini', 'SYSTEM') SET ('system_replication', 'logshipping_async_buffer_size') = '10737418240' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication', 'logshipping_async_wait_on_buffer_full') = 'false' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication', 'logshipping_max_retention_size') = '1048576' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication', 'enable_log_retention') = 'on' WITH RECONFIGURE;

 

Parameters to be set on target database

we need to set below parameters on target database (execute commands in systemDB > sql editor)

 

ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('multidb', 'enforce_ssl_database_replication') = 'false' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication_communication', 'enable_ssl') = 'off' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('communication', 'ssl') = 'off' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('communication', 'listeninterface') = '.global' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication', 'logshipping_async_buffer_size') = '1073741824' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('system_replication', 'logshipping_timeout') = '30' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('persistence', 'log_mode') = 'normal' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('inifile_checker', 'enable') = 'true' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM') SET ('inifile_checker', 'replicate') = 'false' WITH RECONFIGURE;

 

Note : If this parameter are not set already then after setting up parameter you need restart of HANA database. (Both source DB and target DB)

Additionally we can check if any additional HANA source is having using below command

SELECT * FROM M_PLUGIN_MANIFESTS;

we need to have same plugins on target database as well

Setting up tenant copy 

Below are the steps to be followed to start tenant copy 

  1. Login to target database on systemDB using SYSTEM user using HANA studio
  2. Open SQL editor and run below commands.
  3. Stop tenant database

 

ALTER SYSTEM STOP DATABASE <SID>;

 

Note : If DB SID which you are copying is having same SID name then we need to drop the existing tenant DB. If you want to copy to different SID then no need to drop the existing tenant DB in target

  • We had same SID name hence dropping the target tenant DB using below command

 

Drop database <SID>; ​

 

  • Create Credential for Authenticated Access to Source System

 

CREATE CREDENTIAL FOR COMPONENT 'DATABASE_REPLICATION' PURPOSE '<hostname of source db>:<Nameserver SQL port>' TYPE 'PASSWORD' USING 'user="SYSTEM";password="<password>"'

 

  • Starting copy

 

CREATE DATABASE <SID> AS REPLICA OF <Source DB SID>  AT '<Source DB hostname>:<30001>';

 

This will start your tenant copy from source to target

you can monitor the progress using below command

 

SELECT * FROM SYS_DATABASES.M_DATABASE_REPLICA_STATISTICS;

 

abxdefgh_0-1726043912289.png

you might get error regarding authentication or replication status as unknown.

for that you can find the logs in target database " indexserver log file "

Performing takeover / Finalizing replication

Once entire database is copied you will see status as " Active "

abxdefgh_1-1726043983742.png

Now we are ready for finalizing the database copy.

Use below command on target SystemDB to complete the copy.

Note : when you are doing database migration you need to rampdown the source system application first then perform the  FINALIZE REPLICA

 

Alter database PRD FINALIZE REPLICA;

 

Once you are done with this you can drop the source system credentials using below command

 

DROP CREDENTIAL FOR COMPONENT 'DATABASE_REPLICATION' PURPOSE 'Source DB hostname:30001' TYPE 'PASSWORD';

 

 you can revert the parameters that were set during tenant copy procedure.

By using this method we migrated the systems hosted on HANA database from one datacenter to other datacenter.

Below are some reference articles of SAP

Copy a Tenant Database to Another System 

SAP Note - 2472478 

Labels in this area