Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Tracking SQL Statements

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-08-12 : 07:56:19
bukrie writes "Is there a way I can track all the sql statements (selects, insert, update) made to a database by all the users. I was thinking maybe something like a log."

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-08-12 : 08:39:50
Have a look at sp_trace_create and the TRACE_PRODUCE_BLACKBOX option (SQL 2K).

Jay White
{0}
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-08-12 : 12:38:51
An easier way is to use SQL Profiler.

Tara
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-08-12 : 13:29:14
SQL Server already has a log. Except that there is no way of viewing it! Look at Lumigent's Log Explorer www.lumigent.com

Owais
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-08-12 : 13:35:09
quote:
Originally posted by mohdowais

SQL Server already has a log. Except that there is no way of viewing it! Look at Lumigent's Log Explorer www.lumigent.com

Owais



Well that isn't true. DBCC LOG allows you to view the transaction log, it's just a bit complex. I would bet that Log Explorer is using DBCC LOG. See eyechart's post in the below thread:

[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=28323&SearchTerms=dbcc[/url]

Tara
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-08-12 : 16:16:49
hmmm...never tried DBCC LOG before, gotta check this first thing tomorrow morning! You learn something new everyday!

Thanx

Owais
Go to Top of Page

shsmonteiro
Constraint Violating Yak Guru

290 Posts

Posted - 2003-08-12 : 21:58:13
DBCC Log is a great tool to recover mistakes made in the database. Its drawback is the complexity. But a little deeper digging will reveal pearls to those needing to tracking all operations made in your server database.

Tara, you won 80% of your bet. Yes, Log explore uses DBCC LOG but uses some procs to tracking activity and not rely on the recovery model. That why Log Explorer is faster than DBCC LOG.

On SQL Server 2k, there is the fn_DBLog function, which brings the same result as using DBCC LOG command.

BTW, remmeber to enable trace 3604

regards,


Sérgio Monteiro
Trust in no Oracle
Go to Top of Page
   

- Advertisement -