0% found this document useful (0 votes)
130 views30 pages

Hana1 Imdb Backup en

The SAP HANA Database Backup and Recovery Guide provides essential information for consultants and administrators on how to perform backups and recoveries of the SAP HANA database, which primarily stores data in memory but requires persistent storage for data protection. It outlines procedures for backing up data and log areas, as well as configuration files, while emphasizing the importance of regular backups to prevent data loss from disk failures. The guide also details prerequisites for performing backups and recovery, including necessary user privileges and system configurations.

Uploaded by

Raghu Chiranjivi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views30 pages

Hana1 Imdb Backup en

The SAP HANA Database Backup and Recovery Guide provides essential information for consultants and administrators on how to perform backups and recoveries of the SAP HANA database, which primarily stores data in memory but requires persistent storage for data protection. It outlines procedures for backing up data and log areas, as well as configuration files, while emphasizing the importance of regular backups to prevent data loss from disk failures. The guide also details prerequisites for performing backups and recovery, including necessary user privileges and system configurations.

Uploaded by

Raghu Chiranjivi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

SAP HANA Database Backup and Recovery Guide SAP HANA Appliance Software SPS3

Target Audience Consultants Administrators SAP Hardware Partner Others

Public Document version 1.0 11/7/2011

SAP AG Dietmar-Hopp-Allee 16 69190 Walldorf Germany T +49/18 05/34 34 34 F +49/18 05/34 34 20 www.sap.com Copyright 2011 SAP AG. All rights reserved. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology.

Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Java is a registered trademark of Sun Microsystems, Inc JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. Disclaimer Oracle is a registered trademark of Oracle Corporation.

Some components of this product are based on Java. Any code change in these components may cause unpredictable and severe malfunctions and is therefore expressively prohibited, as is any decompilation of these components.

Any Java Source Code delivered with this product is only to be used by SAPs Support Services and may not be modified or altered in any way.

Documentation in the SAP Service Marketplace You can find this documentation at the following Internet address:
service.sap.com/hana

Typographic Conventions
Type Style
Example Text

Icons
Icon Meaning Caution Example Note Recommendation Syntax

Description Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Cross-references to other documentation Emphasized words or phrases in body text, graphic titles, and table titles Technical names of system objects. These include report names, program names, transaction codes, table names, and key concepts of a programming language when they are surrounded by body text, for example, SELECT and INCLUDE. Output on the screen. This includes file and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools. Exact user entry. These are words or characters that you enter in the system exactly as they appear in the documentation. Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system. Keys on the keyboard, for example, F2 or ENTER.

Example text

EXAMPLE TEXT

Example text

Additional icons are used in SAP Library documentation to help you identify different types of information at a glance. For more information, see Help on Help General Information Classes and Information Classes for Business Information Warehouse on the first page of any version of SAP Library.

Example text

<Example text>

EXAMPLE TEXT

Contents

SAP HANA DATABASE BACKUP AND RECOVERY GUIDE...................................................... 1 Introduction ....................................................................................................................... 1 SAP HANA Guides ............................................................................................................... 2 Points to Note .................................................................................................................... 3 Prerequisites and Recommendations ................................................................................ 3 Avoiding LOG FULL (file system full) situations ......................................................... 4 BACKING UP THE SAP HANA DATABASE ............................................................................ 4 Backing Up the Data Area .................................................................................................. 5 Location of the Backup Files ..................................................................................... 5 Backup ID for Data Backup ........................................................................................ 5 Disk Space Check ....................................................................................................... 5 Backing Up the Log Area .................................................................................................... 6 Backing Up the Configuration Files .................................................................................. 10 Backup Catalog ................................................................................................................. 10 Backup Catalog Monitoring Views .......................................................................... 12 Performing a Database Backup ........................................................................................ 13 Performing a Database Backup Using SAP HANA Studio ........................................ 13 Performing a Database Backup Using SQL Commands ........................................... 14 Performing a Database Backup Using Batch Mode ................................................ 14 RECOVERING THE SAP HANA DATABASE ......................................................................... 16 Log Replay ........................................................................................................................ 17 Recovery of Data Backup Without Implicit Log Replay (CLEAR LOG) ..................... 18 Recovering the Configuration Files .................................................................................. 19 Recovery After a Disk Failure for the Data Area ..................................................... 19 Recovery After Corruption of the Log Area ............................................................ 20 Performing a Recovery ..................................................................................................... 21 Prerequisites ........................................................................................................... 21 Constraints .............................................................................................................. 21 Recovering the Database Using SAP HANA Studio ................................................. 21

SAP HANA Database Backup and Recovery Guide


Introduction
This Guide describes the administration and implementation of the backup and recovery features of the SAP HANA database. The SAP HANA database holds the bulk of its data in memory to ensure optimal performance, but it still uses persistent storage to provide a fallback in case of failure. During normal database operation, data is automatically saved from memory to disk at regular savepoints. Additionally, all data changes are recorded in the log. The log is saved from memory to disk after each committed database transaction. After a power failure, the database can be restarted like any disk-based database and returns to its last consistent state by replaying the log since the last savepoint. While savepoints and log writing protect your data against power failures, this does not help if the persistent storage itself is damaged. To protect against data loss due to disk failures, backups are required. Backups save the contents of the data and log areas to different locations. Currently only backups to the file system are supported. Backups are performed while the database is running, so users can continue to work normally. The impact of backups on the system performance is negligible. This Guide describes the steps to perform the following tasks: Create a data backup of the SAP HANA database. Configure when log backups are created. Perform a recovery of the SAP HANA database.

This Guide does not describe how to perform a backup and recovery of all the components which can be part of SAP HANA. It deals with the SAP HANA database only. Note This Guide does not replace the documentation that customers are recommended to use for their specific production operations.

SAP HANA Database - Backup and Recovery Guide

October 2011 2

Below is an overview of the backup and recovery capabilities for SAP HANA database: Capability Data Backup Log Backup Available YES More information: Backing Up the Data Area YES

More information: Backing Up the Log Area


Backup of Configuration Files Recovery to Status Before Failure NO More information: Backing Up the Configuration Files YES (If the log is not interrupted) More information: Recovering the SAP HANA Database YES More information: Recovering the SAP HANA Database YES More information: Recovering the SAP HANA Database

Point-in-Time Recovery

Recovery to a specific data backup (without using log information)

SAP HANA Guides


For more information about SAP HANA landscape, installation, deployment and security, see the resources listed in the following table:

Topic SAP HANA Landscape, Deployment & Installation SAP HANA Administration & Security

Guide/Tool SAP HANA Knowledge Center on SAP Service Marketplace SAP HANA Knowledge Center on SAP Help Portal

Quick Link
https://service.sap.com/hana SAP HANA Master Guide SAP HANA Installation Guide http://help.sap.com/hana SAP HANA Technical Operations Manual SAP HANA Security Guide

SAP HANA Database - Backup and Recovery Guide

October 2011 3

Points to Note
Data backup is only available in operational mode online. During data backup, the system is available as usual. During recovery, the database cannot be accessed by end-users and applications. The backup and recovery process cannot be used for system copies. Backup only supports files as backup media. Backup to pipes/tapes is not supported. Provide all data and log backups at the beginning of a recovery Once started, backup or recovery cannot be canceled If a recovery fails, the complete recovery must be repeated The configuration path for data and log backup must be defined system wide and not host-specific It is not possible to create a system copy using backup and recovery.

Prerequisites and Recommendations


To perform backups, the following requirements must be met: Backups and recoveries can only be executed by users who have the system privileges BACKUP_ADMIN and CATALOG_READ. BACKUP_ADMIN allows you to perform backups and recoveries. CATALOG_READ allows you to collect the information needed by the backup and recovery wizards. The backup process is executed as operating system user <sid>adm (on Linux). For replication scenarios during the initial data load - from ERP into the SAP HANA database log writing should not be switched off. Important There is no system table or log file that records the information that log writing has been switched off. For this reason, SAP does NOT recommend switching off the log during initial load. It is not possible to check when log writing has been switched OFF/ON on customer systems. After the initial load has finished successfully, a data backup is strongly recommended.

SAP HANA Database - Backup and Recovery Guide

October 2011 4

Avoiding LOG FULL (file system full) situations

When the log is backed up, the backed up log segments remain on disk until they have been released by log truncation after savepoint. After the log has been truncated, the oldest unused log segment can be overwritten with new log entries. If there are no unused log segments, new log segments are created. If the disk becomes full and no more log segments can be created, a log full situation arises. When the log is full, no more logging is possible until the log backup has completed. Autiomatic log backup prevent log full situations from arising. In addition to the database log files, SAP HANA logs changes to files it creates in the file system. These so-called diagnosis files record errors and changes in system behavior. Diagnosis files should not be deleted on operating system level.

Backing Up the SAP HANA Database


Periodic backup of data from the data area to external backup destinations can be performed using either an SQL command or via the SAP HANA studio. The database backup consists of the following: Backup of the data area This is done from persistent storage to external backup locations. Backup of the log area Logs are backed up automatically. You can configure how logs are backed up. Backup of the configuration files The configuration files (.ini files) need to be backed up manually. Note Data backups should be performed regularly to allow disaster recovery. In replication scenarios: After the initial load has successfully completed, a data backup is strongly recommended. It is recommended to perform a backup (data + configuration files) before the database software is upgraded to a new version. If the software upgrade fails, the database can then be recovered with no data loss. More information: Backing Up the Configuration Files During data backups, the system is available as usual.

SAP HANA Database - Backup and Recovery Guide

October 2011 5

Backing Up the Data Area


When the data area is backed up, all the data from the data area is backed up to backup files.
Location of the Backup Files

Unless you specify a new location, the backup files are written to the default location, which is specified by the parameter basepath_logbackup. It is not possible to specify a separate location for each backup. To ensure data security, it is recommended to specify a path to an external backup location. The backup location should never be in the same directory and on the same file system as the data or log areas or volumes. The folder must already exist before the backup process is started. In a distributed system with centralized data management, the backup directory will be created during backup if it does not already exist. You can configure your own path in the persistence section of the global.ini configuration file. The relevant parameters used to do this are basepath_logbackup and basepath_databackup.This is mandatory for log backups.
Backup ID for Data Backup

The system adds a unique ID to the backup file name. Because each file name is extended by this unique backup ID for each persistence, you only need to specify one file name for all the backups on the different hosts. The backup ID that is automatically added to a specified file name for the data backup is unique for each persistence only. This means, the next time you back up a specific persistence, the system will add the same backup ID to the backup file of that persistence. If you do not change the file name, the existing backup file of that persistence will be overwritten by the new backup. It is therefore recommended that you copy any backup to another location as soon as it is created. Another option is to specify a different file name when starting the next backup of a persistence.
Disk Space Check

There is no automatic check for free disk space before the backup is started. The Administrator has to ensure that sufficient free space for the backup files is available. This requires a calculation of how much free space will be needed in the backup directory. To estimate the size of a backup, the system table M_DATA_VOLUME_PAGE_STATISTICS can be used. This system table contains information about the used blocks.

SAP HANA Database - Backup and Recovery Guide

October 2011 6

To estimate the size of the next complete data backup, the Administrator can execute either of the following commands: select volume_id, sum(allocated_page_size) from M_CONVERTER_STATISTICS Group by volume_id This displays a list of the services (index server, name server, statistics server), with the size of each service in bytes. select sum(allocated_page_size) from M_CONVERTER_STATISTICS The result is a single value that gives the sum of the sizes of all services in bytes.

During the backup process, a backup file for each service will be created in the backup directory. The system automatically generates the names of the backup files.

Example Backup files created with SAP HANA studio: COMPLETE_DATA_BACKUP_databackup_3_1 COMPLETE_DATA_BACKUP_databackup_2_1 COMPLETE_DATA_BACKUP_databackup_1_1 COMPLETE_DATA_BACKUP_databackup_0_1 topology) (statistics server) (index server) (name server) (name server

After the data backup, no versioning of the backup files is created. This means that the next time you back up a particular persistence, the system assigns the same backup ID to the backup file of that persistence. Note As log backups are performed automatically, older data backups can be used for recovery as long as the log backups are available and still valid.

Backing Up the Log Area


The system can perform regular log backups to allow the reuse of log segments. During a log backup, log content is moved from the log area to log backup files. Log backup files need to be regularly backed up from the file system to an external destination. If the log area is not moved away often enough, you run the risk of the file system becoming full. Log backups are always performed in the following situations: When a log segment becomes full After a database restart

Optionally, you can also specify a time interval for log backups, using the parameter log_backup_timeout_s.

SAP HANA Database - Backup and Recovery Guide

October 2011 7

You can configure the log backup behavior using the following parameters in the global.ini configuration file: Parameter log_mode Settings This parameter can have the following values: log_mode =normal Normal mode (default). Log segments are automatically backed up. log_mode =overwrite Overwrite mode. Log segments are freed by savepoints and no log backup is performed. For example, this can be useful for test installations that do not require backup and recovery. Do not use this in production systems. log_mode =legacy Legacy SAP HANA 1.0 mode. Log segments are retained until a full data backup is performed. This is to allow recovery from the full backup + log in the log area. This was the default setting for HANA 1.0. No log backup is performed. You can release free log files explicitly using the SQL command ALTER SYSTEM RECLAIM LOG. log_mode = normal is recommended to provide improved support for backup and recovery. log_mode = legacy is still supported, but not recommended. log_mode = overwrite is not recommended for production systems.

NOTE After switching the log modeparameter from LEGACY to NORMAL, a system restart is required to activate the change.

SAP HANA Database - Backup and Recovery Guide

October 2011 8

enable_auto_log_backup Enables automatic log backup. Recommended: enable_auto_log_backup = yes If a log segment is ready to be backed up, servicespecific backup log files are created. For example, a log segment is ready to be backed up if it is full, or closed after exceeding the configured time threshold. Log backup files are created in the default location, which is specified by configuration parameter basepath_logbackup. NOTE: If automatic log backup is disabled, the log area will grow until file system is full. At that stage, the database will hang.

log_backup_timeout_s

Forces log backups at a fixed time interval specified in seconds. (0 = disabled) This parameter only takes effect if enable_auto_log_backup is set. Setting a time interval enables you to recover a SAP HANA database with minimum data loss in a situation where all the log segments are lost and only the data and log backups are available. It is therefore recommended that you set a time interval.

SAP HANA Database - Backup and Recovery Guide

October 2011 9

When log_mode = normal, the following parameters must have the following values: Parameter Runlevel Value = 3 for the following: enable_auto_log_backup = yes xsengine indexserver indexserver.c scriptserver statisticsserver

log_backup_timeout_s

> 0 (for example, 900s) A value of 900s ensures that in the event of a disaster, you will lose no more than 900s of data.

In SAP HANA studio, you can search for occurrences of each parameter. Go to the Configuration tab and use the Filter field. Note: When you switch to log_mode = normal, log backups are created on a continuous basis. This requires a steadily increasing amount of disk space that could lead to a full disk if not handled properly. For this reason, we recommend that you change the paths where log and data backups are located to a separate storage medium with sufficient disk space. In addition to avoiding space issues, using a separate storage medium also leads to improved safety in case of disk failures and better performance. After making the necessary configuration changes, you must restart the database. It is also recommended that you create a full data backup of the database. More information: Location of the Backup Files SAP Note 1645183

SAP HANA Database - Backup and Recovery Guide

October 2011 10

Backing Up the Configuration Files


The configuration files (.ini files) are important because they contain details of the configuration of the database. The .ini files are not currently backed up with the database, so they need to be backed up manually. Configuration files must be backed up separately for each host and should also be copied to an external backup destination. The .ini files to be backed up are located in the following directories: /usr/sap/<sid>/SYS/global/hdb/custom/config /usr/sap/<sid>/HDB<instance number>/<server name> It is the configuration files in these directories that you should periodically copy to an external backup destination. Sub directories, however, are not required for backup. In SAP HANA studio, the important files containing the relevant parameters can be found by selecting the Configuration tab. However, not all files visible in the studio are in the above directories. The files only appear in those directories if changes are made to the files after installation. If no changes have been made, then you do not need to back up the file. When you perform a backup, SAP HANA studio displays information about the configuraton files that need to be backed up. Remember that the installation will create a customer-specific sapprofile.ini and a nameserver.ini file. Both these files must be backed up even though they are not directly changed by the user. An example of a file created only when system-specific configuration changes have been made is global.ini. By contrast, an example of a file which always exists after installation is sapprofile.ini. This file contains the so called system landscape. You will not see sapprofile.ini under Configuration in SAP HANA studio, but it exists in the directory /usr/sap/<sid>/SYS/global/hdb/custom/config and needs to be copied as shown: cd /usr/sap/WR1/HDB01/ld8541 cp sapprofile.ini /<backupdir>/sapprofile.ini

Backup Catalog
The backup catalog is a file that records the following information: Backups and recoveries performed for a database The start and finish times are recorded, and whether the backup was successful or not.

SAP HANA Database - Backup and Recovery Guide

October 2011 11

Volumes that were backed up Log backups and which part of the log they contain Backup destinations Additional information

NOTE The backup catalog does not show the progress of a backup Information in the backup catalog is stored as XML, making it readable by users and software. Once entries have been recorded, they cannot be changed. The backup catalog is supported by SAP HANA studio and DBA Cockpit. When online, you can access the backup catalog using a Monitoring View/SQL View. The backup catalog is used to enable the system to do the following: To choose which data backup to use to recover the database To determine whether a recovery is possible at all

You can use the backup catalog to monitor the execution of backups.

SAP HANA Database - Backup and Recovery Guide

October 2011 12

Backup Catalog Monitoring Views

The following monitoring views are available for the backup catalog: Monitoring View M_BACKUP_CATALOG Description Provides an overview of information about backup and recovery activities. Each row in the view provides information for a separate backup catalog entry that is identified by a unique entry ID. This information includes the type (complete data backup, log backup and log missing, recovery), and start and completion times. To be able to use the M_BACKUP_CATALOG view, you need system privilege BACKUP_ADMIN or CATALOG_READ. User SYSTEM is also allowed to access the M_BACKUP_CATALOG view.

M_BACKUP_CATALOG_FILES

Provides information about the backup files created, and the backup destinations that are used by data and log backups. Each row in the view corresponds to a row in the M_BACKUP_CATALOG view. For entries about data or log backups, the view provides additional information about each database service that was involved in a backup. For example, with a data backup, each database service is listed with its specific backup information such as destination path and redo log position. To be able to use the M_BACKUP_CATALOG view, you need system privilege BACKUP_ADMIN or CATALOG_READ. User SYSTEM is also allowed to access the M_BACKUP_CATALOG_FILES view.

SAP HANA Database - Backup and Recovery Guide

October 2011 13

Performing a Database Backup


Performing a Database Backup Using SAP HANA Studio

To create a database backup, perform the following steps: 1. In the left pane, select the system for which you want to start a backup, then use right mouse click and choose Backup. 2. Specify the location (directory) and the backup file prefix (filename) to use. The default location always shows the path specified in global.ini. Note A backup performed with SAP HANA studio only saves the content of data volumes of the database. It does not execute a backup of the database configuration files. You need to manually back up the configuration (*.ini) files and the backup catalog file. A note on this screen reminds you of this. 3. You can now review the backup settings before actually starting the backup. If you see that any of the settings are not correct,you may use the Back button to change any of those settings before reviewing them again. This screen also displays a reminder about backing up the .ini files and the backup catalog. When all the settings are correct, choose Finish. The backup then starts. 4. The Backup Progress Information screen then shows the progress of the backup for all the services with persistence on all hosts (the statistics server, name server and index servers). 5. The backup is finished when the system confirms that all volumes have been backed up.

SAP HANA Database - Backup and Recovery Guide

October 2011 14

Performing a Database Backup Using SQL Commands

You can enter SQL commands either by using the SQL editor in SAP HANA studio, or by using the hdbsql program on the command line. The hdbsql program is located in /usr/sap/<SID>/HDB<instance number>/exe/ Note Backups using SQL commands are only recommended for batch mode (see section Using Batch Mode below). The backup can be started with the following SQL command: BACKUP DATA USING FILE (<backup_file_prefix>)

The backup creates the backup files in the default directory. The name of each backup file starts with <backup_file_prefix>. If you want to change the default a location, specify the full path, for example: BACKUP DATA USING FILE (/backupDir/data/monday/COMPLETE_DATA)

Performing a Database Backup Using Batch Mode

Currently, the main tool for batch mode backup is the command line interface hdbsql. This is the current recommended mode for executing backups from operating system level. hdbsql enables you to trigger backups via crontab. To get a list of all available commands, you should use: hdbsql -h Recommendation: Create a file that contains the connect information and backup statement. For security reasons, particular attention must be paid to the correct file permissions. In addition, the password must be saved in the hdbuserstore, and not in a file.

Caution Starting the backup command using hdbsql directly on operating system level is not recommended. This is because the password used for hdbsql connect will be visible in the process list! Therefore, a file must be used.

SAP HANA Database - Backup and Recovery Guide

October 2011 15

The file should contain the following information:


Connect information (for security reasons, do not use the p option outside the file) SQL statement for backup.

Create a file backup.sql with the following content:


\connect -n <server name> -i <instance number> -u <user> -p <password> // BACKUP DATA USING FILE ('Monday') //

Store this file with read rights for the crontab user. Execute the backup by calling the file backup.sql:

/usr/sap/<SID>/HDB<instance number>/exe/hdbsql -I backup.sql

A data backup is then created in the default location. In the above example, the prefix of all service-related backup files is Monday. Note that you need to specify full path of the command file.

SAP HANA Database - Backup and Recovery Guide

October 2011 16

Recovering the SAP HANA Database


The recovery process of the SAP HANA database causes the database to be shut down. During recovery, the system is therefore not accessible for end-users or applications. A recovery may be necessary in one of the following situations Disk crash of the data area Disk crash of the log area Reset system to certain point in time status Software upgrade failed

If only the data area was damaged and all data changes after the last complete data backup are still available in the log backups and log area, the data of committed transactions that was in memory at the time of failure can be recovered. When you restore the data backups and log backups, the system restores the data still available in the log area. Note If the log area is not damaged, and all the logs since the last data backup are available in the log area, the log replay is always part of the recovery process. After the data has been restored successfully, the log replay is automatically performed during the restart procedure.

If both the data area and the system configuration were damaged, the configuration files must first be copied into the system. The complete data backup can then be restored. The number of recovery steps depends on the recovery scenario and the reason for the recovery.

SAP HANA Database - Backup and Recovery Guide

October 2011 17

Log Replay
After the data has been reloaded into the databases data area, the database will replay the log from log backups and the log area. After this has been completed the database will be online. The REDO log information is located in the log backup and in the log area of the database. After the data area has been restored, the recovery process checks the log position specified in the data backup. To replay the log, the specified log position must be available either in the log backups or the log area. The log replay can only be done if the system can find the offset on the log. Note The duration of the restart until the system is online again depends on the amount of REDO log information during the log replay process.

Note If the backup being used for recovery is not the latest one, the Administrator must en sure that the offset needed for the backups is available in the log backups or the log area. If the required offset is not available, then the log replay cannot be executed. If during recovery the system cannot find the log offset in the log area, the administrator sees the error message: log and data must be compatible.

SAP HANA Database - Backup and Recovery Guide

October 2011 18

In this error situation you must use the CLEAR LOG option during the recovery process to get the system online again. (During the log replay phase, CLEAR LOG ignores any logs in the log area.) If the replay of the log area is not executed, the system also ends up in a consistent data state. The UNDO log information is stored in the data area and is reloaded into the area during recovery. Note: If the LOG replay did not take place, the replication server does not have a restart point anymore. If this happens, it is essential to refer to the replication server documentation for information on how to solve this problem.
Recovery of Data Backup Without Implicit Log Replay (CLEAR LOG)

If you perform a recovery without implicit log replay (using the CLEAR LOG option), the log area is formatted. Only the log backups are replayed, not the logs in the log area. In this situation, the .ini files can be recovered, but their recovery is not essential. If the .ini files are recovered, then any parameter changes made after the backup will be lost. When you use the CLEAR LOG option: All data changes made after the backup will be lost. This is because log entries have been cleared from the system, there is now no information available to do the REDO (log replay). All uncommitted transactions in the backup will be rolled back (UNDO).

Note Only use the CLEAR LOG option as an exception in a production environment when a log replay of the log area cannot take place.

The following are examples of situations, in which no log replay may be possible: The log area is corrupted and the log information is no longer available. For example, due to a disk failure, or the use of an older data backup. A log backup, which would link the latest available log backup to the log area, is missing. During a disaster recovery, the log available in the log backups and the log in the log area are not compatible.

SAP HANA Database - Backup and Recovery Guide

October 2011 19

The administrator may explicitly specify No recovery of log entries, as shown:

If No recovery of log entries (CLEAR LOG) is selected, a warning is displayed requiring confirmation of the CLEAR LOG option before the recovery process can start.

Recovering the Configuration Files


The configuration (.ini) files contain customer-specific configuration parameter changes (for example, nameserver.ini, indexserver.ini) and default parameter settings (sapprofile.ini). The .ini files that have configuration parameters are only created when system-specific configuration is done, thereby changing the default parameter settings. As part of the recovery process, all .ini files must be recovered. The .ini files to be recovered are located in the following directories: /usr/sap/<sid>/SYS/global/hdb/custom/config /usr/sap/<sid>/HDB<instance number>/<server name> An example of a .ini file containing customer-specific configuration parameter changes is nameserver.ini. nameserver.ini includes information about the server on which the master index server is located (<server name>:<indexserver port>). Landscape ID: Each system has a unique id called landscape ID. This landscape ID identifies the system. In SAP HANA, the landscape ID is stored in the nameserver.ini file. The landscape ID cannot be changed after the system has been installed. During a recovery, the landscape ID in the backup is checked against the landscape ID stored in nameserver.ini. If the landscape ID in the backup is different from the landscape ID in nameserver.ini, the recovery process will fail and the database cannot be restarted successfully.
Recovery After a Disk Failure for the Data Area

If the recovery is necessary as a result of corruption of the data area and the log area is not affected, then the system can be recovered to the time stamp when the system crashed. In this case, there is no loss of data, except for non-committed transactions.

SAP HANA Database - Backup and Recovery Guide

October 2011 20

In such an event, the .ini files must not be recovered. If the .ini files are recovered in this instance, any parameter changes made after the backup was created will be lost. It is also possible to recover the database using an older database backup and log backups. Noe that it may take some time to replay all the logs. All relevant log backups are needed for the recovery, as it is not possible to know which log backups contain the actual changes that need to be replayed. Note If you changed the path to the location of the backup files, you need to ensure that the correct path is specified for the recovery. More information: Location of the Backup Files

Recovery After Corruption of the Log Area

If the recovery is necessary as a result of corruption of the log area, for example following a disk failure, it will only be possible to replay the log backups. All the changes 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. The .ini files must not be recovered. If the ini files are recovered in this situation, any parameter changes made after the backup was created will be lost

SAP HANA Database - Backup and Recovery Guide

October 2011 21

Note: Sybase replication server The replication process via Sybase replication server does not work when data is lost during the recovery process for example, because of missing log replay. In this case, refer to the replication documentation for information on how to start the Sybase replication server after a recovery without log replay.

Performing a Recovery
After a system failure, the SAP HANA database can be recovered to a specific point in time.
Prerequisites

To perform a recovery, the following requirements must be met: The user must have the system privilege BACKUP_ADMIN. During installation, the SYSTEM user is created. It is recommended that this user not be used for normal database operation. Instead, dedicated administration users with restricted sets of system privileges should be created. Before a recovery can start, all the data and log backups must be available in the backup directories. There must be at least one data and the log backups that cover the timeline between the data backup to be used and the required point-in-time or log position for the recovery. Before the database recovery can be started, the configuration files must be restored manually. The recovery wizard provides instructions on how to restore the configuration files. To restore the database to its state just before a failure, a data backup before the point in time for recovery and all the log backups up to the point in time for recovery are needed. The log volume also needs to be corruption-free.

Constraints

Once it is running, a recovery cannot be canceled. If an error occurs during a recovery, the complete recovery must be repeated. It is not possible to create a system copy using backup and recovery.

Recovering the Database Using SAP HANA Studio

The recovery process can be started using SAP HANA studio. Remember that, during the recovery process, the database has to be stopped and is therefore not accessible for endusers or applications. When the system confirms that the database is stopped, the recovery process can start.

SAP HANA Database - Backup and Recovery Guide

October 2011 22

Procedure To recover a SAP HANA database, perform the following steps: 1. From SAP HANA studio, open the context menu over the database. 2. Choose Recovery... A dialog box is displayed. 3. Log on using your <sid>adm operating system user credentials. A dialog box is displayed, requesting that you confirm that the system can be shut down. 4. When you have verified that the database can be shut down for the recovery, confirm and choose Next. A dialog box is displayed. 5. Specify the recovery type. The following recovery types are available: Recovery Type To a specified point in time Description This recovery option uses the following data: The last data backup available before the specified point in time The entries from the log backups (and if needed the log entries from the log area) between the data backup and the specified point in time

To a specified log position

Note This recovery type is an advanced option that is needed in case a previous recovery failed. This recovery option uses the following data: The most recent data backup available before the specified log position The entries from the log backups between that data backup and the specified log position

SAP HANA Database - Backup and Recovery Guide

October 2011 23

Using a specific data backup

This recovery option uses the following data: The specified data backup

Note All log entries that still exist in the log are deleted. No log will be replayed.

6. Choose Next. 7. Specify the locations of the data backup and log files if they are not in the same location as when they were written. This information is recorded in the backup catalog. 8. Choose Next. A summary of the selected recovery options is displayed. 9. Ensure that you have specified the correct options for recovery. 10. If the settings are correct, choose Finish. The recovery is started. The progress of the recovery is displayed in the dialog box. 11. When the recovery is complete, the system is restarted automatically

If a Software Upgrade Fails

If an attempted software upgrade of the database fails and the upgrade problem can only be solved with a database recovery, then the .ini files must be recovered. In all other recovery situations, a restore of the .ini files is not necessary. During a software upgrade, it is possible that the .ini files may have changed. After the failure of a software upgrade procedure, the current .ini files may no longer match the backup. In such a case, the .ini files must be restored together with the data backup. Note A software downgrade to an older software version is not supported without doing a data restore with a backup created before the software upgrade started. If a software upgrade fails and you have to go back to the old software version with a corresponding data backup, you must deinstall the complete SAP HANA database using hdbuninst (which is located in the installation directory).

SAP HANA Database - Backup and Recovery Guide

October 2011 24

More information: SAP HANA database Installation - and Update Guide on SAP Service Marketplace https://service.sap.com/hana . Important note about hdbuninst. Administrators need to be aware that hdbuninst removes the software and SAP HANA database. hdbuninst removes data, .ini files, log files and anything else which belongs to the database installation. There is no possibility available to decouple the deletion of data or .ini files. There are five important steps relating to recovery in the event of failure of a software upgrade:
Step 1: Check

Check that you have a backup of the data and a backup of the .ini files and that these backups were done before the software upgrade was started.

Step 2: Software Deinstallation

Uninstall the software and the instance using hdbuninst .You can use the hdbuninst executable from the new software version you want to upgrade to. The deinstallation has to be executed directly on operating system level as user root. It must be executed on the server where the database is installed. The instances which are installed on your local server are listed. You have to choose the instance you want to uninstall.

Example The database WS1 has to be deleted: ./hdbuninst INSTALLED SAP IN-MEMORY INSTALLATIONS: 0: SAP In-Memory SAP In-Memory Appliance 1.00.03.296782 /usr/sap/hdbSAP In-Memory Appliance 1: SAP HANA database RIG /usr/sap/RIG NEWDB_ALONE HDB 00 version: 1.00.03.296782 hosts: lu252059a 2: SAP HANA database WS1 /usr/sap/WS1 NEWDB_ALONE HDB 01 version: 1.00.04.304431 hosts: lu252059a 3: None (Abort installation) Enter value <2> to delete database WS1.

SAP HANA Database - Backup and Recovery Guide

October 2011 25

Step 3: Installation of the Previous Software Version

Now the software for the previous version has to be installed. You will find the software installation process described in the Database installation guide.

Step 4: Recovery of the .ini files and data backup

After software installation, the default values are stored in the .ini files. Firstly, the saved .ini files have to be copied to the related directories so that all systemspecific modifications which have been made are in the .ini files. Then the data recovery can be executed as described in this document. Note You must format the log during the recovery process. Log replay must not be executed.

Step 5: Set up Replication Server

When the database is online again, you nee to check the replication server documentation for the relevant information on how to set up the replication process after this recovery.

You might also like