Wednesday, March 7, 2012

How to get logfile of SQL statements?

Hi,
on SQL Server Version 8.0, is it possible to get a logfile of the SQL
statements for a certain database? If not built in, is there a tool?
Thank you
Adrian
I guess you want to get a trace of what SQL statements have been run against
a particular database. For that, you can use SQL Profiler (a GUI tool) or SQL
Trace without GUI.
Linchi
"Adrian Schmitt" wrote:

> Hi,
> on SQL Server Version 8.0, is it possible to get a logfile of the SQL
> statements for a certain database? If not built in, is there a tool?
> Thank you
> Adrian
>
|||You could use the way Linchi recommended, but I suggest you execute the SQL
Trace or Profiler only when required.
Thanks
Hari
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:74E8236E-70F9-4237-B9D4-EB6C8B0D439D@.microsoft.com...[vbcol=seagreen]
>I guess you want to get a trace of what SQL statements have been run
>against
> a particular database. For that, you can use SQL Profiler (a GUI tool) or
> SQL
> Trace without GUI.
> Linchi
> "Adrian Schmitt" wrote:
|||On 22 Jun., 18:21, Linchi Shea <LinchiS...@.discussions.microsoft.com>
wrote:
> I guess you want to get a trace of what SQL statements have been run against
> a particular database. For that, you can use SQL Profiler (a GUI tool)
Thank you Linchi, thank you Hari.
I created a new database user in the end and assigned the
"sysadmin" server role to this user. Then I was able to log the
requests
that the client application was doing (but as a different user) with
the Profiler.
I could understand some parts of what this logging shows, like SELECT
and
UPDATE commands, because I recognized also the fields and table-names,
although this is not in the form of SQL like I have seen it before.
Can someone tell me what is the name of this language and is there a
reference
manual online?
This is just a few lines from it that I did not understand:
exec sp_cursorexecute 41, @.P1 output, @.P2 output, @.P3 output, @.P4
output, 4, 'address'
select @.P1, @.P2, @.P3, @.P4
go
exec sp_cursorfetch 180150096, 2, 1, 1
go
declare @.P1 int
set @.P1=42
declare @.P2 int
set @.P2=180150097
declare @.P3 int
set @.P3=1
declare @.P4 int
set @.P4=4
declare @.P5 int
set @.P5=1
The long numbers that start with 180... seem like some refence to
database cursors or statements,
and statements are maybe prepared here over several lines and stuffed
with parameters like it seems?
Maybe someone can point me to some documentation?
Thank you
Adrian
|||Hi
You may want to take a look into Notifications or/and DDL Triggers in the
BOL
"Adrian Schmitt" <Adrian.Schmitt@.googlemail.com> wrote in message
news:1182649654.408598.172770@.g4g2000hsf.googlegro ups.com...
> On 22 Jun., 18:21, Linchi Shea <LinchiS...@.discussions.microsoft.com>
> wrote:
> Thank you Linchi, thank you Hari.
> I created a new database user in the end and assigned the
> "sysadmin" server role to this user. Then I was able to log the
> requests
> that the client application was doing (but as a different user) with
> the Profiler.
> I could understand some parts of what this logging shows, like SELECT
> and
> UPDATE commands, because I recognized also the fields and table-names,
> although this is not in the form of SQL like I have seen it before.
> Can someone tell me what is the name of this language and is there a
> reference
> manual online?
> This is just a few lines from it that I did not understand:
> --
> exec sp_cursorexecute 41, @.P1 output, @.P2 output, @.P3 output, @.P4
> output, 4, 'address'
> select @.P1, @.P2, @.P3, @.P4
> go
> exec sp_cursorfetch 180150096, 2, 1, 1
> go
> declare @.P1 int
> set @.P1=42
> declare @.P2 int
> set @.P2=180150097
> declare @.P3 int
> set @.P3=1
> declare @.P4 int
> set @.P4=4
> declare @.P5 int
> set @.P5=1
> --
> The long numbers that start with 180... seem like some refence to
> database cursors or statements,
> and statements are maybe prepared here over several lines and stuffed
> with parameters like it seems?
> Maybe someone can point me to some documentation?
> Thank you
> Adrian
>
|||> Adrian wrote[vbcol=seagreen]
On 24 Jun., 09:35, Uri Dimant wrote:
> You may want to take a look into Notifications or/and DDL
> Triggers in the BOL
Thank you, Uri. I download Books Online from Microsoft.
The content of the Profiler-Logfile is specific to how the
connection is made, in my case ODBC.
Additionally I found these threads on the subject:
http://webservertalk.com/showpost.php?p=1324627&postcount=5
http://tek-tips.com/viewthread.cfm?qid=832355
Cheers
Adrian

No comments:

Post a Comment