Precompiler trace
This page explains how the precompiler trace can be configured.
What is the precompiler trace?
Where are the trace files located?
Activating the precompiler trace
Deactivating the precompiler trace
Example for a precompiler trace
Additional options for IRTRACE
What is the precompiler trace?
The precompiler is an interface between the SAP system and the database. A trace of this interface contains the SQL statements sent by the application to the database, their parameters and results.
Where are the trace files located?
When the trace is activated, *.pct files are written in the work directory of the SAP system.
Activating the precompiler trace
SAP Basis Release <= 4.6D resp. precompiler versions < 7.2.04:
The precompiler trace is activated when parameter dbs/ada/sql_trace is set in the instance profile of the SAP system (file <SID>DVEBMGS<system number><server name> in directory /usr/sap/<SID>/SYS/profile/).
You have the following options to set the parameter:
- dbs/ada/sql_trace = 2
detailed trace; the PCT files might become very large, but the trace information won't be overwritten. - dbs/ada/sql_trace = <X>
<X>: number > 2: alternating trace; X statements are logged in a PCT file, then the trace file is overwritten. There is no risk that the file system runs full because of the trace (if you don't choose a very large <X>) but the required information might be overwritten until the trace is switched off. - dbs/ada/sql_trace = 1
short trace - not used.
You can change the instance profile as follows:
- transaction RZ04 -> Instances/Profiles, select the instance profile -> Profile -> extended maintenance -> Change Profile
- on operating system level use a text editor to change file \usr\sap\<SID>\SYS\profile\<SID>DVEBMGS<system number><servername>
In this case the changes are rolled back when you use transaction RZ04 the next time you change the profile.
After the parameter has been set, the SAP system (at least the application server for which the trace should be activated) needs to be restarted. If the trace should be activated for the DEFAULT connection (e.g. for an OLTP system) it is even sufficient to restart only the corresponding work process. For other connections (e.g. a liveCache connection) restarting the corresponding work processes is not sufficient.
SAP Basis >= 6.10 resp. precompiler versions >= 7.2.04
As in the older releases the precompiler can be activated by changing the instance profile parameter. However, now it is also possible to activate the trace without restarting the system/the application server. Therefore you use tool IRTRACE.
IRTRACE changes the trace behaviour of the precompiler runtime using a shared memory segment. The precompiler runtime checks regularly if the entries in the shared memory segment have been changed and adapts its trace behaviour accordingly.
Because of the usage of a shared memory segment a synchronisation file is needed. This file is used by the processes to access the shared memory segment. This file is called irtrace.shm and it is located in directory <independent_data_path>/wrk. IRTRACE as well as the precompiler runtime need read and write access for this file.
To change the trace settings for a specific process use:
irtrace -p <process-id> -t <trace_type>
To change the trace settings for all processes which use the precompiler use:
irtrace -p all -t <trace_type>
The following trace types are possible:
- long: long trace,
- short: short trace - not used.
All precompiler versions
Using the environment variable SQLOPT the precompiler trace can be activated for the currently used shell (UNIX/LINUX) resp. the currently used command prompt window (Windows).
This is useful if you need to analyze e.g. why R3trans cannot connect to the database instance.
Attention: SQLOPT should only be set temporarily. Otherwise it might cause problems, if more than one database instance is installed on the server.
Set SQLOPT to '-X -F <file_name>.pct' to activate the precompiler trace.
If you set the variable to '-X -F PID' the process ID is part of the trace file name.
Deactivating the precompiler trace
SAP Basis Release <= 4.6D resp. precompiler versions < 7.2.04
To deactivate the trace you need to delete the parameter dbs/ada/sql_trace from the instance profile.
You can change the instance profile as follows:
- transaction RZ04 -> Instances/Profiles, select the instance profile -> Profile -> extended maintenance -> Change Profile
- on operating system level use a text editor to change file \usr\sap\<SID>\SYS\profile\<SID>DVEBMGS<system number><servername>
In this case the changes are rolled back when you use transaction RZ04 the next time you change the profile.
After changing the instance profile the SAP system/the application server/the work process needs to be restarted again.
SAP Basis >= 6.10 resp. precompiler versions >= 7.2.04
To deactivate the precompiler trace for all processes use:
irtrace -p all -t off
All precompiler versions
If you activated the precompiler trace using environment variable SQLOPT, you can deactivate the trace by resetting this variable.
Example for a precompiler trace
PRODUCT : liveCache C/C++ Precompiler Runtime VERSION : 7.1.4 BUILD : 032-000-055-840 version :P_1, P_2 SQL STATEMENT : FROM MODULE : dbslada AT LINE : 4186 OUTPUT : LZU : NT/INTEL 7.1.4 Build 032-000-055-840 OUTPUT : PCR : C-PreComp 7.1.4 Build 032-000-055-840 START : DATE : 2001-07-13 TIME : 0013:01:01 END : DATE : 2001-07-13 TIME : 0013:01:01 SESSION : 1; SQLMODE : SAPR3 AT DATABASE : DB_000 SERVERDB : S10 SERVERNODE: OPTION-CONNECT : CONNECT "SAPR3 " IDENTIFIED BY :A SQLMODE SAPR3 ISOLATION LEVEL 0 TIMEOUT 0 SQL STATEMENT : FROM MODULE : dbslada AT LINE : 6390 START : DATE : 2001-07-13 TIME : 0013:01:01 END : DATE : 2001-07-13 TIME : 0013:01:01
Additional options for IRTRACE
The following options of IRTRACE might be useful:
- Display the current trace settings of a specific process:
irtrace -p <process_id> - Display the current trace settings for all processes:
irtrace -p all - In case IRTRACE cannot find the shared memory file you can specify the path of this file with option -f <path>.
- Display the shared memory content for support issues:
irtrace -s