PT Sterling Tulus Cemerlang
www.sterling-team.com

Whatsapp
+62-877-8655-5055

Email
sales-enquiry@sterling-team.com

Address
Sampoerna Strategic Square
South Tower Level 30
Jl Jend. Sudirman No. 45-46
Jakarta 12930 – Indonesia

500+ FREE Tips SAP Business One for you to Become SAP B1 Super User from Sterling Tulus Cemerlang (STEM)

How To Make Your Own Schema Backup Script in HANA

SAP Business One Tips How to make your own schema backup script in hana

In previous tips, you already know how to backup your own schema in HANA Studio in a manual way, using several clicks on the mouse, or write your own backup script in SQL Console, then you must compress a backup folder into .tar.gz compressed file using Linux command.

Now, you can simplify those step-by-step into only a one-step solution.

Please follow the steps below:

  1. Open puTTy, and login into your HANA system using root
  2. Go to /hana/shared/NDB/hdbclient/ directory
  3. Type command below to create environment variable key (you can type your own key name)
    ./hdbuserstore SET KEYNAME HOSTNAME: PORTNUMBER DBUSER DBPASSWORD
    Please see the sample below:

    SAP Business One Tips - How To Make Your Own Schema Backup Script in HANA

    SAP Business One Tips – How To Make Your Own Schema Backup Script in HANA

  4. Open Notepad++ (Don’t use windows standard notepad), create a new document, and copy the script below:
    #Begin Of Script
    #Parameter SCHEMA_NAME will be passed from shellscript argument and will be used as the directory name and compressed backup file name

    SCHEMA_NAME=$1

    #Parameter BACKUP_BASE_DIR is the backup root directory. You can change its value. This directory will be created automatically if necessary.

    BACKUP_BASE_DIR=/hana/backup/SCHEMA_BACKUP

    #Parameter BACKUP_FOLDER will be created using SCHEMA_NAME parameter and concatenated with the current timestamp, for example:

    SCHEMA_NAME_202012181330

    #You can change this parameter value at your own risk.

    BACKUP_FOLDER=${SCHEMA_NAME}_$(date +%Y%m%d%H%M)

    BACKUP_FOLDER=${SCHEMA_NAME}_$(date +%Y%m%d%H%M)

    BACKUP_FULL_PATH=${BACKUP_BASE_DIR}/${BACKUP_FOLDER}

    mkdir -p ${BACKUP_BASE_DIR}
    mkdir -p ${BACKUP_BASE_DIR}/${BACKUP_FOLDER}
    cd ${BACKUP_BASE_DIR}
    chown ndbadm:sapsys ${BACKUP_BASE_DIR}
    chown ndbadm:sapsys ${BACKUP_FULL_PATH}
    cd /hana/shared/NDB/HDB00/exe/
    ./hdbsql -U STEMBACKUP “EXPORT ${SCHEMA_NAME}.”*” AS BINARY INTO ‘${BACKUP_FULL_PATH}/’ WITH REPLACE THREADS 8″
    cd ${BACKUP_BASE_DIR}

    #After the backup is done, the system will compress it into .tar.gz file.

    tar -zcvf ${BACKUP_FOLDER}.tar.gz ${BACKUP_FOLDER}

    #Then the system will remove the current backup directory

    rm -rf ${BACKUP_FOLDER}

    #End Of Script

  5. Please change “STEMBACKUP” to your own environment variable key. You can also change the Threads number if necessary.
  6. Change Notepad++ EOL conversion into Unix (LF)

    SAP Business One Tips - How To Make Your Own Schema Backup Script in HANA

    SAP Business One Tips – How To Make Your Own Schema Backup Script in HANA

  7. Save document as Unix script file (.sh)

    SAP Business One Tips - How To Make Your Own Schema Backup Script in HANA

    SAP Business One Tips – How To Make Your Own Schema Backup Script in HANA

  8. Copy this file into your HANA System using WinSCP (you can put it anywhere).
  9. In puTTy, go to directory where this script file located as root user, and type command below:
    chmod 777 YOUR_SCRIPT_FILE.sh

    Sample:

    chmod 777 backupsample.sh
  10. Now you can use this script using command below:
    /YOUR_SCRIPT_FILE.sh SCHEMA_NAME (This script accepts only one schema name as argument)

    Sample:

    /backupsample.sh DB_TRAINING

    SAP Business One Tips - How To Make Your Own Schema Backup Script in HANA

    SAP Business One Tips – How To Make Your Own Schema Backup Script in HANA

Now you can easily backup schema in just one step

SAP Business One Tips - How To Make Your Own Schema Backup Script in HANA

SAP Business One Tips – How To Make Your Own Schema Backup Script in HANA

These tips will work on any HANA Version (1.0 or 2.0) and any revision.

Also read:

Run Your Business With The Piece of Mind Using SAP Business One

This article was written by PT. Sterling Tulus Cemerlang
More details about SAP Business One,
email to: sales-enquiry@sterling-team.com or call +6221-5806336 or wa +6287786555055

, , , , , , , ,