Quantcast
Channel: SCN : Blog List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 676

Recovery Technologies of SAP HANA-Part 3: Database Recovery

$
0
0

It may be necessary to recover the SAP HANA database in the following situations:

  • A disk in the data area is unusable.
  • A disk in the log area is unusable.
  • As a consequence of a logical error, the database needs to be reset to its state at a particular point in time.
  • You want to create a copy of the database.

Data Area is Unusable

If the data area is unusable, and all the data changes after the last complete data backup are still available in the log backups and log area, the data from committed transactions that was in memory at the time of failure can be recovered.

No committed data is lost. For recovery, the data backups, the log backups, and the log area are used. When the data backup has been successfully recovered, the log entries from the log backups and the log area are automatically replayed.

It is also possible to recover the database using an older data backup and log backups. All relevant log backups made after the data backup are needed for the recovery.

Log Area is Unusable

If the log area is unusable, it is only possible to replay the log backups. As a consequence, any changes that were made after the most recent log backup will be lost. In addition, all the transactions that were open during the log backup will be rolled back.

For recovery, the data backups and the log backups are used. When the data backup has been successfully recovered, the log entries from the log backups are automatically replayed. In the Recovery Wizard, you must specify the option Initialize log area to prevent the recovery of entries from the unusable log area. This option initializes the log area, and the old content of log area is lost.

Logical Error – Point in Time Recovery

To reset the database to a particular point in time, you need a data backup from before the point in time to recover to, the subsequent log backups, and the log area.

All changes made after the recovery time will be lost. If you need to perform this recovery, consider recovering the database to a different system.

Recovering the SAP HANA database

To recover a SAP HANA database:

  1. From SAP HANA studio, open the context menu for the database to be recovered. Choose Recovery...

You are requested to confirm that the system can be shut down for the recovery.1.png

2. Confirm and enter the <SID>adm user and password.

Choose OK. The database is shut down.

3. Specify the recovery type. The following recovery types are available:

Option

Description

Recover the database to its most recent state

This option recovers the database to as close as possible to the current time.

This recovery option uses the following data:

  • The most recent data backup
  • Log backups made since the most recent data backup
  • Log area

 

Recover the database to the following point in time

This recovery option uses the following data:

  • The last data backup available before the specified point in time
  • Log backups made since the backup to be used
  • Log area

Recover the database to a specific data backup

This recovery option uses the following data:

  • The specified data backup

Recover the database to  the following log position

This recovery type is an advanced option that can be used in exceptional cases if a previous recovery failed.

This recovery option uses the following data:

  • The most recent data backup available before the specified log position
  • Log backups made since the data backup to be used
  • Log area

2.png

4. Choose Next.

The SAP HANA database uses the backup catalog to identify the location of the backups. You do not need to specify whether File or Backint was used for the backup.

5. If the log backup is needed, specify the location of log backups.

3.png

6. Choose Next.

4.png

7. A summary of the selected recovery options is displayed. To make changes to the recovery configuration, choose Back.

5.png

8. If the settings are correct, choose Finish. The recovery is then started.

6.png

7.png

8.png

Copying a Database Using Backup and Recovery

You can create a homogenous copy of a database by recovering an existing source database backup to a different, but compatible target database. The source database backup consists of data backup files and the log backup files.

A homogenous database copy is a quick way to set up cloned systems for training, testing, and development. For this reason, copying a database can significantly reduce total cost of delivery (TCD).

The following prerequisites must be met:

  • A database backup of the source database must be available.
  • The version of the target database system is the same or higher than the source database.
  • The target system must be configured with sufficient disk space and memory.
  • Ensure that the configuration of the target system is identical to the configuration of the source system.
  • The number of hosts and the number and types of services (for example, index server) on each host must be identical for both system landscapes.
  • Customer-specific configuration changes can be manually applied to the target system.

To create a homogenous copy of a database:

  1. Shut down the target database.
  2. Move or delete available data and log backup files from the target database.
  3. Copy the data backup files and, optionally, the log backup files from the source database to the corresponding directories in the target database.
  4. Start the recovery of the target database system.

In SAP HANA studio, select the target database system and choose Recover… from the context menu.

  1. Select the recovery type Recover the database to its most recent state.
  2. Choose Next.
  3. Choose Add to specify the location of log backup files for the target database.
  4. Choose Next.
  5. Choose location of data backup files for the target database.
  6. Select the option Initialize log area.
  7. Choose Next.
  8. Confirm the warning.
  9. Select the option Install new license key and specify the license key file.
  10. Choose Next.
  11. If the recovery options are correct, choose Finish. The recovery is then started.

When the recovery is successfully completed, the database is started.

Copying a Database Using Snapshot

  1. Create a snapshot on source SAP HANA database.

BACKUP DATA CREATE SNAPSHOT (Or using HANA Studio)

  1. Shut down the target SAP HANA database. Copy the data area from the source database to the target database.
  2. Confirm or abandon the snapshot:

SNAPSHOT BACKUP_ID <backup_id> SUCCESSFUL <external_id> | UNSUCCESSFUL [<string>]SUCCESSFUL <external_id>

You can use following statement to query the snapshots.

SELECT * FROM "SYS"."M_BACKUP_CATALOG" WHERE ENTRY_TYPE_NAME = 'data snapshot'

  1. Delete the backup files in target database.
  2. Execute the following command in target databse:

hdbnsutil -useSnapshot
hdbnsutil –convertTopology

  1. Start the target database.

Viewing all articles
Browse latest Browse all 676


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>