In the first video, we discuss the SQL trace facility for SAP HANA, its use cases, and how to enable it using SQL, SAP HANA studio, and the SAP HANA database explorer.
You can enable SQL Trace using the Trace Configuration tab of the SAP HANA studio, or using the Trace Configuration context menu in the SAP HANA database explorer. Both interfaces will generate the corresponding SQL statements.
For scripting purposes, you can also use the SQL statements directly.
To enable SQL trace for a tenant database, set the parameter for the indexserver process.
ALTER SYSTEM ALTER CONFIGURATION ('indexserver.ini','DATABASE') SET
('sqltrace','trace')='on'
WITH RECONFIGURE;
To enable SQL trace for a tenant database, set the parameter for the nameserver process.
ALTER SYSTEM ALTER CONFIGURATION ('nameserver.ini','SYSTEM') SET
('sqltrace','trace')='on'
WITH RECONFIGURE;
To disable SQL Trace, set trace=off or UNSET sqltrace. Unsetting the parameter, will return the value to its default, which in case of SQL trace is off.
ALTER SYSTEM ALTER CONFIGURATION ('indexserver.ini','DATABASE') SET
('sqltrace','trace')='off'
WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION ('indexserver.ini','DATABASE') UNSET
('sqltrace','trace')
WITH RECONFIGURE;
Below some more examples of the different configuration parameter settings availabe.
-- additional options
ALTER SYSTEM ALTER CONFIGURATION ('indexserver.ini','DATABASE') SET
('aqltrace','trace')='on',
('aqltrace','level')='all_with_results',
('aqltrace','tracefile')='trace/apple.py',
('aqltrace','user')='system',
('aqltrace','statement_type')='dml,ddl',
('aqltrace','application')='hdbstudio'
WITH RECONFIGURE;
- SQL Trace - SAP HANA Administration Guide
- 2031647 - How to enable SQL Trace in SAP HANA Studio
- 2119087 - How-To: Configuring SAP HANA Traces
In the next video, we provide an introduction to the SAP HANA SQL Trace Analyzer. Like most of the Python script files found in /usr/sap//HDB##/exe/python_support, this was originally a non-documented tool for internal usage only (SAP product support). However, because of its usefulness in quickly gathering some information out of the massive amount of trace data, we now find it documented in SAP Note 2412519.
To generate a trace report run the python command with the name of script and name of trace file. For other script options, see the usage information (run the script withouth trace file) or the mentioned SAP Note.
python sqlTraceAnalyzer.py sqltrace_host_30003_000.py