Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 check for database corruption

Author  Topic 

Bea
Starting Member

7 Posts

Posted - 2010-07-27 : 14:23:45
Hello

Does anyone have a script where a database can be checked if it is corrupt, if it is, then i am sent an email with database and server name.

Thank you

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-27 : 14:43:50
Check out the DBCC CHECKDB comment in this link: http://weblogs.sqlteam.com/tarad/archive/2008/06/30/SQL-Server-jobs-on-production-instances.aspx

It references how to call it for each database. Add it to a SQL job that runs daily and set the notification tab to email the operator when the job fails. When DBCC CHECKDB detects data corruption, it throws an error which will cause the SQL job to fail.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -