println

my day-to-day experiences with software

Kernel trace and SQL trace in MaxDB 7.7

Posted by rajg on September 10, 2008

How to collect kernel and SQL traces on MaxDB 7.7

Recently while tracking down a weird behavior in my application, SQL traces and MaxDB kernel traces were very useful. This issue is described in my other post here. So I thought I would share my experience with others those that would fall in similar trap.

When you execute any SQL from with a java program your java program acts as a client to the database. In case of MaxDB JDBC driver the SQL traces can be collected at the client side (i.e on your java application side) and the kernel traces on server (i.e. the database side).

SQL Traces

In order to switch on SQL trace for MaxDB JDBC driver you need to locate sapdbc.jar that your java application will use to execute SQL queries on MAxDB database. Launch GUI application with

java -jar sapdbc.jar

or

double click on sapdbc.jar which will also launch GUI application since it is an executable jar. Make sure that java is in your path.

Similar to:

sql trace

sql trace

Then check “Tracing enabled” checkbox, select the trace file folder and hit OK. This would switch on SQL traces on the client side. You may want to switch on kernel trace (explained below) before running your application. After you run your application that executes a SQL it would generate jdbctrace.prt in the speified location, in above example it is d:\temp. jdbctrace.prt is a text file which can be viewed by any text editor. Make sure that you run this configuration GUI with the same user that will execute your java program.

Kernel traces

To switch on kernel traces first locate the MaxDB database installation directory. Open a shell/console and then go to <maxdb-installation-home>\programs\pgm and execute

dbmcli -u <admin-user> -d <database-name>

Then on dbmcli console execute

Util_execute diagnose vtrace clear

Util_execute diagnose vtrace default on

->run your program

Trace_flush

Util_execute diagnose vtrace default off

Trace_prot msakbe

Then the trace would be written to MaxDBs rundirectory ...\wrk\<database-name>\<database-name>.prt

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.