Solved

SQL Server (6.5) - Logging all queries executed

Posted on 2004-08-20
6
386 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction: I have seen many questions on EE and elsewhere, asking about how to find either gaps in lists of numbers (id field, usually) ranges of values or dates overlapping date ranges combined date ranges I thought it would be a good …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now