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 2005 Forums
 Other SQL Server Topics (2005)
 Monitoring Issues

Author  Topic 

techno_mono
Starting Member

6 Posts

Posted - 2008-12-18 : 15:40:29
Hi, i´m working on sql server 2005, monitoring a data base. I have the following task: to create an alarm system by mail, of events like process that take more than 3 seg and the sql server profiler detects.

I´m saving the monitoring data in a table of the data base. I also have a trigger that sends the email.

The issue ocurrs when the trace starts, and it seems that all the triggers are deleted, all that are related to the table where i save the data of the trace. If I create the trigger while the trace is working, it stops and sends an error.

what do you recommend to do?


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-18 : 15:53:37
I don't understand your issue. You should be using a server-side trace for this rather than SQL Profiler.

What error are you getting? What is causing the triggers to be deleted?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

techno_mono
Starting Member

6 Posts

Posted - 2008-12-19 : 08:25:39
quote:
Originally posted by tkizer

I don't understand your issue. You should be using a server-side trace for this rather than SQL Profiler.

What error are you getting? What is causing the triggers to be deleted?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog




The problem:

I have 2 database engine connections:
The first,is a remote connection to a server
The second is a localhost connection.
In the localhost connection I keep the result of monitoring traces of the remote server . I keep this results in a table named t_traces.

My task is create an alarm system by mail of events registered in the table t_traces. For this task, I have a trigger, in table t_traces, that sends the email with the alert, when a new row is inserted. But this doesn´t work because when I run the trace, it seems to be deleted the table t_traces and create it again but I lost the trigger of the table t_traces.

I don't know what to do...
I need an alternative for resolve this task.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-19 : 11:04:43
Well you should be saving the trace data to a file, not to a table. Then move your data from the file into a table.

See this for SQL Profiler best practices and also how to query a trace file so that you can insert the data from it into a table:
http://weblogs.sqlteam.com/tarad/archive/2008/08/06/SQL-Profiler-best-practices.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

techno_mono
Starting Member

6 Posts

Posted - 2008-12-22 : 12:44:17
Thanks for your answer tkizer.

Your method have a problem for my task, how I can read only new records of the table automatically???
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-22 : 12:45:36
I don't understand what you mean.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

techno_mono
Starting Member

6 Posts

Posted - 2008-12-22 : 13:13:10
tkizer, If I save the result of my trace in my_table.trc (for example). I need to create a script to read the new records of my_table.trc like a trigger do

I don't know how I can do this possible
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-22 : 13:49:08
You just use an INSERT/SELECT using this approach: http://support.microsoft.com/kb/325197

INSERT INTO Table1 (Column1, Column2)
SELECT Column1, Column2
FROM ::fn_trace_gettable('E:\Trace\sometracefile.trc', 1)

For duplicate rows between the trace file and your table, just use a NOT EXISTS clause to get rid of the duplicate EventSequence.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

techno_mono
Starting Member

6 Posts

Posted - 2008-12-22 : 13:58:49
Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-22 : 14:05:48
You're welcome. Let us know if you need any other help on this.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -