Solved

SQL Server (6.5) - Logging all queries executed

Posted on 2004-08-20
6
412 Views
Last Modified: 2012-08-14
This one is simple, how can I log all the queries executed in SQL Server 6.5?

If there is no way, is there any way to log queries executed through an ODBC connection? I have was using Ethereal, but I wasn't able to make sense of the captured data.

Discofish
0
Comment
Question by:Discofish
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:solution46
ID: 11858032
Discofish,

not sure if it there in 6.5, but have you tried SQL Profiler (definately available in 7 and 2000).

It slows things down a bit, but then I imagine any system of tracking all commands run against SQL Server will to some extent. I haven;t ried using it for large-scale logging, but it is exceptionally good for seeing exactly what SQL Server gets when somebody tries to run a query on it.

If it is available, it should be in Start \ Programs \ Microsoft SQL Server \ Profiler, or you could try looking for profiler.exe in your SQL Server installation folders.

s46.
0
 
LVL 2

Author Comment

by:Discofish
ID: 11865685
I have SQL 6.5, so it doesn't come with that tool.  I didn't see it available for download online anywhere.  Really, all I need to do is capture all queries for a short period of time. So a packet sniffer would be fine, if I could get one that would work.  Some of the monitoring tools I've set up broke other things so they were quickly removed.

Discofish
0
 
LVL 9

Expert Comment

by:solution46
ID: 11865806
bit of a long shot - the application that talks to SQL Server wouldn't happen to use a purpose built connection object (i.e. something you have written to combine the ADO connection and command objects) would it? If so, you could get it to log every call it makes.

Just a thought. Other than that, I'm afraid I can't be of any more help to you but, if I think of anything, I'll let you know.

s46.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 4

Accepted Solution

by:
chipple earned 500 total points
ID: 11867401
Back in SQL Server 6.5, SQL Profiler was called SQL Trace, and it did pretty much the same thing. It's part of the client tools so you may have to install it separately using the SQL Server CD.

To use it, you must start up SQL Trace, login to SQL Server and then set up a trace telling it what events you want to log. Especially if you're trying to debug queries that fail, you may want to watch the events called SQL:BatchStarting and/or SQL:StmtStarting for TSQL, and RPC:Starting for stored procedures, which are not selected by default.

Good luck.
0
 
LVL 9

Expert Comment

by:solution46
ID: 11867945
Went digging through my old books last night and found the same thing chipple just said - that application you want is called SQPTrace. If you can't find it on your PC, it is apparently a GUI for an external procedure called xp_sqltrace. I can't help you with the syntax or how to use it, but according to my book xp_sqltrace is pretty well documented in the on-line help. Also, I just checked on the M$ knowledge base and the following link may be helpful (haven;t read through it in detail but it seems to tell you how to use the proc.)

http://support.microsoft.com/default.aspx?scid=kb;en-us;194860&Product=sql

Regards,

s46.
0
 
LVL 2

Author Comment

by:Discofish
ID: 11884196
Thanks for the help folks.  The trace util provied just what I needed.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question