sap.sap_operations.hana_restore module – Restore SAP HANA database backup

Note

This module is part of the sap.sap_operations collection.

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install sap.sap_operations.

To use it in a playbook, specify: sap.sap_operations.hana_restore.

New in sap.sap_operations 1.12.0

Synopsis

  • Restores HANA system or tenant DB backup. Currently it is possible to perform timestamp restore or restore to specific full backup.

Parameters

Parameter

Comments

clear_log

boolean

Prevent entries from the log area from being used for the recovery.

No log entries from the log area are replayed, and the log area is initialized.

As a consequence, the content of the log area is lost.

For timestamp_backup prevents the recovery of entries from the log area. No log entries from the log area are replayed, and the log area is initialized. As a consequence, the content of the log area is lost.

You must set clear_log in the following situation the log area is unusable or recovering the database to a different system.

Choices:

  • false ← (default)

  • true

database_name

string

SAP HANA system tenant or SYSTEMDB to restore. If not provided SYSTEMDB is default value.

Default: "SYSTEMDB"

full_backup

path

Path to full backup to use for restore.

It ends with prefix used to create full backup (full backup consists of multiple files).

It can be absolute or relative path.

Mutually exclusive with timestamp_backup.

full_backup_type

string

Path to full backup to use for restore.

Choices:

  • "FILE" ← (default)

  • "BACKINT"

hana_db_system_password

string

Password for HANA SYSTEM database user.

hdbsqluserstore_key

string

hdbuserstore record to be used to connect to database.

instance_directory

string

Path to instance directory.

Default: ""

timestamp_backup

string

Recovers an SAP HANA database to a specific point in time.

Timestamp is always in UTC timezone.

Example 2022-01-02 11:22:33.

Empty string means now.

Mutually exclusive with full_backup.

Default: ""

using

dictionary

Specify non-default catalog/data/log path.

Use if files are mounted on different path then when they were created.

catalog_path

path

Catalog path.

data_path

list / elements=path

Data path.

log_path

list / elements=path

Log path.

Notes

Note

  • This module is community supported

  • Module interface (parameters, output) expected to be stable but not guaranteed

  • Module planned to be released on Ansible Automation Hub after collecting some feedback

  • There is no guarantee that this module will be officially supported by Red Hat

See Also

See also

sap.sap_operations.hana_restore

Restore SAP HANA database backup.

Examples

---
- name: Fetch the binary path of the hdbsql
  sap.sap_operations.parameter_info:
    instance_number: "00"
    name: DIR_INSTANCE
  register: dir_instance

- name: Restore HANA SYSTEMDB to latest state
  sap.sap_operations.hana_restore:
    hana_db_system_password: CHANGEME
    database_name: SYSTEMDB
    instance_directory: "{{ dir_instance.parameter_value | first }}"
  become: true
  become_user: rheadm

- name: Restore HANA for RHE tenant to specific timestamp
  sap.sap_operations.hana_restore:
    instance_directory: "{{ dir_instance.parameter_value | first }}"
    hana_db_system_password: CHANGEME
    instance_number: "00"
    timestamp_backup: '2022-01-17 23:59:59'
  become: true
  become_user: rheadm

- name: Restore HANA for RHE tenant to specific full backup
  sap.sap_operations.hana_restore:
    hana_db_system_password: CHANGEME
    full_backup: MONDAY
  become: true
  become_user: rheadm

- name: Restore HANA for TENANT2@RHE tenant from PR1@PR1 tenant to specific full backup
  sap.sap_operations.hana_restore:
    hana_db_system_password: CHANGEME
    database_name: TENANT2
    full_backup: '/hana/PR1/backup/MONDAY'
  become: true
  become_user: rheadm

- name: Restore HANA for TENANT2@RHE tenant from PR1@PR1 tenant to specific timestamp
  sap.sap_operations.hana_restore:
    hana_db_system_password: CHANGEME
    database_name: TENANT2
    clear_log: true
    timestamp_backup: '2022-01-17 23:59:59'
    using:
      catalog_path: /hana/PR1/backup/catalog
      data_path: [/hana/PR1/backup/data]
      log_path: [/hana/PR1/backup/log]
  become: true
  become_user: rheadm

Authors

  • Ondra Machacek (@machacekondra)

  • Kirill Satarin (@kksat)