Procedure documentationUsing the SQLDBC Trace Locate this document in the navigation structure

 

The SQLDBC trace logs SQL statements, communication packages, and method calls that the database receives and sends via the SAP MaxDB SQLDBC interface.

Use the command line program sqldbc_cons to configure and control the SQLDBC trace.

Caution Caution

Traces compromise performance. Use traces only for troubleshooting and problem analysis.

End of the caution.

sqldbc_cons is a component of the SAP MaxDB SQLDBC software.

Procedure

Enter the following command on the command line:

sqldbc_cons [<command>] [<option>]

SQLDBC Trace and ODBC Trace: Commands

<command>

Description

CONFIG TRACE FILENAME <trace_file_name>

Specifies the name <trace_file_name> of the trace file

If you enter %p in the name, it is replaced by the process ID of the application for which the trace is written.

PROFILE FILENAME <profile_file_name>

Specifies the name <profile_file_name> of the profile file

PROFILE [COLLECT ON | COLLECT OFF | RESET]

Activates or deactivates profiling (collecting statistical information) or resets all statistics counters

SHOW ALL

Displays the configuration of the traces and current information about the traces

SHOW CONFIG

Displays the configuration of the traces

SHOW PROFILE

Displays the collected statistical information in aggregated form

SHOW TRACESETTINGS

Displays current information about the traces

TRACE API ON | OFF

Applies only to the ODBC interface:

Activates or deactivates the API trace

The API trace is similar to the Microsoft Driver Manager trace, but logs more actions.

TRACE LONG ON | OFF

Activates/deactivates the detailed LONG trace

The LONG trace logs method calls with their call parameters.

TRACE OFF

Deactivates all SQLDBC traces

TRACE PACKET ON | OFF | <size>

Activates or deactivates the PACKET trace

The PACKET trace logs communication packages.

You use the <size> option to configure the size of the logged communication packages in bytes (default value: 1000 bytes).

TRACE SHORT ON | OFF

Activates or deactivates the SHORT trace

The SHORT trace logs method calls.

TRACE SIZE <size>

Defines the size <size> of the trace file (in bytes)

The system requires at least 8192 bytes for the trace file.

TRACE SQL ON | OFF

Activates or deactivates the SQL trace

The SQL trace logs SQL statements (the most simple trace is sufficient for most analyses).

TRACE STOP ON ERROR <error_number> | OFF [COUNT <number>]

Deactivates the trace after the error with error number <error_number> has occurred the number of times configured by the <number> option

TRACE TIMESTAMP ON | OFF

Activates or deactivates the time stamp for each logged action

SQLDBC Trace and ODBC Trace: Options

<option>

Description

Note that you can enter only one trace option at a time. They cannot be combined.

-f

Forces the execution of the command

-h

Displays help

-p <pid>

Executes the command only for the process with process ID <pid>.

-v

Displays detailed information (verbose)

Result

The SQLDBC trace writes its results in chronological order into the sqldbctrace-<pid>.prt trace file in the <independent_data_path>\wrk directory, with <pid> as the process ID. The trace file is overwritten cyclically.

If profiling has been activated, the SQLDBC trace writes aggregated statistical information to the sqldbcprofile-<pid>.prt profile file in the <independent_data_path>\wrk directory, with <pid> as the process ID.

More information: Glossary, Directory

Example

To activate the SQLDBC trace for SQL statements, enter the following command:

sqldbc_cons TRACE SQL ON

Operating system user anna uses the Linux database tool SQLCLI. She uses the SQLCLI database tool to log on to the DEMODB database instance as MONA and queries the data in the CUSTOMER table.

The SQLDBC trace writes the file /var/opt/sdb/data/wrk/sqldbctrace-19714.prt:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><PRE><PLAINTEXT>SQLDBC 7.6.0 BUILD 004-101-084-288 Nov 15 2004 23:56:34

--- THREAD 4D02 --- 2004-11-19 09:42:27.223840 ---

2004-11-19 09:42:27.224027 [0x8217CC8]

SERVERNODE: ''

SERVERDB: 'DEMODB'

USER : 'MONA'

CONNECT PROPERTIES: (1 entry)

KEY: 'SQLMODE' VALUE: 'INTERNAL'

CONNECT COMMAND: 'CONNECT "MONA" IDENTIFIED BY ? SQLMODE INTERNAL'

SESSION ID: 1

OK

::SET AUTOCOMMIT ON 2004-11-19 09:42:27.279370 [0x8217CC8]

::EXECUTE DBS 'SQLCURS_2' 2004-11-19 09:42:27.279581 [0x8219730]

SQL COMMAND: 'SELECT * FROM CUSTOMER'

RESULT COUNT: -1

CURSOR NAME: 'SQLCURS_2'

::GET RESULT SET [0x8219730]

CURSOR NAME: 'SQLCURS_2' [0x8219E08]

::FETCH NEXT 'SQLCURS_2' 2004-11-19 09:42:27.282629

[...]