Phone
+62-877-8655-5055
+62 (21) 580-6055

Email
sales-enquiry@sterling-team.com

Address
Sampoerna Strategic Square
South Tower 18th
Jl Jend. Sudirman kav 45-46
Jakarta 12930 - Indonesia

HANA Housekeeping Using Python Script

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 dan 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 : https://www12.zippyshare.com/v/WdVH0qnI/file.htmlIn those downloaded zip file, copy hanacleaner.py file to HANA Linux Server in directory:
    /usr/sap/NDB/HDB00/exe/python_supportChange hanacleaner.py ownership to ndbadm:sapsysEdit hanacleaner.py 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 hanacleaner.sh 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 hanacleaner.sh

    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/hanacleaner.shThis schedule will run using ndbadm as executor, every 6 AM in the morning, file hanacleaner.sh will be executed.To execute hanacleaner.sh manually, you must change user into ndbadm using command su ndbadm and execute hanacleaner.sh using command ./hanacleaner.sh, and it will write an output file in /usr/sap/hanacleaner_history/ directory each time it’s executed.

, ,