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 Responses to “xp_readerrorlog parameter detail”

  1. Unknown's avatar Alexey Knyazev Says:

    exec xp_readerrorlog 0, 1, N'DBCC', N'3604', '20120401', '20120401 18:00';5) '20120401' – StartTime6) '20120401 18:00' – EndTime

  2. Unknown's avatar Anonymous Says:

    nice work

  3. Unknown's avatar Anonymous Says:

    seventh parameter: sort orderexec xp_readerrorlog 0, 1, N'DBCC', N'3604', '20120901', '20121026 12:00', 'DESC'

Leave a comment


Design a site like this with WordPress.com
Get started