PT Sterling Tulus Cemerlang



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

500+ FREE Tips for you from Sterling Tulus Cemerlang (STEM) - SAP Indonesia Gold Partner, and Become SAP B1 Super User

HANA Housekeeping Using Python Script

SAP Business One Tips - STEM SAP Gold Partner Indonesia - Setup Automate Housekeeping on HANA Server with Phyton Script for SAP B1

The following tips will provides you a new knowledge about how to do an automated housekeeping job for your HANA server. These tips will be very useful for clean up your database logs, traces, alerts, internal events, etc.

Please follow these steps:

  1. Create Database Role and Database User to perform housekeeping
  2. Open terminal in Linux (or use Putty from Windows), and connect to HANA Linux Server using root. Execute commands below:
  3. Back to terminal, using root, change directory to / , and execute command below:
    Then, type in the following:Adjust the directory to your own HANA System directory for trace files, and save this file using command :wq!
  4. Create directory hanacleaner_history on directory /usr/sap and change its ownership into ndbadm:sapsys using command below:

    cd /usr/sap
    mkdir hanacleaner_history
    chown ndbadm:sapsys hanacleaner_history
  5. Download files from link : HERE 
    In those downloaded zip file, copy file to HANA Linux Server in directory:
    /usr/sap/NDB/HDB00/exe/python_supportChange ownership to ndbadm:sapsys
    Edit file, check parameters in lines 918, 921, and 964:Line 918 : zipBackupPath = cdalias(‘cdtrace’)Line 921 : dbuserkeys = [“HANACLEANER1KEY”] à Key stored in hdbuserstore in step 2 above.Line 964 : ignore_filesystems =  “”  –> Fill this “” using fullpath of filesystems that are 100% used (such as iso mounted filesystems)

    Save this file after you finished.

  6. Copy from downloaded file (step 5 above) to HANA Linux server in any directory, such as /home/Schedule_Script/ and change its ownership to ndbadm:sapsys , and change this file into executable file using command chmod 777

    Edit this file, and adjust its parameter to your own policy.
    To learn more about this parameter, please check file hanacleaner.pdf in downloaded file (step 5 above).
  7. Edit crontab for user ndbadm, in directory /etc using command crontab -u ndbadm -e
    Insert this line into crontab for example:
    0 6 * * * /home/Schedule_Script/
    This schedule will run using ndbadm as executor, every 6 AM in the morning, file will be executed.
    To execute manually, you must change user into ndbadm using command su ndbadm and execute using command ./, and it will write an output file in /usr/sap/hanacleaner_history/ directory each time it’s executed.

Also read:

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

This article was written by PT. Sterling Tulus Cemerlang, SAP Business One GOLD Partner in Indonesia.
More details about SAP Business One,
email to: or call +6221-5806336 or wa +6287786555055

, , ,