Describing Additional Backup Topics

Objective

After completing this lesson, you will be able to describe advanced backup topics

The Backup Log

This lesson explains how the backup catalog provides information about the backups you have performed.

Business Example

You have to define a backup strategy for your SAP HANA database. Therefore, you have to define a strategy to back up the configuration files of your database. After you have defined a strategy for the data area and the log area backup, you need information about the execution of backups and their history.

The backup.log and backint.log files record all important backup and recovery information in human readable form. This information can be used to diagnose backup or recovery errors.

The backup.log file records information about the data and log backups, progress, and recovery.

The backint.log file contains information about the activities of the BACKINT agent. The BACKINT agent is part of a third-party backup tool.

The backup.log and backint.log files can be truncated automatically. This prevents their size from increasing excessively. Therefore, trace file rotation can be enabled.

Backup Catalog

The backup catalog provides information about the execution of backups and their history. It enables the system to do the following:

  • Determine whether a recovery is possible

  • Choose which data and log backup to use to recover the database

  • Determine which backup files are no longer needed for a recovery

Information in the Backup Catalog

The backup catalog contains information on the following:

  • Backups created for a database

  • The start and completion times of the backups

  • Whether a backup is still running

  • Status of a backup (successful or not)

  • Volumes that were backed up

  • Log backups and what part of the log they contain

  • Backup destinations and their sizes

  • The destination type

  • The backup ID

  • An external backup ID when using a third-party backup tool

  • Encryption root key (If encryption is enabled)

  • Additional user comment

Backup Catalog in the SAP HANA Cockpit

The backup catalog displays a list of past backups. This list allows you to see the status of each catalog entry, as well as its key information, at a glance. To see the full details of a particular entry, select it from the list. More information appears in the Backup Details area. This includes, for example, backup start and completion times, duration, size, throughput time, and a breakdown for each service.

By default, only full data backups are displayed. To see delta backups, select the Differential Data Backup or the Incremental Data Backup checkboxes.

Backing Up the Backup Catalog

The backup catalog is backed up and versioned after every completed backup operation. This allows the backup catalog to be accessed during a recovery. Even when log_mode = overwrite is set, where logs are not created, the backup catalog is still backed up.

If the backup catalog is backed up using a third-party tool, the versioning of the backup catalog is handled by the backup tool.

SAP HANA writes one backup of the backup catalog for concurrent log backups of different services. This means that the backup of the backup catalog covers all log backups that were written since the previous backup of the backup catalog. This action is enabled by default. To disable it, choose global.inibackup, and set the enable_accumulated_catalog_backup database configuration parameter to False.

The backup catalog is written as a separate backup. By default, the backup catalog is backed up to the same destination as the log backups.

Caution

If you change the default destination for the log backups, the backup catalog is not automatically backed up to the same location.

The parameters to configure the destination of the backup catalog are shown in the figure, Backing Up the Backup Catalog.

Note

In exceptional situations that are outside of the control of SAP HANA, the backup catalog may not be available at the time of a recovery. If the backup catalog is not available, it can be largely rebuilt using the existing data and log backups from the file system.

To rebuild the backup catalog, use the hdbbackupdiag tool.

For more information, see SAP Note 1812057 (Reconstruction of the backup catalog using hdbbackupdiag).

Monitoring Views of the Backup Catalog

You can access the backup catalog using monitoring views. Monitoring views are located in the SYS schema.

The monitoring views M_BACKUP_CATALOG, M_BACKUP_CATALOG_FILES, and M_BACKUP_PROGRESS provide different overviews of information from the backup catalog.

  • M_BACKUP_PROGRESS provides detailed information about the most recent data backup.

  • M_BACKUP_CATALOG_FILES provides information about the backups created, and the backup destinations for data and log backups.

  • M_BACKUP_PROGRESS provides information about currently running and last finished backups only. It is cleared at database restart.

M_BACKUP_PROGRESS provides detailed information about the most recent data backup.

Backup Lifecycle Management

It is recommended to regularly check whether old full backups or backup generations can be deleted. To keep your backup storage space at an optimum level, delete backups that are no longer needed for a recovery regularly.

To free backup storage, you can physically delete data backups and log backups, and delete their associated entries in the backup catalog. To reduce the size of the backup catalog, delete the records of individual data backups from the backup catalog. However, retain the physical backups, for example, to comply with legal requirements for data retention.

Backup lifecycle management provides a framework to delete old data and log backups from the backup catalog only, or from the backup catalog and physically from the backup location. You can delete backups from the file system or from a connected third-party backup server via the BACKINT interface. This allows you to manage your backup storage space or to fulfill regulatory deletion requirements.

Note

If data snapshots are deleted from the backup catalog, they are not deleted physically. Data snapshots that are no longer needed must be deleted manually.

SAP HANA does not physically delete a data snapshot. To physically delete a data snapshot, you must delete it manually in the repository where it is stored.

Delete Full Backups

You can display an overview of full backups (and delta backups), and also delete individual full data backups.

You can delete the backup catalog records of individual full backups, but retain the associated physical backups. Optionally, you can delete the records in the backup catalog and also the associated physical backups.

You can also delete old backups using the following SQL commands:

  • BACKUP CATALOG DELETE BACKUP_ID <backup_id> [COMPLETE]
  • BACKUP CATALOG DELETE ALL BEFORE BACKUP_ID <backup_id> [WITH FILE] | [WITH BACKINT] | [COMPLETE]

Delete Backup Generations

You can display an overview of backup generations, and delete backup generations that are no longer needed for a recovery.

A backup generation comprises one successfully created full backup (complete data backup or data snapshot) and the following backups created after the full backup and up to the start time of the next successful full backup:

  • Delta backups (differential or incremental backups)
  • Log backups
  • Backups of the backup catalog

You can delete the backup catalog records of backup generations, but retain the associated physical backups. Optionally, you can delete the records from the backup catalog and also the associated physical backups.

Backup Retention Policy

Using the backup configuration settings you can enable a retention policy for the backups to delete old backup generations automatically. You have to enable the retention policy scheduler and to specify whether to have SAP HANA automatically delete backup generations in accordance with the criteria you define.

Retention policy settings:

  • Retain Backup Generations Younger Than

    Specify a number of days. Backup generations will be retained for that number of days.

    By default, backup generations are retained for 3 days.

  • Minimum no. of Retained Backup Generations

    You can keep a minimum of between 1 and 14 backup generations.

    By default, 2 backup generations are retained.

Backup of Configuration Files

Customer-specific configuration settings (*.ini files) are not backed up automatically as part of a full backup. The configuration settings are not essential to perform a database recovery. If you want to back up configuration files that contain customer-specific changes, you can do so manually.

In a recovery situation, a backup of the configuration settings can be helpful to more easily identify and restore customer-specific changes to the default settings. If you want to use customer-specific configuration settings after a recovery, you need to reconfigure the recovered system using SAP HANA cockpit.

The properties of an SAP HANA system are defined in the parameters of its configuration files.

Configuration files are only created in these directories if customer-specific changes are made to them after installation. If no customer-specific changes have been made, these directories are empty.

The nameserver.ini file contains global information for each installation. The landscape section contains the system-specific landscape ID and assignments of hosts to the COORDINATOR, WORKER, and STANDBY roles. If the system landscape changes, for example, hosts are added or removed, the landscape section of the nameserver.ini file also changes.

Caution

The sapprofile.ini file contains information that is specific to each host. For this reason, in a recovery situation, do not copy the sapprofile.ini file manually to a different host, because it will not be compatible with a new landscape.

Backint for SAP HANA

By default, SAP HANA is configured to back up to disk using the basepath_databackup and basepath_logbackup parameters. Data and log backups can be created directly in a remote storage location that is made available in the network by using a network file system, such as the Network File System (NFS). SAP doesn't recommend a specific network file system protocol, SAP only excludes several network file systems that showed problems during usage. This list can be found in SAP Note 1820529 - Unsuitable network file systems for backup and recovery.

When using third-party backup tools, you need to configure the BACKINT Software Development Kit (SDK) for SAP HANA interface. The SAP Certified Solutions Directory provides a list of certified backup solutions that support BACKINT SDK for SAP HANA. The backup tools communicate directly with the SAP HANA database through the BACKINT SDK for the SAP HANA interface.

An SAP HANA version and CPU architecture-related list is provided in SAP Note 2031547 - Overview of SAP-certified third-party backup tools and associated support process. The SAP Online Documentation also provides information on "Working with Third-Party Backup Tools".

Note

An SAP certification is required for BACKINT SDK for SAP HANA implementations by third-party vendors.

Destinations for Backups

BACKINT SDK for SAP HANA is an application programming interface (API) that can be implemented by a third-party backup agent. It has the following features:

  • It provides functions for backup, recovery, query, and delete.

  • The third-party backup agent runs on the SAP HANA server and communicates with the third-party backup server.

  • Backups are transferred through pipes.

  • It has full integration with SAP HANA cockpit (configuration and execution of backups to BACKINT).

  • It can be configured for data backups and for log backups.

The default configuration is defined when a third-party backup tool is installed. After a backup tool has been installed, you can back up and recover the SAP HANA database without making any further changes.

Multi-Streaming Data Backups with Third-Party Backup Tools

When creating a data backup, third-party backup tools can use multiple channels to write the backup data for each service in parallel.

By default, SAP HANA uses one channel for data backups. If required, you can configure SAP HANA to use additional channels. When multiple channels are used, SAP HANA distributes the data equally across the available channels. All the parts of a multi-streamed backup are approximately the same size.

Change the Number of Channels for Multi-Streaming

If parallel streams have been configured, the individual service backups are distributed across all available streams. Note that the different services always use dedicated backup streams. Backups are only distributed if they are larger than 128 GB. Both full and delta backups are supported.

A maximum of 32 parallel streams can be configured. Use the parameter parallel_data_backup_backint_channels in the section backup of the global,ini file.

During recovery, the number of streams used is the same as during backup. This is independent of the current setting of the parameter.

Note

To create multi-streamed data backups, configure the third-party backup tool to use multiple channels with good performance.

For more information about the configuration of the backup tool, consult the vendor documentation.

Checking of Backups

The success of a database recovery can only be ensured if the required backups are available and have not been changed since they were created. For this reason, manually check backups periodically, or if you suspect that they have been changed in some way since they were created.

When SAP HANA data or log backups are created, the integrity of the data to be backed up is automatically checked while the backups are being written. The data is written to the backup destination only if the integrity check is successful.

When a recovery is started, the integrity of the backups to be used is checked automatically. If an error is detected, the recovery is stopped, and must be repeated.

In addition to the automatic backup checks performed by SAP HANA, you can manually check data backups and log backups without performing a recovery. You can check if all the backups needed for a recovery are available and can be accessed, and if backups have changed or moved since they were first written.

Tools to Perform Manual Backup Checks

Perform manual backup checks using the following tools:

  • hdbrecovercheck.py - Verifies that a database can be recovered to a specific point in time.
  • hdbbackupcheck - Checks whether individual data backups and log backups have changed since they were created.

  • hdbbackupdiag - Determines which data backups and log backups are required to complete a recovery. It also checks if these backups are available and if they can be accessed.

Note

Use hdbbackupcheck periodically to check the consistency of the metadata of a backup.

hdbrecovercheck.py and hdbbackupdiag can be used before the start of a recovery.

To maintain good recovery performance, and to allow the check to be completed quickly, hdbbackupdiag only checks the metadata of a backup. It does not check the integrity of the backup content on the block level.

In some situations, although a backup appears to be consistent and its metadata correct, it might have internal errors. In such cases, use hdbbackupcheck to check for corruption in individual data or log backups.

Verify That a Recovery to a Point in Time Is Possible

Before you start a recovery, you can use the Python script hdbrecovercheck.py to verify that a database can be recovered to a specific point in time.

You can avoid your recovery failing due to missing backups or backup inconsistencies by using hdbrecovercheck.py before starting to recover.

Checking Individual Backups

Use the hdbbackupcheck tool to check the integrity of individual data backups and log backups manually.

A data backup of an SAP HANA instance consists of multiple parts, each with the same prefix. A part of a backup is a backup file in the system storage or a backup object that has been transferred to an external backup tool. To check a data backup, start hdbbackupcheck for each individual part of the data backup.

The hdbbackupcheck tool notifies you if any errors were detected in the checked part of the backup. The notifications are as follows:

  • 0: if no errors were detected

  • 1: if an error was detected

Checking the Backups Required for a Recovery

The hdbbackupdiag tool determines which backups are required to complete a recovery in a specified point in time. It also checks if these backups are available and if they can be accessed.

With hdbbackupdiag, you can verify:

  • For file-based backups:

    • The backup is available in the file system, either at the location to which it was written or at a location specified by a search path.

    • The current operating system user has read authorization for the file.

    • The actual size of the backup file is the same as the size recorded in the backup file header.

    • The backup ID is identical to the backup ID specified in the backup catalog.

  • For backups created using a third-party tool:

    The backup is available in the third-party tool.

Note

Ensure that hdbbackupdiag can locate the backup catalog. To do this, you can either execute hdbbackupdiag in the directory where the backup catalog is located (file-based only) or execute hdbbackupdiag with options that specify which directories to search for the latest backup catalog.

Performing Backups with Scripts

In addition to performing backup and recovery operations using the SAP HANA cockpit, you can also use SQL statements. The syntax for these statements is described in the SAP HANA Administration Guide.

You can use these SQL statements to define scripts that trigger a database backup with SAP HANA backup functionality. For an example of such a backup script, see SAP Note 1651055.

Example of Database-Specific Parameters

Example of Database-Specific Parameters

NameDefaultDescription
SID *- - -SYSTEM ID of the SAP HANA database system
INSTANCE *- - -Instance number of the SAP HANA database system
HOSTNAME *- - -Hostname (the local host name of the database server. Do not use "localhost". Do not use the fully qualified (<hostname>.<domain>) name.
SIDPATH **/usr/sap/${SID}The directory into which the binaries of the SAP HANA database system are installed
INSTPATH **${SIDPATH}/HDB${INSTANCE}The directory containing the instance data of the SAP HANA database

Note

(*) means that the parameter must be adjusted to your particular installation; (**) means that the parameter refers to a default setting of the SAP HANA database that is unlikely to be changed in any database installation.

Specify parameters as follows:

  • <name>=<value>

  • No space on either side of the "=" operator

  • The name of the parameters must not be changed

  • Case sensitive

  • Use ${<name>} for parameters that reference other parameters

Command Line Options

Command Line Options

The backup script offers the following command line options:

NameDescription
-hDisplay usage information and exit (regardless of any other command line parameters given).
-tTest mode: Do not create or delete backup files, that is, do not create data backup, and do not create configuration file backup. Writes log messages into file ${SCRIPT_LOG}.
-qSuppress wait time and information output (recommended in batch mode).
-dOnly create a data backup. Do not back up configuration files.
-cOnly back up configuration files. Do not run a database backup.
-pAdd script parameterization and command line switches to the script log file.
--suffix=<value>Create backup files that do not contain the weekday as part of the name, but <value> instead. Note: There must not be any white space on either side of the "=" sign.

Log in to track your progress & complete quizzes