xp_readerrorlog parameter detail

Recently we had  hardware and performance issues on SQL Server,with our client , so while monitoring the system we also looked at error log. We used xp_readerrorlog procedure.
This is really useful procedure and I feel I should share some information for this undocumented store procedures






xp_readerrorlog  has four parameters
1.EXEC Xp_readerrorlog 0

here 0 stands for file number where latest file has 0 number and subsequent rolled over file has incremented  number. So this will display current errorlog file while incremented number will subsequent show rolled over file for


2.EXEC Xp_readerrorlog    0,   1
here secound parameter has two values
1. error log
2 agent log

yes we can get agent log also from this proc :-)



EXEC Xp_readerrorlog    0,   1





EXEC Xp_readerrorlog    0,   1




3.EXEC Xp_readerrorlog     0,    1,    'dbcc'
This will search for string which has 'dbcc' word in it



4.EXEC Xp_readerrorlog    0,    1,    'dbcc',    'traceon'

this will filter result set more and give result which has both 'dbcc' and 'traceon' words in it

3 comments:

Alexey Knyazev said...

exec xp_readerrorlog 0, 1, N'DBCC', N'3604', '20120401', '20120401 18:00';

5) '20120401' - StartTime
6) '20120401 18:00' - EndTime

Anonymous said...

nice work

Anonymous said...

seventh parameter: sort order

exec xp_readerrorlog 0, 1, N'DBCC', N'3604', '20120901', '20121026 12:00', 'DESC'

Post a Comment

Amazon Contextual Product Ads

Popular Posts