SQL Server 2012 – Will Backup Notify of CHECKSUM Error with CONTINUE_AFTER_ERROR?

backupchecksumsql-server-2012

I am in the process of adding the WITH CHECKSUM flag on our daily SQL backups, as part of an effort to better ensure data integrity.

I definitely want to know if a checksum error is ever encountered, but I also don't want my job to stop dead in the water in the middle of the night; I want it to finish backing up the "bad" database, then continue backing up the other databases on the server.

If I use BACKUP WITH CHECKSUM, CONTINUE_AFTER_ERROR, will it still throw the appropriate error (SEV 22 or Error 825 or whatever) that will trigger my associated alert? Or does CONTINUE_AFTER_ERROR suppress this altogether, and I'd only know about the problem if I parse the job step output?

I would simply test it, but I don't have a database with known CHECKSUM inconsistencies.

Best Answer

Yes it will continue and finish, there is an example in this older blogpost. It also contains a broken database file (for older versions) to play with:

https://blogs.msdn.microsoft.com/sqlserverstorageengine/2007/04/17/example-corrupt-database-to-play-with-and-some-backuprestore-things-to-try/

I think it is actually quite important as a dba to simulate all those cases, I know it from experience with customers it is risky and time consuming if you have to research those methods in a downtime. So kudos for asking. Here is a lunatic/ingenious method to do corruption with SQL:

https://sqlblogcasts.com/blogs/tonyrogerson/archive/2007/03/10/how-to-create-a-corrupt-database-using-bulk-insert-update-and-bcp-sql-server-as-a-hex-editor.aspx