Recently I came across the situation where the HANA Data Volume Used Size is Doubled or Much Larger than Before and even HANA reclaim could not free up data volume used size.
This was for non-production HANA system where we had recently done the system refresh from production system which has HA (HIGH Availability) Setup. Usually this problem happens post system refresh as replication snapshots from production gets copied.
Below are the symptoms for this issue.
- Data volume used size is doubled or much larger than before
- Huge Difference between Backup size and /hana/data disk size
- There are old snapshots shown in result of “select * from m_snapshots” query in HANA tenant
- There is no large tabled imported or index created
- “ALTER SYSTEM RECLAIM DATAVOLUME” could not reclaim data volume used size
Steps to identify the snapshots which can be deleted in HANA.
1. Run sql query “select * from m_snapshots” in HANA tenant of affected system. Check for FOR_BACKUP column, if value is FALSE and snapshot is old then it is eligible to get deleted from system to achieve free space in data disk.
3. In Above Screenshot, Notedown the PORT Value, Which will help you to identify the service related to it. As per screenshot 1, the snapshots exists for PORTS 30003,30011, 30007,30040. To identify HANA service related to it navigate to Landscape -> Services Tab in HANA Studio.
4. In case only a single service with the name exists, you can use “-e” to identify it, otherwise you need to use “-p”:
hdbcons -e hdb<service_name> 'snapshot l' hdbcons -p <os_pid> 'snapshot l'
e.g hdbcons -e hdbindexserver ‘snapshot l’ or hdbcons -p 31655 ‘snapshot l’
Note: Refer Screenshot 2 Process ID Column to get <os_pid>
hdbcons -e hdbindexserver ‘snapshot l’ command will give the snapshot ID. kindly make a note of it and cross check the same with ID column in screenshot 1.
5. To check the size cosumed by snapshot use below command.
hdbcons -e hdb<service_name> 'snapshot a <snapshot_id>' hdbcons -p <os_pid> 'snapshot a <snapshot_id>'
e.g hdbcons -e hdbindexserver ‘snapshot a 423984’ or hdbcons -p 31655 ‘snapshot a 423984’
6. If you have confirmed that the database snapshot is no longer required, the snapshot ID can be dropped with the following hdbcons command:
hdbcons -e hdb<service_name> 'snapshot d <snapshot_id>' hdbcons -p <os_pid> 'snapshot d <snapshot_id>'
e.g hdbcons -e hdbindexserver ‘snapshot d 423984’ or hdbcons -p 31655 ‘snapshot d 423984’
7. Run sql query “select * from m_snapshots” which will result blank screen this means all snapshots has been deleted in the system.
8. Now you can check the Fragmentation status using SQL: “HANA_DISK_OVERVIEW” (SAP Note 1969700). If FRAG_PCT ( Fragmentation % ) is more than 20% then we are good to run the reclaim in HANA. using sql “ALTER SYSTEM RECLAIM DATAVOLUME 120 DEFRAGMENT;”.
9. By this method you will be successfully able to achieve good amount of disk space in hana/data which was unnecessarily consumed by old replication snapshots.