Clean /hana/log in secondary database

In this article we will explain how to clean /hana/log in secondary site. Remember that we can’t delete any files manually under /hana/log/ folder.

If this issue happen on the primary database, you should clean /hana/log/ using query “ALTER SYSTEM RECLAIM LOG“, but as you might be aware, you can’t connect to HDBSQL or run SQL command in secondary database.

The first thing that we are going to check is the number of free log segments with status FREE under /hana/log/SID/mnt*

sidadm@host:/hana/log/SID/mnt00001> hdblogdiag seglist /hana/log/SID/mnt00001/hdb00001 | grep -i Free | wc -l
sidadm@host:/hana/log/SID/mnt00001> hdblogdiag seglist /hana/log/SID/mnt00001/hdb00002.00003 | grep -i Free | wc -l

Let’s check which log volume has consumed higher disk space

sidadm@host:/hana/log/SID/mnt00001/hdb00001> du -sh /hana/log/SID/mnt00001/*
28G     /hana/log/SID/mnt00001/hdb00001
441G    /hana/log/SID/mnt00001/hdb00002.00003

As you can see, /hana/log/SID/mnt00001/hdb00002.00003 has consumed 441Gb. So let’s focus on this volume.

To identify which is the service used by this volume I am going to use the below command:

sidadm@host:/hana/log/SID/mnt00001/hdb00001> ps -ef | grep hdb
--port 30040 --volume 2 --volumesuffix mnt00001/hdb00002.00003 --identifier 1661300477

I can see it’s using port 30040 for mnt00001/hdb00002.00003.

30040 is the port used by the hdbindexserver (you can check with “HDB info” command or in HANA Studio).

If you see higher count in hdbindexserver volume, run the corresponding log release command: hdbcons ‘log release’

After executing the command, I checked again and we can see we only have 1 log segments with status FREE.

sidadm@host:/usr/sap/sid/HDB00> hdblogdiag seglist /hana/log/SID/mnt00001/hdb00002.00003 | grep -i Free | wc -l

Also, if you validate using command df -h, you will see the memory under /hana/log/ was free up.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: