Showing posts with label trace. Show all posts
Showing posts with label trace. Show all posts

Monday, March 26, 2012

How to trace trigger execution in SQL Profiler?

When I try to trace some SQL statement executions inside a Trigger by using 2005 SQL Profiler, I found even the trigger is fired, there's no any trace about it in SQL Profiler. How can I trace trigger execution in 2005 SQL Profiler?Hi,

have a look here: http://groups.google.de/group/microsoft.public.sqlserver.server/browse_frm/thread/c87621996c73012b

HTH, Jens SUessmeyer.

http://www.sqlserver2005.de

How to trace the records that have been related to the child table

The problem of mine is, I have a datagrid, Which displays data from a Employee(parent) table.

Now I want to delete some records based on the user selected checkbox,
only those records which has no related records in the EmployeeProject(child) can be deleted.
I want to know which are all the record that cannot be deleted?

How can I achieve this?

You need to find out the related records on the child tables by following the primary/foreign key relationships. In the future you can use theON DELETE CASCADE command, or similar, when you create a table, so it will delete all child records automatically. If you don't know the table relationships, I suggest you find out as much as possible about the structure you're working with before allowing data deletion.

|||

SELECT Employee.*,CASE WHEN EXISTS(SELECT * FROM EmployeeProject ep WHERE ep.EmployeeID=e.EmployeeID) THEN 0 ELSE 1 END AS Deletable

FROM Employee e

Then in your datagrid, make a button column that has a commandname of "Delete". Convert that column to a template field. Now databind the button's visible in the template field to Deletable. This isn't a perfect solution because changes can take place in the database from the time you generate the page until you get back the request to delete, but it handles the vast majority of cases. Just make sure you handle the case where you are requested to delete a record that either no longer exists (Most code will just silently fail anyhow), or is no longer deletable (Try/catch the attempt to delete, and on failure, re-databind the grid and toss up an error to the user).

|||

Sorry, didn't notice that you wanted checkboxes. Use the same query, just databind the checkbox'ed enabled property to the Deletable field.

how to trace the file activity???

Dear all,
It urgent, can anyone please tell me how to race
the activity which the user have done to the file. e.g.
When the user delete a record from the file, when the
user edit a record from the file and when the user add a
new record to a file from the EM.Please, help.. Thanks.
Regards
Sharon
.There are several ways. One is to add a trigger to every table you wish to
audit that keeps track of all this activity. Of coarse this doesn't help
for any activity that already happened. Another much easier way is to use a
3rd party product such as Log Explorer from www.lumigent.com to look at the
log files and see the history. Of coarse if you have already truncated the
logs you may not have the information.
Andrew J. Kelly
SQL Server MVP
"sharon" <anonymous@.discussions.microsoft.com> wrote in message
news:130a901c44390$4ac6a320$a601280a@.phx
.gbl...
> Dear all,
> It urgent, can anyone please tell me how to race
> the activity which the user have done to the file. e.g.
> When the user delete a record from the file, when the
> user edit a record from the file and when the user add a
> new record to a file from the EM.Please, help.. Thanks.
> Regards
> Sharon
>
> .
>sql

How to trace the database activity

Dear all,
It urgent, can anyone please tell me how to race
the activity which the user have done to the file. e.g.
When the user delete a record from the file, when the
user edit a record from the file and when the user add a
new record to a file from the EM.Please, help.. Thanks.
Regards
Sharon
Please don't post independently in multiple newsgroups. You can add the
other newsgroups in the "Newsgroups" section in the header and it will show
up in all those simultaneously as will the answers. See my reply in the
other newsgroup.

Andrew J. Kelly
SQL Server MVP
"sharon" <anonymous@.discussions.microsoft.com> wrote in message
news:1329601c44387$f1f0c2b0$a501280a@.phx.gbl...
> Dear all,
> It urgent, can anyone please tell me how to race
> the activity which the user have done to the file. e.g.
> When the user delete a record from the file, when the
> user edit a record from the file and when the user add a
> new record to a file from the EM.Please, help.. Thanks.
> Regards
> Sharon
>

how to trace table update?

Hi,
I know using sql profiler can trace table update, can
someone teach me how to do so? Thanks
regards,
florenceYou need to start SQL Profiler and then create a connection to your server.
Then, create a new trace and accept all defaults. This should help you trace
the statements that go to SQL Server. If you need to do more esoteric
things, refer to the BOL for more information.
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"florence" <florence@.visualsolutions.com.my> wrote in message
news:0d0701c3a918$23033d70$a301280a@.phx.gbl...
> Hi,
> I know using sql profiler can trace table update, can
> someone teach me how to do so? Thanks
> regards,
> florence

How to trace SQL

Hi,

I'm trying to debug a vendor package and would like to turn on JDBC trace (either client or server side). The only information I found is DBCC TRACE which seems not very useful (I even don't know where the trace result located). Any help is appreciated!

Env: Windows Server 2003 & SQL Server 2000 8.00.818.

Jeff Liperhaps you could use the profiler and run it on the server to see what/when sql-commands are given?|||Unfortunately, the profile won't give me enough information for why a function (xa_open) failed.

thanks,

Jeff Li|||Open a DSN trace on the client?

-PatP|||Hi, Pat:

How can I open the DSN trace on a client?

thanks,

Jeff|||When creating an ODBC DSN, the last dialog page (with the Finish button) usually has the log file information on it.

You can also do it using a connection string or dynamcially using SQLSetConnectAttr, but I don't remember the parameter names for either of them.

-PatP

How to trace sp_addlogin

Dear all,
I have been trying to use SQL Profiler to trace login
creation. Can someone tell me how do I get the login names
that were created? Trace did not display the detail info
of sp_addlogin.
Thanks,
Joe
You can't get it from Profiler. If it sees password in the text it won't
display it.
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Joe" <anonymous@.discussions.microsoft.com> wrote in message
news:c61d01c47a41$709fcbc0$a501280a@.phx.gbl...
> Dear all,
> I have been trying to use SQL Profiler to trace login
> creation. Can someone tell me how do I get the login names
> that were created? Trace did not display the detail info
> of sp_addlogin.
> Thanks,
> Joe
|||Other than SQL profiler, is there any work around? I only
want to prove the new login creation.
Thanks in advance
>--Original Message--
>You can't get it from Profiler. If it sees password in
the text it won't
>display it.
>--
>HTH
>Jasper Smith (SQL Server MVP)
>http://www.sqldbatips.com
>I support PASS - the definitive, global
>community for SQL Server professionals -
>http://www.sqlpass.org
>"Joe" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:c61d01c47a41$709fcbc0$a501280a@.phx.gbl...
names
>
>.
>
|||Execute sp_helplogins or query the master..syslogins table.
-Sue
On Thu, 5 Aug 2004 06:24:29 -0700, "Joe"
<anonymous@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>Other than SQL profiler, is there any work around? I only
>want to prove the new login creation.
>Thanks in advance
>the text it won't
>message
>names
|||Not poossible with the current set of tools.
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Joe" <anonymous@.discussions.microsoft.com> wrote in message
news:c61d01c47a41$709fcbc0$a501280a@.phx.gbl...
> Dear all,
> I have been trying to use SQL Profiler to trace login
> creation. Can someone tell me how do I get the login names
> that were created? Trace did not display the detail info
> of sp_addlogin.
> Thanks,
> Joe
|||Try using sp_trace_setevent and use event number 104 Audit Add/Drop Login
"Occurs when a SQL Server Login is added or removed; for sp_addlogin and
sp_droplogin. Also check out Microsoft article "SQL Server 2000 Auditing".
It details how to use Profiler to audit SQL Server.
Thanks,
Val
"Joe" <anonymous@.discussions.microsoft.com> wrote in message
news:c61d01c47a41$709fcbc0$a501280a@.phx.gbl...
> Dear all,
> I have been trying to use SQL Profiler to trace login
> creation. Can someone tell me how do I get the login names
> that were created? Trace did not display the detail info
> of sp_addlogin.
> Thanks,
> Joe

How to trace a trace file?

SQL Server 2005 Enterprise 64-bit, clustered.
I've just discovered that there is a trace file being created on one of our
servers, but I can't figure out where it's being generated from. It's
tracing various Database Events (Data File Auto Grow, Data File Auto Shrink,
etc.), Error and Warning (Hash Warning, Missing Join Predicate, etc.), Full
Text (FT: Crawl Aborted, etc.), Objects (Object:Altered, etc.), Security
Audit (Audit Add DB User Event, etc.) and Server (Server Memory Change). I
can't see a process in the Activity Monitor that is from SQL Server
Profiler, so I'm a little stumped as to what this is.
I presume it could be caused by sp_trace_create but I'm not sure how I would
find which process, and more specifically which user, is running this.
Or is this possibly some kind of internal auditing capability that someone
has turned on, and if so, where do I find it?
Any help you can provide so I can track this down would be most gratefully
received.
Michael MacGregor
Database ArchitectPerhaps it is the default trace? Is this trace in the SQL Server LOG directo
ry (where the errorlog
file is)? If so, disable it using sp_configure (but remember that is it quit
e handy to have...).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:%23jLsRaInHHA.1244@.TK2MSFTNGP04.phx.gbl...
> SQL Server 2005 Enterprise 64-bit, clustered.
> I've just discovered that there is a trace file being created on one of ou
r servers, but I can't
> figure out where it's being generated from. It's tracing various Database
Events (Data File Auto
> Grow, Data File Auto Shrink, etc.), Error and Warning (Hash Warning, Missi
ng Join Predicate,
> etc.), Full Text (FT: Crawl Aborted, etc.), Objects (Object:Altered, etc.)
, Security Audit (Audit
> Add DB User Event, etc.) and Server (Server Memory Change). I can't see a
process in the Activity
> Monitor that is from SQL Server Profiler, so I'm a little stumped as to wh
at this is.
> I presume it could be caused by sp_trace_create but I'm not sure how I wou
ld find which process,
> and more specifically which user, is running this.
> Or is this possibly some kind of internal auditing capability that someone
has turned on, and if
> so, where do I find it?
> Any help you can provide so I can track this down would be most gratefully
received.
> Michael MacGregor
> Database Architect
>|||Hi Tibor,
Thanks for your prompt response.
Is there documentation on what the default trace contains, i.e. which events
it is monitoring? I took a quick look at BOL but there wasn't much in the
way of information about that under configuration options.
Thanks.
Michael MacGregor
Database Architect|||> Is there documentation on what the default trace contains, i.e. which even
ts it is monitoring?
Sure. Well, ...it depends on whether you want to call below "documentation"
or not... ;-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:%23VTr9hInHHA.2596@.TK2MSFTNGP06.phx.gbl...
> Hi Tibor,
> Thanks for your prompt response.
> Is there documentation on what the default trace contains, i.e. which even
ts it is monitoring? I
> took a quick look at BOL but there wasn't much in the way of information a
bout that under
> configuration options.
> Thanks.
> Michael MacGregor
> Database Architect
>|||So I presume then that there's not much in the way of "official"
documentation for this feature from Microsoft. Ain't that a surprise!
Thanks Tibor.
MTM|||Michael
I wrote an article about this trace when I discovered it. You're right, that
there is not a lot of documentation about it.
http://www.sqlmag.com/Article/Artic...or_a_Trace.html
You can open up any of the trace output files in the Profiler, and then when
you look at the properties of the trace you can see what is being traced.
As Tibor mentioned, you can disable it with sp_configure, if you decide that
it's the best thing to do.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:uLFbVnInHHA.568@.TK2MSFTNGP02.phx.gbl...
> So I presume then that there's not much in the way of "official"
> documentation for this feature from Microsoft. Ain't that a surprise!
> Thanks Tibor.
> MTM
>sql

How to trace a trace file?

SQL Server 2005 Enterprise 64-bit, clustered.
I've just discovered that there is a trace file being created on one of our
servers, but I can't figure out where it's being generated from. It's
tracing various Database Events (Data File Auto Grow, Data File Auto Shrink,
etc.), Error and Warning (Hash Warning, Missing Join Predicate, etc.), Full
Text (FT: Crawl Aborted, etc.), Objects (Object:Altered, etc.), Security
Audit (Audit Add DB User Event, etc.) and Server (Server Memory Change). I
can't see a process in the Activity Monitor that is from SQL Server
Profiler, so I'm a little stumped as to what this is.
I presume it could be caused by sp_trace_create but I'm not sure how I would
find which process, and more specifically which user, is running this.
Or is this possibly some kind of internal auditing capability that someone
has turned on, and if so, where do I find it?
Any help you can provide so I can track this down would be most gratefully
received.
Michael MacGregor
Database Architect
Perhaps it is the default trace? Is this trace in the SQL Server LOG directory (where the errorlog
file is)? If so, disable it using sp_configure (but remember that is it quite handy to have...).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:%23jLsRaInHHA.1244@.TK2MSFTNGP04.phx.gbl...
> SQL Server 2005 Enterprise 64-bit, clustered.
> I've just discovered that there is a trace file being created on one of our servers, but I can't
> figure out where it's being generated from. It's tracing various Database Events (Data File Auto
> Grow, Data File Auto Shrink, etc.), Error and Warning (Hash Warning, Missing Join Predicate,
> etc.), Full Text (FT: Crawl Aborted, etc.), Objects (Object:Altered, etc.), Security Audit (Audit
> Add DB User Event, etc.) and Server (Server Memory Change). I can't see a process in the Activity
> Monitor that is from SQL Server Profiler, so I'm a little stumped as to what this is.
> I presume it could be caused by sp_trace_create but I'm not sure how I would find which process,
> and more specifically which user, is running this.
> Or is this possibly some kind of internal auditing capability that someone has turned on, and if
> so, where do I find it?
> Any help you can provide so I can track this down would be most gratefully received.
> Michael MacGregor
> Database Architect
>
|||Hi Tibor,
Thanks for your prompt response.
Is there documentation on what the default trace contains, i.e. which events
it is monitoring? I took a quick look at BOL but there wasn't much in the
way of information about that under configuration options.
Thanks.
Michael MacGregor
Database Architect
|||> Is there documentation on what the default trace contains, i.e. which events it is monitoring?
Sure. Well, ...it depends on whether you want to call below "documentation" or not... ;-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:%23VTr9hInHHA.2596@.TK2MSFTNGP06.phx.gbl...
> Hi Tibor,
> Thanks for your prompt response.
> Is there documentation on what the default trace contains, i.e. which events it is monitoring? I
> took a quick look at BOL but there wasn't much in the way of information about that under
> configuration options.
> Thanks.
> Michael MacGregor
> Database Architect
>
|||So I presume then that there's not much in the way of "official"
documentation for this feature from Microsoft. Ain't that a surprise!
Thanks Tibor.
MTM
|||Michael
I wrote an article about this trace when I discovered it. You're right, that
there is not a lot of documentation about it.
http://www.sqlmag.com/Article/ArticleID/48939/Searching_for_a_Trace.html
You can open up any of the trace output files in the Profiler, and then when
you look at the properties of the trace you can see what is being traced.
As Tibor mentioned, you can disable it with sp_configure, if you decide that
it's the best thing to do.
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:uLFbVnInHHA.568@.TK2MSFTNGP02.phx.gbl...
> So I presume then that there's not much in the way of "official"
> documentation for this feature from Microsoft. Ain't that a surprise!
> Thanks Tibor.
> MTM
>

How to trace a trace file?

SQL Server 2005 Enterprise 64-bit, clustered.
I've just discovered that there is a trace file being created on one of our
servers, but I can't figure out where it's being generated from. It's
tracing various Database Events (Data File Auto Grow, Data File Auto Shrink,
etc.), Error and Warning (Hash Warning, Missing Join Predicate, etc.), Full
Text (FT: Crawl Aborted, etc.), Objects (Object:Altered, etc.), Security
Audit (Audit Add DB User Event, etc.) and Server (Server Memory Change). I
can't see a process in the Activity Monitor that is from SQL Server
Profiler, so I'm a little stumped as to what this is.
I presume it could be caused by sp_trace_create but I'm not sure how I would
find which process, and more specifically which user, is running this.
Or is this possibly some kind of internal auditing capability that someone
has turned on, and if so, where do I find it?
Any help you can provide so I can track this down would be most gratefully
received.
Michael MacGregor
Database ArchitectPerhaps it is the default trace? Is this trace in the SQL Server LOG directory (where the errorlog
file is)? If so, disable it using sp_configure (but remember that is it quite handy to have...).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:%23jLsRaInHHA.1244@.TK2MSFTNGP04.phx.gbl...
> SQL Server 2005 Enterprise 64-bit, clustered.
> I've just discovered that there is a trace file being created on one of our servers, but I can't
> figure out where it's being generated from. It's tracing various Database Events (Data File Auto
> Grow, Data File Auto Shrink, etc.), Error and Warning (Hash Warning, Missing Join Predicate,
> etc.), Full Text (FT: Crawl Aborted, etc.), Objects (Object:Altered, etc.), Security Audit (Audit
> Add DB User Event, etc.) and Server (Server Memory Change). I can't see a process in the Activity
> Monitor that is from SQL Server Profiler, so I'm a little stumped as to what this is.
> I presume it could be caused by sp_trace_create but I'm not sure how I would find which process,
> and more specifically which user, is running this.
> Or is this possibly some kind of internal auditing capability that someone has turned on, and if
> so, where do I find it?
> Any help you can provide so I can track this down would be most gratefully received.
> Michael MacGregor
> Database Architect
>|||Hi Tibor,
Thanks for your prompt response.
Is there documentation on what the default trace contains, i.e. which events
it is monitoring? I took a quick look at BOL but there wasn't much in the
way of information about that under configuration options.
Thanks.
Michael MacGregor
Database Architect|||> Is there documentation on what the default trace contains, i.e. which events it is monitoring?
Sure. Well, ...it depends on whether you want to call below "documentation" or not... ;-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:%23VTr9hInHHA.2596@.TK2MSFTNGP06.phx.gbl...
> Hi Tibor,
> Thanks for your prompt response.
> Is there documentation on what the default trace contains, i.e. which events it is monitoring? I
> took a quick look at BOL but there wasn't much in the way of information about that under
> configuration options.
> Thanks.
> Michael MacGregor
> Database Architect
>|||So I presume then that there's not much in the way of "official"
documentation for this feature from Microsoft. Ain't that a surprise!
Thanks Tibor.
MTM|||Michael
I wrote an article about this trace when I discovered it. You're right, that
there is not a lot of documentation about it.
http://www.sqlmag.com/Article/ArticleID/48939/Searching_for_a_Trace.html
You can open up any of the trace output files in the Profiler, and then when
you look at the properties of the trace you can see what is being traced.
As Tibor mentioned, you can disable it with sp_configure, if you decide that
it's the best thing to do.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:uLFbVnInHHA.568@.TK2MSFTNGP02.phx.gbl...
> So I presume then that there's not much in the way of "official"
> documentation for this feature from Microsoft. Ain't that a surprise!
> Thanks Tibor.
> MTM
>

Sunday, February 19, 2012

How to stop a trace

Hi there,
I have a fairly simple question. How do you stop a trace in
SQL Profiler (2000 on XP)? When you click the stop button, the toolbar
changes and looks as though the trace has stopped but events are still being
added to the list, and when you try and exit the application, you get a
message about the trace still running. If you try to exit the application
hangs.
Waldy wrote:
> Hi there,
> I have a fairly simple question. How do you stop a
> trace in SQL Profiler (2000 on XP)? When you click the stop button,
> the toolbar changes and looks as though the trace has stopped but
> events are still being added to the list, and when you try and exit
> the application, you get a message about the trace still running. If
> you try to exit the application hangs.
You'll should wait until all events are processed. Maybe you have no
filter or a filter that is not very selective and thus get a large amount
of events. So it may take some time from pressing the button until all
events until then are processed (i.e. displayed).
Kind regards
robert
|||"Robert Klemme" <bob.news@.gmx.net> wrote in message
news:%232FhgwHtFHA.3864@.TK2MSFTNGP12.phx.gbl...
> You'll should wait until all events are processed. Maybe you have no
> filter or a filter that is not very selective and thus get a large amount
> of events.
I am only tracing one event on one database. How many hours do you suggest
I wait?
|||Waldy wrote:
> "Robert Klemme" <bob.news@.gmx.net> wrote in message
> news:%232FhgwHtFHA.3864@.TK2MSFTNGP12.phx.gbl...
> I am only tracing one event on one database. How many hours do you
> suggest I wait?
Dunno. Are you sure that the single event doesn't produce a lot of
entries? Otherwise I'm at a loss here, too. Sounds strange.
robert
|||Waldy wrote:
> Hi there,
> I have a fairly simple question. How do you stop a
> trace in SQL Profiler (2000 on XP)? When you click the stop button,
> the toolbar changes and looks as though the trace has stopped but
> events are still being added to the list, and when you try and exit
> the application, you get a message about the trace still running. If
> you try to exit the application hangs.
This can sometimes happen when using Profiler on a very busy server that
produces a lot of rowset information. Is your server under high load?
What event are you capturing and how much information is being returned
(you can see a rowcount in the status bar of the Profiler client).
In general, if you experience this problem, or are looking for a more
robust tracing method, you should use server-side tracing. A server-side
trace likely won't exhibit these problems. You can have Profiler script
the t-sql necessary to start the trace from the File - Script Trace menu
option. You need to roll your own code to stop the trace. You can open
the trace file directly in Profiler once the trace is stopped.
David Gugick
Quest Software
www.imceda.com
www.quest.com