File system maintenance and backup strategies is a core task for having a healthy SAP Business One version for SAP HANA landscape. Operationally, this can be regarded as the most important task, as your enterprise data is your asset and always needs to be available and secured. The following article will take you through the nuances of components and internal workings of backups and file system management to ensure that you have the best practices embedded within your landscape.
Why is Backup Required?
Atomicity, consistency, isolation, and durability (ACID) is a set of requirements that should be fulfilled by any database system.
The first three requirements are not affected by the in-memory concept. The fourth requirement durability cannot be met by storing data in main memory alone.
The SAP HANA database stores the bulk of its data in memory for maximum performance. But main memory is volatile storage, so it loses content when there is no electrical power. To make data persistent, it has to reside on non-volatile storage, such as hard drives, SSD, or Flash devices. SAP HANA database also uses persistent storage (disk memory) to provide a fallback in case of power failure.
How does Backup and Recovery Work in SAP HANA?
In SAP HANA database systems RAM is divided into pages. When a database transaction changes the data, the corresponding pages are marked and written into persistent storage at regular intervals.
SAP HANA database also generates a log entry in persistent storage for every committed transaction to ensure the durability of all transactions.
Below illustrates how SAP HANA stores changed pages in savepoints, which are asynchronously written to disk storage in regular intervals (by default every 5 minutes). The log is written synchronously. That is, a transaction does not return before the corresponding log entry has been written to persistent storage, in order to meet the durability requirement, as described above.
A Few Important Concepts:
1. What is Database Backup and Recovery?
Backup and Recovery is the process of copying/storing data for the specific purpose of restoring. Backing up files can protect against accidental loss of user data, database corruption, hardware failures, and even natural disasters.
Please note SAP HANA instance backup ensures data consistency while schema export does not. Please check SAP note 2121486 for more details :
2. Data and Log Volumes
In SAP HANA the volumes belong to the HANA services such as indexserver, statisticsserver or xsengine. There are 2 types of volumes: Data and Log. Each of these volumes comprises of files at the OS level and generally there are many more log segment files than data files.
The log volume contains all changes on the data volume since the last completed savepoint.
Each log volume contains the file logsegment_<partition_ID>_directory.dat and one or more log segment files (logsegment_<partition_ID>_<segment_number>.dat).
• Contain the current payload of the data volumes (data and undo information)
• Manual (SAP HANA studio, SQL commands), or scheduled
• Contain the content of closed log segments; the backup catalog is also written as a log backup
• Automatic (asynchronous) whenever a log segment is full or the timeout for log backup has elapsed
Data and Log Backup Management
For effective housekeeping of data and log backups to maintain efficient disk management on HANA server there should be a defined backup policy in place. Data and log backups should be moved to an external drive / removed as per backup policy.
This can be done manually by a system administrator or by creating a Linux shell script to control backup execution. A sample script and instructions are available in SAP Note 1651055.
Please note: the script is only intended to demonstrate how backup control could be implemented. The responsibility of implementing a backup solution lies with the implementation team.
Important: As of Remote Support Platform for SAP Business One 3.1 patch level 07, you can setup backup scheduling for SAP Business One HANA databases. Please check SAP Note 2157386 - SAP HANA backup scheduling in RSP for more details .
Best Practices for avoiding Log Volume Full situations on SAP Business One HANA server
A high number of log segments can be generated when, for example, the automatic log backup is down or the log savepoint is blocked for an extended time. During this period the file system accumulates the full log segments. These log segments use a lot of disk space so after the automatic log backup has been fixed we need to free the disk space.
Never delete log segment files because they form a chain and are all still allocated by the database, in such scenarios we must remember “Never delete log volume files, reclaim them.”
You can follow instructions from SAP Note 1679938 if log volumes are consuming a high amount of disk space (sometimes disk full).