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


Post a Comment

Popular Posts