Skip to content

Sample code for the SQL Trace and SQL Trace Analyzer tutorial videos with links to the documentation

Notifications You must be signed in to change notification settings

saphanaacademy/sqltrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

SAP HANA Academy

SQL Trace

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.

Trace Configuration

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.

Trace Configuration

-- 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; 

Tutorial Video

SAP Trace

Documentation

SAP HANA SQL Trace Analyzer

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

Tutorial Video

SQL Trace Analyzer

Documentation

About

Sample code for the SQL Trace and SQL Trace Analyzer tutorial videos with links to the documentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published