06 March,2016 by Tom Collins
Go beyond the manual opening of SQL Server Error Logs and SQL Agent Error Logs by using the xp_readerrorlog procedure. Your life will suddenly become easier .
These commands will get you started .
--reads the current SQL Server Error log
xp_readerrorlog 0
--reads the second SQL Server Error Log
xp_readerrorlog 2
--reads the current SQL Agent Logs
xp_readerrorlog 0,2
--reads the current SQL Server Error log with the search string 'Login'
xp_readerrorlog 0, 1, "Login"
----reads the current SQL Server Error log with the search string 'Login' and 'failed'
xp_readerrorlog 0, 1, "Login","failed"
----reads the current SQL Server Error log with the search string 'Login' and 'failed',since 20160306 and up to 20160307
xp_readerrorlog 0, 1, "Login","failed" ,'20160306','20160307'
--reads the current SQL Server Error Logs in descending order
xp_readerrorlog 0, 1, NULL, NULL, NULL, NULL, N'desc'
SQL Server – Reading and Deleting SQL Server Error Log files ...
SQL Server - Powershell and SQL Error Logs - SQL Server DBA
SQL Server Error Log Check - SQL Server DBA
SQL Server – Error Logs recycle without SQL Server Restart - SQL ...
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |