How well are you maintaining your database ?

As a database administrator its your job to maintain the database, ensure its cleaned up on periodic basis, but what tools can you use to do this, are u still listing them on your mind ..

Have you heard of Hanacleaner ?

Hanacleaner is a python script database administrator its your job to maintain the database, it can be used to do the following activities.

  1. Cleanup of backup log entries.
  2. Cleanup of backups
  3. Cleanup of trace files
  4. Cleanup of audit logs
  5. Cleanup of Free log segments
  6. Cleanup of Data file fragmentation
  7. Cleanup of HANA Cleaner logs
  8. Optimze Compression of tables not compressed
  9. Optimize compression of tables with columns not compressed
  10. Cleanup of multiple row store containers
  11. Optimize compression of tables with large UDIV overhead
  12. Cleanup of object lock history for '(unknown)' objects

Where Can I download this ?

Download it right here

Setup Steps Overview

  1. Create a SAP HANA user (for example, DBCLEANER, but you can use a different name) and assign the CATALOG READ privilege.
  2. Create a user key (for example, SYSTEMKEY, but you can use a different name) in the hdbuserstore.
  3. Download the hanacleaner.py script from above link.
  4. Store the script in, for example, the python_support directory.
  5. As < sid>adm, change to the python_support directory with the command cdpy

Some Commands

a. "python hanacleaner.py -be 20" - Clean up backup catalog entries hat don't be long to the ten newest backups

b."python hanacleaner.py -be 10 -bd 30 -td true" - Clean up backup catalog entries and backups that are older than 30 days and that don't be long to the ten newest backups

c."python hanacleaner.py -tc 42 -tf 42 -ar 42 -bd 42 -zb 50 -eh 2 -eu 42" - Clean up statistics server alerts, traces and backup catalog entries older than 42 days, rename and compress backup.log and backint.log when size exceeds 50 MB, handle / acknowledge events after 2 / 42 days

d."python hanacleaner.py" - No execution of Action

e. "python hanacleaner.py -help" - Help

Lets look it in Action

Hanacleaner needs to connect to database, when you run without providing the key, it will throw error as below

Create the key as below

Command : hdbuserstore SET SYSTEMKEY <hostname>:<sqlport> <user> <password>

List the Key

Command : hdbuserstore LIST

command : python hanacleaner.py -help - The above command list all arguments


Want to Practice this Live ?

Click here to enrol in our HANA Admin course with Live exercises

Try our Simulation Exercise for Free

Click here for a free simulation (Please use chrome / Firefox)

Join our Linkedin Group for Tech and Job update