HANA System Replication for Migration
Master HANA System Replication (HSR) as a migration tool β understand primary/secondary architecture, replication modes (synchronous, synchronous in-memory, asynchronous), memory preload settings, and the end-to-end HSR migration workflow.
Why use HSR for migration?
ποΈ Raj checks the clock. βWe have a six-hour maintenance window. DMO for our 2 TB database takes 8-12 hours. Classical backup and restore over ExpressRoute could also push past six hours. How do we fit this into our window?β
βοΈ Mei draws two boxes on the whiteboard. βHANA System Replication. We set up a secondary HANA instance on Azure and let it replicate from your on-premises primary for days or weeks before the migration. When cutover day arrives, we just flip the roles. The actual downtime is minutes, not hours.β
Think of it like hiring a new employee to shadow the veteran before the veteran retires.
Instead of waiting for the veteran to leave and then scrambling to train a replacement (backup and restore), you bring in the new person (Azure secondary) weeks early. They sit next to the veteran (on-premises primary) and learn everything in real time (continuous replication). On retirement day, the new person just takes over the desk. There is no gap β the handover takes minutes because the new person is already fully up to speed.
HSR architecture: Primary and secondary
HANA System Replication uses a primary/secondary architecture:
- Primary β The active HANA instance serving the SAP application. All read/write operations go here.
- Secondary β The replica instance receiving redo logs from the primary. It can replay logs in real time or on demand.
For migration:
- Your on-premises HANA instance is the primary
- An Azure VM running HANA is the secondary
- After initial full data copy and continuous log shipping, the secondary is in sync
- At cutover, you execute a takeover β the secondary becomes the new primary
Replication modes: Sync, syncmem, and async
HSR supports three replication modes. Each makes a different trade-off between data protection and performance.
| Mode | How it works | Data loss risk | Performance impact | Best use case |
|---|---|---|---|---|
| SYNC (synchronous) | Primary waits for the secondary to write redo logs to disk before acknowledging the transaction to the application | Zero data loss β every committed transaction exists on both systems | Highest β every transaction has added latency for the secondary disk write | High availability within the same Azure region where network latency is sub-millisecond |
| SYNCMEM (synchronous in-memory) | Primary waits for the secondary to receive redo logs in memory (not written to disk) before acknowledging | Near-zero data loss β only in-flight logs in secondary memory could be lost if the secondary crashes | Medium β less latency than SYNC because no secondary disk write wait | Cross-region replication or migration scenarios where some latency tolerance exists |
| ASYNC (asynchronous) | Primary sends redo logs to the secondary but does not wait for acknowledgment before committing | Potential data loss β transactions committed on primary may not yet be replicated to secondary | Lowest β no additional latency on primary transactions | Long-distance replication (on-premises to Azure) where network latency is significant |
Which mode for migration?
βοΈ Mei explains the trade-off. βFor on-premises to Azure migration, asynchronous mode is almost always the right choice. The network latency between your datacenter and Azure is too high for synchronous replication β it would cripple your production system performance. Async mode keeps your production running at full speed while replication happens in the background.β
ποΈ Raj looks concerned. βBut async means we could lose data during cutover?β
βοΈ Mei reassures him. βThe risk window is tiny. During cutover, you stop the application on the primary, wait for the last redo logs to replicate (usually seconds), then perform the takeover. If the network is stable, you lose zero transactions. The data loss risk in async mode is only during an unplanned failure β not during a planned migration cutover.β
Exam tip: Mode selection by scenario
When an exam question asks about HSR mode: if the primary and secondary are in the same Azure region, SYNC or SYNCMEM are appropriate. If they are cross-region or on-premises to Azure, ASYNC is the answer. The key factor is network latency β synchronous modes add latency to every transaction commit.
Memory preload on the secondary
HANA allows you to control how much data the secondary system preloads into memory. This is an important cost and performance decision.
Preload enabled (default for HA scenarios):
- The secondary loads table data into memory as redo logs are replayed
- Takeover is fast because data is already in memory β the secondary can serve queries immediately
- Requires the secondary VM to have the same memory as the primary
- Higher cost because you are paying for a fully loaded memory-optimized VM
Preload disabled (common for DR and migration scenarios):
- The secondary replays redo logs but does not load data into memory
- Takeover is slower because the secondary needs to load data from disk into memory on demand
- Allows a smaller secondary VM (less memory), reducing cost
- Acceptable for migration because after takeover, the system has time to warm up before peak load
ποΈ Raj calculates costs. βSo for our migration secondary on Azure, we could use a smaller VM with preload disabled since we only need it to be a replica until cutover?β
βοΈ Mei confirms. βExactly. During the migration window, the secondary just needs to keep up with log replay. After takeover, you can resize the VM to production specifications. This saves money during the weeks of pre-migration replication.β
The HSR migration workflow
Here is the end-to-end workflow for migrating SAP HANA from on-premises to Azure using HSR:
Weeks before cutover:
- Deploy the target Azure VM β Correct VM size, OS, HANA installation, storage configuration (ANF or managed disks for data volumes, Ultra Disk or Premium SSD for log volumes)
- Establish network connectivity β ExpressRoute or VPN between on-premises and Azure. HSR needs low-latency, reliable connectivity for log shipping.
- Register the Azure HANA as HSR secondary β Configure the secondary to replicate from the on-premises primary using ASYNC mode
- Initial data sync β HSR automatically performs a full data copy from primary to secondary. For a 2 TB database, this could take hours to days depending on bandwidth.
- Monitor replication β Use HANA Studio or HANA cockpit to verify the secondary is in sync. Monitor the replication lag (seconds behind primary).
Cutover day:
- Stop the SAP application on the on-premises primary
- Wait for replication to catch up β Monitor until the secondary has replayed all remaining redo logs (typically seconds to minutes)
- Perform HSR takeover β Promote the Azure secondary to primary. The on-premises system is deregistered.
- Reconfigure SAP β Update SAP profiles, connection strings, and host name resolution to point to the Azure VM
- Start the SAP application on Azure and validate
- Update DNS and network routing β Ensure users and integrations reach the Azure system
Exam tip: HSR cutover sequence
The cutover sequence is: stop application β wait for log replay to complete β takeover (promote secondary) β reconfigure SAP β start application β validate. Never perform the takeover while the application is still writing to the primary β you need a clean stop to ensure all transactions are replicated.
Network requirements for HSR migration
HSR log shipping is sensitive to network quality. For a reliable migration:
- Bandwidth β Sufficient to handle the initial full copy plus ongoing log shipping without falling behind. For a busy system generating 100 GB/hour of redo logs, you need at least that bandwidth sustained.
- Latency β Lower is better but not critical for ASYNC mode. High latency increases replication lag but does not affect primary performance.
- Reliability β Network interruptions cause HSR to disconnect. Short interruptions trigger automatic reconnection and delta sync. Long interruptions may require a full resync.
- ExpressRoute recommended β Provides dedicated, reliable bandwidth between on-premises and Azure. VPN over internet is possible but less predictable.
- Port requirements β HSR uses a set of TCP ports based on the HANA instance number. These ports must be open in firewalls and NSGs.
Knowledge check
PrecisionSteel has a six-hour maintenance window and a 2 TB HANA database. Raj wants to minimize cutover downtime. Which migration approach should he use?
Raj is setting up HSR replication from PrecisionSteel's on-premises HANA primary to an Azure secondary. Which replication mode is typically recommended?
Raj wants to reduce the cost of the Azure HANA secondary VM during the weeks of pre-migration HSR replication. What setting allows a smaller secondary VM?
Summary
HANA System Replication is the go-to technique for near-zero-downtime SAP migration to Azure. By pre-syncing a secondary HANA instance on Azure weeks before cutover, the actual downtime shrinks to minutes. ASYNC mode is standard for on-premises to Azure due to network latency. Memory preload settings let you optimize cost during the replication period. The cutover sequence β stop application, wait for log replay, takeover, reconfigure, start β is clean and predictable.
Next and finally, we cover post-migration validation and the special case of migrating from HANA Large Instances to Azure VMs.
π¬ Video coming soon