We use sp_readerrorlog for reading the content of the error log of SQL Server and it actually uses xp_readerrorlog extended stored procedure. Since I had to do some troubleshoot with one of servers, I use this for finding some info, and thought share it.
Here are some ways of reading the error log;
In case of you need the code;
USE master; GO -- without parameters, load the current log EXEC xp_readerrorlog; -- Load the specific error log -- 0 is current one and by default there are 6 more old logs EXEC xp_readerrorlog 0; -- Second parameter is for log type -- 1 is for engine and 2 is agent EXEC xp_readerrorlog 0, 1; -- Two more additional parameters can be passed -- for searching, 1st one is for searching -- and second one for filter the search - or further searchin within the result EXEC xp_readerrorlog 0, 1, N'Server', N'Listening'; -- And this can take three more parameters -- for setting the date range and sorting order EXEC xp_readerrorlog 0, 1, N'Database', N'resource' , '2016-12-21 23:00:18.860', '2016-12-21 23:00:18.930', N'DESC';
No comments:
Post a Comment