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: 
0 Kudos
Dynamic tiering now supports SAP HANA system replication to protect your production system against unexpected downtime due to disasters.

In this blog, I'll highlight some important details about post takeover point-in-time recovery.



Backups in Shared Locations


First, let's look at recovery when you write backups to a shared location.

If you write data backups and log backups to a shared location, be sure to mount this location on both the primary and secondary systems.  After takeover by the secondary system, the primary can still write log backups until you stop or disable backups.  As a result, log backups taken by the secondary may be overwritten by log backups tken by the primary site, and database recovery may fail.

Thus, on dynamic tiering systems, as on all SAP HANA systems, make sure that you disable log backups on the primary site after the seondary site takes over.  In other words, after takeover:

  1. Deactivate scheduled data backups and automatic log backups in the former primary system.

  2. Configure backups in the new primary system according to your requirements.


Backups in Different Locations


Suppose that you write logs to different locations?

For point-in-time recovery after takeover, the log directory path should point to the secondary system's log backup directory.

If the .eslog files are missing in the secondary system's log backup directory, selectively copy the missing .eslog files from the primary system's log directory. ES log file names can match on the primary and secondary systems after takeover, in case the primary system continues to run post-takeover.  If a .eslog file is already in the secondary system's log backup directory, do not copy the same file from the primary system. Never overwrite the secondary system's .eslog files.

If backup archives exist at a shared location, and .eslog files needed for recovery are distributed across multiple directories, then the secondary system's log directory takes precedence when you list the log directories in the recovery command.

In summary, before point-in-time recovery on the secondary server after takeover:

  1. Copy all the files from the log backup directory on the primary system to the log backup directory on the secondary system except for the common *.eslog file present in the log backup directory on the primary system and in the log backup directory on the secondary system.

  2. Copy all the files in the data backup directory on the primary system to the data backup directory on the secondary system


Example


Finally, here's a look at the directory contents for a point-in-time recovery with logs in different locations.

In this example, the primary system is Site1 and the secondary system is Site2.

  1. Take a full backup called F1 on Site1.
    On Site1, contents of data backup dir /usr/sap/M34/HDB34/backup/data
    -rw-r----- 1 m34adm sapsys    159744 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_0_1
    -rw-r--r-- 1 m34adm sapsys  49657668 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_1024_1_1476422901360.1
    -rw-r----- 1 m34adm sapsys  83894272 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_1_1
    -rw-r----- 1 m34adm sapsys  83894272 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_2_1
    -rw-r----- 1 m34adm sapsys 318775296 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_3_1

  2.  Take a log backup on Site1.
    On Site1, contents of log backup dir /usr/sap/M34/HDB34/backup/log
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:28 log_backup_0_0_0_0.1476422917294
    -rw-r--r-- 1 m34adm sapsys 15597568 Oct 14 05:44 log_backup_1024_000_000001_0001.eslog
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:44 log_backup_0_0_0_0.1476423862352
    -rw-r--r-- 1 m34adm sapsys  2524396 Oct 14 05:44 log_backup_1024_20161014_054421285.1
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:44 log_backup_0_0_0_0.1476423862717

  3. On Site1, execute:
    hdbnsutil -sr_enable--name=primary

  4. On Site2, perform initialization.

  5. On Site1, take a log backup, creating the following new files in the log backup directory:
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 06:00 log_backup_0_0_0_0.1476424814304
    -rw-r--r-- 1 m34adm sapsys  2503916 Oct 14 06:00 log_backup_1024_20161014_060013011.1
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 06:00 log_backup_0_0_0_0.1476424814762
    -rw-r--r-- 1 m34adm sapsys 24182784 Oct 14 06:00 log_backup_1024_000_000002_0001.eslog

  6. On Site1, run DML commands and take a log backup.  These new files are created in the log directory:
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 06:01 log_backup_0_0_0_0.1476424882374
    -rw-r--r-- 1 m34adm sapsys  2491628 Oct 14 06:01 log_backup_1024_20161014_060120705.1
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 06:01 log_backup_0_0_0_0.1476424882638
    -rw-r--r-- 1 m34adm sapsys 16711680 Oct 14 06:01 log_backup_1024_000_000003_0001.eslog

  7. On Site2, perform takeover.

  8. On Site2 perform DMLs and take log backup.These new files are created in the log directory:
    -rw-r----- 1 m34adm sapsys    16384 Oct 14 06:05 log_backup_0_0_0_0.1476425101005
    -rw-r--r-- 1 m34adm sapsys  2495724 Oct 14 06:05 log_backup_1024_20161014_060500090.1
    -rw-r----- 1 m34adm sapsys    16384 Oct 14 06:05 log_backup_0_0_0_0.1476425101359
    -rw-r--r-- 1 m34adm sapsys 19922944 Oct 14 06:05 log_backup_1024_000_000003_0001.eslog-rw-r----- 1 m34adm sapsys    16384 Oct 14 06:06 log_backup_0_0_0_0.1476425166233
    -rw-r--r-- 1 m34adm sapsys  2491628 Oct 14 06:06 log_backup_1024_20161014_060604748.1
    -rw-r----- 1 m34adm sapsys    16384 Oct 14 06:06 log_backup_0_0_0_0.1476425166915
    -rw-r--r-- 1 m34adm sapsys 11796480 Oct 14 06:06 log_backup_1024_000_000004_0001.eslog

  9. On Site2, perform DMLs and take log backup. These new files are created in the log backup directory:
    -rw-r----- 1 m34adm sapsys    16384 Oct 14 06:22 log_backup_0_0_0_0.1476426121400
    -rw-r--r-- 1 m34adm sapsys  2503916 Oct 14 06:22 log_backup_1024_20161014_062200056.1
    -rw-r----- 1 m34adm sapsys    16384 Oct 14 06:22 log_backup_0_0_0_0.1476426121842
    -rw-r--r-- 1 m34adm sapsys 16711680 Oct 14 06:22 log_backup_1024_000_000005_0001.eslog

  10. The final contents of the log backup directory on Site1 are:
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:28 log_backup_0_0_0_0.1476422917294
    -rw-r--r-- 1 m34adm sapsys 15597568 Oct 14 05:44 log_backup_1024_000_000001_0001.eslog
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:44 log_backup_0_0_0_0.1476423862352
    -rw-r--r-- 1 m34adm sapsys  2524396 Oct 14 05:44 log_backup_1024_20161014_054421285.1
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:44 log_backup_0_0_0_0.1476423862717-rw-r----- 1 m34adm sapsys    12288 Oct 14 06:00 log_backup_0_0_0_0.1476424814304
    -rw-r--r-- 1 m34adm sapsys  2503916 Oct 14 06:00 log_backup_1024_20161014_060013011.1
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 06:00 log_backup_0_0_0_0.1476424814762
    -rw-r--r-- 1 m34adm sapsys 24182784 Oct 14 06:00 log_backup_1024_000_000002_0001.eslog-rw-r----- 1 m34adm sapsys    12288 Oct 14 06:01 log_backup_0_0_0_0.1476424882374
    -rw-r--r-- 1 m34adm sapsys  2491628 Oct 14 06:01 log_backup_1024_20161014_060120705.1
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 06:01 log_backup_0_0_0_0.1476424882638
    -rw-r--r-- 1 m34adm sapsys 16711680 Oct 14 06:01 log_backup_1024_000_000003_0001.eslog

  11. The final contents of the log backup directory on Site2 are:
    -rw-r----- 1 m34adm sapsys    16384 Oct 14 06:05 log_backup_0_0_0_0.1476425101005
    -rw-r--r-- 1 m34adm sapsys  2495724 Oct 14 06:05 log_backup_1024_20161014_060500090.1
    -rw-r----- 1 m34adm sapsys    16384 Oct 14 06:05 log_backup_0_0_0_0.1476425101359
    -rw-r--r-- 1 m34adm sapsys 19922944 Oct 14 06:05 log_backup_1024_000_000003_0001.eslog-rw-r----- 1 m34adm sapsys    16384 Oct 14 06:06 log_backup_0_0_0_0.1476425166233
    -rw-r--r-- 1 m34adm sapsys  2491628 Oct 14 06:06 log_backup_1024_20161014_060604748.1
    -rw-r----- 1 m34adm sapsys    16384 Oct 14 06:06 log_backup_0_0_0_0.1476425166915
    -rw-r--r-- 1 m34adm sapsys 11796480 Oct 14 06:06 log_backup_1024_000_000004_0001.eslog

  12. Before you perform PITR on Site2:
    a) On Site1, in the log backup directory, run: ls -lrt | grep *.eslog
    b) On Site2, in the log backup directory, run: ls -lrt | grep *.eslog
    c) Excluding the common *.eslog file found on both Site1 and Site2, copy all the remaining files from
    log backup directory on Site1 to the log backup directory on Site2.
    This step copies these files to Site2:
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:28 log_backup_0_0_0_0.1476422917294
    -rw-r--r-- 1 m34adm sapsys 15597568 Oct 14 05:44 log_backup_1024_000_000001_0001.eslog
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:44 log_backup_0_0_0_0.1476423862352
    -rw-r--r-- 1 m34adm sapsys  2524396 Oct 14 05:44 log_backup_1024_20161014_054421285.1
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 05:44 log_backup_0_0_0_0.1476423862717-rw-r----- 1 m34adm sapsys    12288 Oct 14 06:00 log_backup_0_0_0_0.1476424814304
    -rw-r--r-- 1 m34adm sapsys  2503916 Oct 14 06:00 log_backup_1024_20161014_060013011.1
    -rw-r----- 1 m34adm sapsys    12288 Oct 14 06:00 log_backup_0_0_0_0.1476424814762
    -rw-r--r-- 1 m34adm sapsys 24182784 Oct 14 06:00 log_backup_1024_000_000002_0001.eslogd) Copy all the files from the data backup directory on Site1 to the data backup directory on Site2.
    This step copies these files to Site2:
    -rw-r----- 1 m34adm sapsys    159744 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_0_1
    -rw-r--r-- 1 m34adm sapsys  49657668 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_1024_1_1476422901360.1
    -rw-r----- 1 m34adm sapsys  83894272 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_1_1
    -rw-r----- 1 m34adm sapsys  83894272 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_2_1
    -rw-r----- 1 m34adm sapsys 318775296 Oct 14 05:28 COMPLETE_DATA_BACKUP_databackup_3_1

  13. Perform point-in-time recovery on Site2.