sap.sap_operations.hana_restore (1.25.0) — module

Restore SAP HANA database backup

| "added in version" 1.12.0 of sap.sap_operations"

Authors: Ondra Machacek (@machacekondra), Kirill Satarin (@kksat)

Install collection

Install with ansible-galaxy collection install sap.sap_operations:==1.25.0


Add to requirements.yml

  collections:
    - name: sap.sap_operations
      version: 1.25.0

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Fetch the binary path of the hdbsql
  sap.sap_operations.parameter_info:
    instance_number: "00"
    name: DIR_INSTANCE
  register: dir_instance
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
using:
    description:
    - Specify non-default catalog/data/log path.
    - Use if files are mounted on different path then when they were created.
    suboptions:
      catalog_path:
        description:
        - Catalog path.
        type: path
      data_path:
        description:
        - Data path.
        elements: path
        type: list
      log_path:
        description:
        - Log path.
        elements: path
        type: list
    type: dict

clear_log:
    default: false
    description:
    - 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 I(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 I(clear_log) in the following situation the log area is unusable or
      recovering the database to a different system.
    type: bool

full_backup:
    description:
    - 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 I(timestamp_backup).
    type: path

database_name:
    default: SYSTEMDB
    description:
    - SAP HANA system tenant or SYSTEMDB to restore. If not provided SYSTEMDB is default
      value.
    type: str

full_backup_type:
    choices:
    - FILE
    - BACKINT
    default: FILE
    description:
    - Path to full backup to use for restore.
    type: str

timestamp_backup:
    default: ''
    description:
    - 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 I(full_backup).
    type: str

instance_directory:
    default: ''
    description:
    - Path to instance directory.
    type: str

hdbsqluserstore_key:
    description:
    - hdbuserstore record to be used to connect to database.
    type: str

hana_db_system_password:
    description:
    - Password for HANA SYSTEM database user.
    type: str

See also