The forum will be down for scheduled maintenance on Saturday, March 4 beginning at 10am EST. Actual downtime is unknown but may be several hours.

How can I log all commands the clients are sending to database server?

I wanna to "see" those commands to know how entity framework 4.0 is generating sqls and maybe try to change ling expressions.

asked 10 Mar '10, 12:34

Zote's gravatar image

accept rate: 43%

edited 22 Jan '13, 03:43

Volker%20Barth's gravatar image

Volker Barth


Have you tried dbsrv11 -zr SQL -zo RLL.log already (and possibly the other -zr options)?

(10 Mar '10, 12:53) Volker Barth

@Volker: If anything qualifies as an actual "answer" as opposed to a comment, your comment does... I think :)

(10 Mar '10, 15:50) Breck Carter

@Breck: Who would dare to argue with the Administrator:) - The main reason for just commenting is my quite small own experience with RL. But you're right, this site should not suffer from too shy users.

(10 Mar '10, 16:20) Volker Barth

I use these Commands to enable request level logging as needed.

-- Set Destination relative to db server !!!
call sa_server_option('Request_level_log_file', 'C:\temp\mylog.txt');

-- Log everything
call sa_server_option('Request_level_logging', 'ALL');
-- Log only SQL 
call sa_server_option('Request_level_logging', 'SQL');

For more Options see sa-server-option-system-sysproc

-- Add a Comment to the log file
call sa_audit_string('Ahead of Procedure call');

-- Stop logging
call sa_server_option('Request_level_logging', 'NONE');

With these commands you can switch on the logging from a iSQL Session before you press a Button in your Application. This make it possible to log only the interesting SQL code.

permanent link

answered 10 Mar '10, 20:10

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
accept rate: 16%

While request logging will log the statements, the Application Profiling feature within Sybase Central permits both the logging of all statements PLUS their graphical plans. As Application Profiling results are stored in a database, you can then mine the logging data using whatever specific criteria you desire (for example, listing only those statements that refer to a specific table, or only those statements that took longer than a certain elapsed time).

permanent link

answered 10 Mar '10, 17:06

Glenn%20Paulley's gravatar image

Glenn Paulley
accept rate: 43%

I never can to use this option. I can create perf db and start/stop capture, but I don't know how to analyse data. :(

(10 Mar '10, 20:20) Zote

@Glenn: I feel Zote's pain... there is a certain [cough] barrier to entry when it comes to getting the most out of Application Profiling... LogExpensiveQueries was easier even though it required a great deal of manual effort. It's a GUI thing, as in Graphic Usability Issues.

(10 Mar '10, 20:27) Breck Carter

@Glenn: Breck's comment says what I think too. A few SQL statements loaded from a script file, and off you go. I tried to use Application Profiling with a 9 GB database: creating the log database took hours. And finding the right way to get to analyzing the result was a real pain.

(11 Mar '10, 10:26) Reimer Pods

I guess "Request logging" will do what you request.

I would try

dbsrv11 -zr SQL -zo RLL.log

(and possibly the other -zr options as well).

permanent link

answered 10 Mar '10, 16:18

Volker%20Barth's gravatar image

Volker Barth
accept rate: 32%

You can switch on SQL logging capability locally in client side (see ODBC connection properties, advanced tab). In that case you don't need to have any administrative access to db server, and can intercept and analyse sql generated only by your application.

permanent link

answered 22 Jan '13, 06:45

AlexeyK77's gravatar image

accept rate: 8% long as the client is using ODBC (whereas in Zote's original case, I guess it's a native ADO.Net connection and therefore not using ODBC at all)...

(22 Jan '13, 07:26) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 10 Mar '10, 12:34

question was seen: 1,995 times

last updated: 22 Jan '13, 07:26