File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ Author: Ben Snaidero
3+ Original link: https://www.mssqltips.com/sqlservertip/4166/automate-alerting-for-sql-server-suspect-database-pages/
4+ */
5+
6+ SELECT sp .database_id AS DatabaseID
7+ , d .name AS DatabaseName
8+ , sp .file_id AS FileID
9+ , mf .physical_name AS FileName
10+ , sp .page_id AS PageID
11+ , CASE
12+ WHEN sp .event_type = 1
13+ THEN ' 823 or 824 error other than a bad checksum or a torn page'
14+ WHEN sp .event_type = 2
15+ THEN ' Bad checksum'
16+ WHEN sp .event_type = 3
17+ THEN ' Torn Page'
18+ WHEN sp .event_type = 4
19+ THEN ' Restored (The page was restored after it was marked bad)'
20+ WHEN sp .event_type = 5
21+ THEN ' Repaired (DBCC repaired the page)'
22+ WHEN sp .event_type = 7
23+ THEN ' Deallocated by DBCC'
24+ END AS EventDesc
25+ , sp .error_count AS ErrorCount
26+ , sp .last_update_date AS LastUpdated
27+ FROM msdb .dbo .suspect_pages AS sp
28+ INNER JOIN sys .databases AS d ON d .database_id = sp .database_id
29+ INNER JOIN sys .master_files AS mf ON mf .database_id = sp .database_id AND mf .file_id = sp .file_id ;
You can’t perform that action at this time.
0 commit comments