Hana -Cleanup of Logs/Traces

  

  • Cleanup of backup catalog entries
  • Cleanup of trace files
  • Cleanup of SAP HANA alerts
  • Cleanup of Dumps

How to check the size of backup catalog?

1. Use below sql 

SELECT T3.DESTINATION_PATH CATALOG_FILE_NAME,
    T3.DESTINATION_TYPE_NAME FILE_TYPE,
    TO_CHAR(TO_DECIMAL(T3.CATALOG_SIZE_MB,10,2))||' MB' CATALOG_SIZE,
    TO_CHAR(T4.OLDEST_BACKUP_DATE,'YYYY/MM/DD HH24:MI:SS') OLDEST_BACKUP_DATE,
    LPAD(T4.OLDEST_BACKUP_DAYS,18) BACKUP_RETENTION_DAYS,
    TO_CHAR(CURRENT_TIMESTAMP,'YYYY/MM/DD HH24:MI:SS') ANALYSIS_TIME       
 FROM  (SELECT TOP 1 T2.DESTINATION_PATH, 
  T2.DESTINATION_TYPE_NAME,
  T2.BACKUP_SIZE / 1024 / 1024  CATALOG_SIZE_MB
     FROM  M_BACKUP_CATALOG T1,
   M_BACKUP_CATALOG_FILES T2
     WHERE T1.BACKUP_ID = T2.BACKUP_ID
     AND T2.SOURCE_TYPE_NAME = 'catalog' AND T1.STATE_NAME = 'successful'
     ORDER BY T1.SYS_START_TIME DESC ) T3,
    (SELECT MIN(SYS_START_TIME) OLDEST_BACKUP_DATE,
    DAYS_BETWEEN(MIN(SYS_START_TIME), CURRENT_TIMESTAMP) OLDEST_BACKUP_DAYS
     FROM   M_BACKUP_CATALOG
     ) T4

  Output:

2. Use " catalogsize " from imported sql statements.

      


Trace and logs location -> /usr/sap/SID/HDB00/hostname/trace/DB_SID

-> This location contains :

  • trace files of executed, expensive, load and unload statement traces etc..
  • Alerts (zip) compressed files
  • Dumps (rte..ooo dumps, crash dumps....)
From OS location we can see trace, alert and dump files...
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB_SID

$sidadm@hostname:/usr/sap/SID/ HDB00/hostname/trace/DB_SID> ls indexserver_alert*.gz | wc -1
121   -->Alerts (compressed) zip files
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB_SID> ls expensive statements*.trc | wc -1
10
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB_SID 1s 30003.loads*.trc | wc -1 
10
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB SID> 19 unloads.trc | wc -1
51 
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB_SID> 19 *oom.tre | wc -1
11  --> Dumps
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB_SID> 19 executed statements.trc | wc -1
10
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB_SID> ls indexserver_alert_hostname.trc | wc -1
1
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB_SID> 19* | wc -1
201   -->Total files in trace folder (DB_SID)
$sidadm@hostname:/usr/sap/SID/HDB00/hostname/trace/DB_SID> pwd
/usr/sap/SID/HDB00/hostname/trace/DB_SID


Types of files mostly required cleanup?

  1. Trcae files
  2. Alerts
  3. Dumps (runtimedumps, crashdumps, oom dumps )

1.How to configure HANA log/trace file rotation/cleanup?

A: Trace file (.trc) rotation using parameters maxfiles (number of files, typically 10) and maxfilesize (size of each file, typically 10 MB). When all files are written, the first one will be removed and a new, empty one is created.



2.The parameter global.ini -> [trace] -> maxalertfilesize defines the maximum size of alert files (default: 50 MB). When the configured size is reached, the file is compressed (including a timestamp in its name) and a new file is written from scratch.


Note : Alert files and dumps are not part of the trace file rotation/cleanup configured via parameter maxfiles.

  • Alert files are zipped after reaching the size configured in maxalertfilesize.
  • Dumps (runtimedumps, crashdumps, oom dumps) are not part of any trace rotation.

 

3.Below parameters will help in cleaning up the alerts and rtedumps,crash dumps.


                                                             
                                                             (OR)


How to delete old SAP HANA trace/log files manually also if required?
If you wish to delete the log/trace files then you can execute following command at OS level: 

cdtrace --> /usr/sap/SID/HDB00/hostname/trace

cmd:
find -type f -mtime +60 -exec rm -rf {} \;   //this will delete files older then 60 days.

                                                      
                                                         (OR)

How to automate cleanup using Hana cleaner ?

https://elrincondeosalla.blogspot.com/2018/06/how-to-configuring-automatic-sap-hana.html

Comments

Popular Posts

Interview Questions

EHP Upgrade (SUM)

SAP Logon Configuration(Load Balancing)

SAP Startup Troubleshooting

HANA Installation & upgrade

SAP HANA Backup

SAP Transport Management System (STMS)

SAP Kernel Upgrade in Distributed System

Set Up SAP HANA System Replication with hdbnsutil

SAP Client Copy