SQL Server 2008 R2 SP2 - 10.50.4000.0 (X64)
I have built a Maintenance Plan and the only task within this plan is (Back UP Database Full).
I have selected to only backup 1 database. The recovery model for this database = (Simple) And the database checks out OK using DBCC CHECKDB.
The backup portion works fine. However when I add the option (Verify backup integrity) within the Maintenance Plan, the verfication portion fails.
Error:
@backupSetId is null begin raiserror(N''Verify failed. Backup information for database ''''testdb'''' not found.'', 16, 1
Here is the code:
Command:EXECUTE master.dbo.xp_create_subdir N''D:\SQLDBbkups\testdb''
GO
BACKUP DATABASE [testdb] TO DISK = N''D:\SQLDBbkups\testdb\testdb_backup_2013_01_03_125812_4222987.bak'' WITH NOFORMAT, NOINIT, NAME = N''testdb_backup_2013_01_03_125812_4192984'', SKIP, REWIND, NOUNLOAD, STATS = 10
GO
declare @backupSetId as int
select @backupSetId = position from msdb..backupset where database_name=N''testdb'' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N''testdb'' )
if @backupSetId is null begin raiserror(N''Verify failed. Backup information for database ''''testdb'''' not found.'', 16, 1) end
RESTORE VERIFYONLY FROM DISK = N''D:\SQLDBbkups\testdb\testdb_backup_2013_01_03_125812_4222987.bak'' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND