IBM Support

db2trc and Windows Terminal Services

Technote (FAQ)


If you run the db2trc command remotely in a Windows® Terminal Services environment, it may not capture the main DB2® UDB process ("db2syscs.exe"). The most visible symptom is that the Process ID of "db2syscs.exe" does not show up when formatting the trace dump using the db2trc flw command.


This is normal behaviour which can be seen if the db2trc command is not issued from a console session.

Problem Details
The problem can be recreated as follows:

Open a Terminal Client or Remote Desktop Connection session, connect remotely to a Windows server, and display the list of DB2 Universal Database™ (DB2 UDB) processes running on the server:

C:\>tasklist /FI "IMAGENAME eq db2*"

Image Name PID Session Name Session# Mem Usage
db2dasrrm.exe 1424 Console 0 11,160 K
db2syscs.exe 2216 Console 0 85,040 K
db2mh.exe 2140 Console 0 2,856 K
db2fmp64.exe 256 Console 0 30,280 K
db2fmp64.exe 3396 Console 0 17,720 K

The process you are looking for is "db2syscs.exe". This is the main DB2 engine process, and each DB2 instance defined and running on this machine has exactly one "db2syscs.exe" process.

The Process ID (PID) of "db2syscs.exe" is 2216 in this example. If there are multiple "db2syscs.exe" processes in the list, and it is not clear which one belongs to the current instance, the contents of the DB2_BDINFO registry variable can be examined. The first number in the output (2216) is the Process ID of the current instance:

C:\>db2set DB2_BDINFO
2216 270850032 2009801952

C:\>echo %DB2INSTANCE%

Now that you know that the instance is called "DB2" and its engine process ID is 2216, you can enable DB2 traces, perform some activity, stop the tracing and format the output:

C:\>db2trc on -f trace.dmp
Trace is turned on

C:\>db2trc off
Trace is turned off

C:\>db2trc flw trace.dmp trace.flw
Total number of trace records : 27
Trace truncated : NO
Trace wrapped : NO
Number of trace records formatted : 6 (pid: 2340 tid 1712 node: -1)
Number of trace records formatted : 21 (pid: 3892 tid 1060 node: -1)

Note that "pid: 2216" is not present in the "Number of trace records formatted" section, meaning that the trace failed to capture the main DB2 engine process.


If you cannot walk to the server, log in interactively and launch the DB2 trace from the physical console, you can open a console session remotely. However, the concept of a remote console session is not supported on Windows 2000 or earlier (Windows NT®) servers. You can take advantage of this functionality if the server is running the Windows XP or newer (Windows Server 2003) version of Windows Terminal Services.

If the server meets this requirement, then check if Remote Desktop Connection is installed on the client. By default it is installed on Windows XP or newer operating systems. However, the client will also work on Windows 95, Windows 98 and 98 Second Edition, Windows Me, Windows NT 4.0, or Windows 2000, in which cases you will need to download the software and install it manually:

Windows XP SP2 Remote Desktop Connection download

Once Remote Desktop Connection is set up, the "/console" command line argument may be utilized, which will cause the terminal client to always open a console session.

Find the Remote Desktop Connection shortcut used to initiate the remote connection, right-click on the shortcut, choose "Properties", and add the "/console" switch at the end of the "Target" field. For example, change



%SystemRoot%\System32\mstsc.exe /console

Now establish a remote connection with the server and verify the settings, for example by opening the command line and running the query session command, or by launching Task Manager and clicking on the "Users" tab. A console session's ID is usually 0, with the exception of Windows XP (server) where the ID may have a non-zero value:

C:\>query session
>rdp-tcp#21 myuser 0 Active rdpwd

Now repeat the DB2 trace test. Note that "pid: 2216" ("db2syscs.exe" from the previous example) starts to show up in the output of the db2trc flw command, meaning that the engine process has been captured successfully:

C:\>db2trc on -f trace.dmp
Trace is turned on

C:\>db2trc off
Trace is turned off

C:\>db2trc flw trace.dmp trace.flw
Total number of trace records : 35
Trace truncated : NO
Trace wrapped : NO
Number of trace records formatted : 6 (pid: 988 tid 3700 node: -1)
Number of trace records formatted : 8 (pid: 2216 tid 3204 node: 0)
Number of trace records formatted : 21 (pid: 2584 tid 3644 node: -1)

Document information

More support for: DB2 for Linux, UNIX and Windows
DB2 Tools - Troubleshooting

Software version: 7.2, 8.2, 9.1

Operating system(s): Windows

Reference #: 1226313

Modified date: 25 January 2006