August 18, 2008 at 11:57 pm
We have developed our asp.net application using SQL Server 2005. Now I want to log each and every database error into a log error table. I can't modify each and every stored procedure. Is there any other way like writing a stored procedure that will store any database error?
Thanks in advance...
August 19, 2008 at 2:50 am
[font="Verdana"]The best way is to capture all the errors for that database is to run a profiler trace in background and store it in a table. You need to use Errors & Warnings events and filter it using dbid or dbname. [/font]
Regards..Vidhya Sagar
SQL-Articles
August 19, 2008 at 4:38 am
Thanks a lot Vidya. It has solved the problem. Now I am able to save every database error.
However sometimes I am using RaiseError to raise some custom exception for the user understanding and I don't want to save them into table. Is there any way or filter for them?
thanks...
August 19, 2008 at 5:22 am
Here I am facing one more problem. If I'll close the SQL Profiler window then the trace stops working. so out to make it run in the background so that it will run after closing Profiler window also...
This will help me a lot and any suggestion will be appriciated.......
August 21, 2008 at 1:13 am
Hello,
One question - do you want to log DB errors to a table over a long period?
The Profiler is normally used for short term analysis e.g. in bug hunting or identifying performance issues. Long term use can have a performance hit on your server.
If you want to capture this information every day then you could instead use a tool such as LogParser to regularly extract data from the SQL Server Log and load it into a DB table. (LogParser is available from MS Downloads).
Regards,
John Marsh
www.sql.lu
SQL Server Luxembourg User Group
August 21, 2008 at 3:42 am
Will this tool log each and every error at the time of error generation or anything else?
My requiremnt is to log each error related to a perticular database into a table.
August 21, 2008 at 5:36 am
Hello,
LogParser extracts information from the SQL Server Log, but not in real time. You would need to schedule it to run every day/hour/minute etc depending on your requirements.
It can filter the information that it extracts, so you may be able to limit it to just the errors that you require.
Regards,
John Marsh
www.sql.lu
SQL Server Luxembourg User Group
August 21, 2008 at 5:45 am
Hi,
If the application is being used during a specific time window and you want to collect the error for the specific time window, you can setup a scheduled trace to run for the specific time duration and get them into a trace table automatically.
Check the following link for scheduling a trace and collecting them into a table.
http://www.novicksoftware.com/Articles/scripting-traces-for-performance-monitoring-on-sql-server.htm
Hope this helps.
Cheers,
Imran.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply