SAP Basis Automation of HANA Backup and Cleanup

  

It's cool if you can perform SAP monitoring and SAP HANA monitoring without installing an army of agents, but that's not enough, we want to enhance SAP Basis Automation using Cross-platform automation capabilities.  Whether you want to automate system copy post-processing with our SID-Refresh tool, or manage backups, it's easy once you are monitoring SAP with IT-Conductor.  The IT operations automation possibilities for the Basis team are limitless once customers realize up to 90% savings in time and cost over traditional SAP monitoring solutions.

In this article, we'll demonstrate HANA backup integration as well as the cleanup of old backups.  These same principles and processes can be applied to other databases such as Oracle, SAP ASE, etc.

  1. Creating a backup of HANA databases (single or multi-tenant) utilizing the IT-Conductor advanced feature ‘SQL Jobs’ presented in  ‘Advanced SAP Monitoring Features by IT-Conductor’.
  2. Clean-up of catalog and files of older backups, using hdbsql and Linux’s crontab for scheduling. Note – future release of IT-Conductor will include ssh feature which allows scheduling of tasks within IT-Conductor, instead of using crontab.

Creating HANA backup within IT-Conductor

In each HANA database (SYSTEMDB, tenant DBs) defined within IT-Conductor, create an SQL backup job

IT-Conductor SAP Basis Automation HANA Backup Create SQL Job

Figure 1: Creating HANA Backup

SQL Backup Job (General Section)

IT-Conductor SAP Basis Automation HANA Backup Create SQL Job - General Section

Figure 2: SQL Backup Job (General Section)

SQL Backup Job (Activity Section)

IT-Conductor SAP Basis Automation HANA Backup Create SQL Job - Activity 1Figure 2a: SQL Backup Job (Activity Section)

IT-Conductor SAP Basis Automation HANA Backup Create SQL Job - Activity 2Figure 2b: SQL Backup Job (Activity Section)

SQL Backup Job (SQL Query Section)

IT-Conductor SAP Basis Automation HANA Backup Create SQL Job - SQL

Figure 3: SQL Backup Job (SQL Query Section)

Notification via Email on SQL Job Completion

Since a backup can run varying amounts of time depending on the size and capacity of the system, we recommend performing a backup in 'ASYNCHRONOUS' mode.  Thus the Email notification simply notifies that the backup has been submitted, and the remainder of the query continued.  The backup status would need to be checked separately later via a SQL report on the backup catalog.  In the example used here, we provide the information about the last few successful back-ups to show historical backup time/duration and size so you can estimate how long the current backup will run.  IT-Conductor can string together multiple activities into a single process, which can check on the status of the predecessor activity.  This was demonstrated in a prior blog post listed in the introduction.

IT-Conductor SAP Basis Automation HANA Backup Create SQL Job - Notification

Figure 4: Job Completion Status


Backup Cleanup

Maintaining a clean backup repository/catalog as well as the backup space is just common sense best practice for housekeeping.  This is easier said than done and many customers ignore managing this task until they get notices of issues like backup space, failed backups, or just slow backup due to large catalog and target backup directory.

The following SQL deletes backups from the backup catalog and from the file system.

BACKUP CATALOG DELETE [FOR <database_name>] { ALL BEFORE BACKUP_ID <backup_id> [WITH FILE | WITH BACKINT | COMPLETE] | BACKUP_ID <backup_id> [COMPLETE] }

To simplify and automate the process, a simple script was developed/used to:

  1. Generate the SQL command with the desired backup_id
  2. Execute the generated SQL command

Preliminary Steps

For each tenant database,

  1. Create backup user-id with backup and read-catalog privileges
  2. Store the backup user-id’s connection information using hdbuserstore

In this example, the system has three databases:

  • SYSTEMDB – the system DB
  • HDB – tenant DB
  • XYZ – tenant DB

IT-Conductor SAP Basis Automation HANA Backup - Cleanup

Figure 5: Backup User IDs

Backup Clean-up Script

A backup clean-up script is created for each DB, with the naming format ‘backup_cleanup_<dbname>.csh. Basically, it contains some validation and two general steps:

Generate the SQL backup catalog delete command:

IT-Conductor SAP Basis Automation HANA Backup - Cleanup Catalog

Figure 6: Backup Clean-up Script


The generated SQL statement in XYZ_ID will contain the following:


IT-Conductor SAP Basis Automation HANA Backup - Cleanup SQL

Figure 7: General SQL Statement

Execute the cleanup/deletion with the following:


IT-Conductor SAP Basis Automation HANA Backup - Cleanup CommandFigure 8: Cleanup/Deletion

Crontab for the Clean-up Tasks

Schedule the clean-up job using crontab.  For a better solution, we can use the IT-Conductor SSH job feature of OS monitoring to incorporate shell script automation.

IT-Conductor SAP Basis Automation HANA Backup - Scheduling

Figure 9: Crontab for the Clean-up Tasks


Summary

Of course, you can always pay for 3rd party SAP-certified backup solutions that integrate with databases like SAP HANA, such as Commvault, EMC, Veritas (Symantec), etc.  IT-Conductor can integrate with such systems via API if required, but keeping things simple by integrating built-in SAP HANA backup capabilities with a central monitoring and automation platform helps streamline IT operations.

SAP Basis Automation brings DevOps benefits to managing enterprise IT including:

  • Centralized repository of system administration scripts for the application and technology stack
  • Cross-platform automation
  • Batch schedule management
  • Monitored execution logs
  • Centralized operations reporting

Since IT-Conductor is a cloud-based service, you too can start automating many tasks (FREE for the first 2 SAP Systems connected, remember there is no complex software installation needed, so just subscribe and give it a try).  We would love your feedback also of tasks that you'd like to see automated, yes we'd love the challenge, so SAP Basis, Let's Automate IT!

Send us your wish list to blog@itconductor.com or comment below!

If you think our Automation is cool, try our cloud-based SAP Monitoring, FREE for the first 2 SAP SIDs.

 

Get Started with IT-Conductor