Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Server (6.5) - Logging all queries executed

Posted on 2004-08-20
6
Medium Priority
?
434 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 4

Accepted Solution

by:
chipple earned 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

972 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