Administrator Guide : Basic Troubleshooting and Tracing : How to Debug with the Tracing Facility : SET [NO]TRACE Statement—Trace Individual Gateway Sessions
 
Share this page                  
SET [NO]TRACE Statement—Trace Individual Gateway Sessions
To trace individual gateway sessions requires the client application to use the SET [NO]TRACE statement.
This statement has the following format:
SET [NO]TRACE [POINT] [{id [,id..]|ALL}] [LOCAL|REMOTE|BOTH|'full_path_name']
id
Starts the trace with specific trace options. Each id specifies a unique trace option. See Trace Identifiers for a list of valid trace ids, and Tracing Methods for trace id syntax options. Three additional trace ids can be specified using SET TRACE:
FT
Full tracing is enabled (timestamps and process ids are included with every trace).
ST
Full tracing is disabled (timestamps and process ids are not included with every trace).
CO
User comments are added to the trace output file.
See "Set Trace Examples" for examples of these additional trace ids.
ALL
Starts the trace and performs all possible tracing.
LOCAL
Sends the trace data to the current trace output file.
REMOTE
Returns the trace data to the client application.
BOTH
Logs traces locally and remotely.
full_path_name
Specifies the full path name of the file containing the trace output.
Trace Output File
The location specifier, 'full_path_name' of the SQL SET TRACE command sets the default trace output file for the remainder of the session. If a trace output file is specified, a valid path and filename must be included. See Set Trace Examples for trace file location examples.
If no output file is specified, the gateway writes the trace data to a default file based on server class as shown in the following table:
Server Class
Gateway Trace File Name
mssql
gwmssql.log
oracle
gworacle.log
db2udb
gwdb2udb.log
SET TRACE Examples
The following examples explore various ways to specify trace options and trace output files using the SQL SET TRACE command.
set trace all remote
Traces all SQL; tracing data is sent to the client application (the output is displayed on the screen if using SQL Terminal Monitor).
set trace ERWR local
set trace ER+WR local
set trace +ER+WR local
set trace -ALL+ER+WR local
set trace ALL-DA-EV-EX-HO-IB-ME-OB-RS-TR local
Each of these statements traces only error data (ER) and warning messages (WR); tracing data is sent to the default trace output file on the Server machine where the gateway resides.
set trace ALL-ER-WR 'C:\\EA\\ingres\\files\\gateway_trace.log'
Traces all SQL except error data (ER) and warning messages (WR); tracing data is sent to the file C:\EA\ingres\files\gateway_trace.log on the Windows Server machine where the gateway resides.
set trace all '/tmp/gateway_trace.txt'
Traces all SQL; tracing data is sent to the file /tmp/gateway_trace.txt on the Unix Server machine where the gateway resides.
set trace on ft remote\p\g
Traces all SQL with full tracing enabled (timestamps and process ids are included with every trace). Tracing data is sent to the client application (the output is displayed on the screen if using SQL Terminal Monitor).
set trace on st remote\p\g
Traces all SQL with full tracing disabled (timestamps and process ids are not included with every trace). Tracing data is sent to the client application (the output is displayed on the screen if using SQL Terminal Monitor).
set trace er local \p\g
set trace co 'This trace is for error messages only' \p\g
Traces error data (ER) only; tracing data is sent to the default trace output file on the Server machine where the gateway resides. User comment, "This trace is for error data only" is added to the trace output file.
Note:  Tracing affects only the gateway process the client is connected to, not all gateway sessions.
Disable Tracing
There are three ways to disable tracing:
Specifiy set notrace using trace points
Example:
set notrace
Specify set notrace with the ALL parameter
Example:
set notrace all
Specify set trace with the OFF trace identifier
set trace off
All three methods can be used to disable the tracing options specified in the SET TRACE Examples section.