Are you sure you want to Restore Database in all? (Y/N) Microsoft (R) Build Engine version 4.0.30319.18408 [Microsoft .NET Framework, version 4.0.30319.18444] Copyright (C) Microsoft Corporation. All rights reserved. Build started 15/04/2014 15:59:49. Copy file C:\ProgramData\Sophos\ManagementServer\Backup\Databases\SOPHOSENC52.bak successful. C:\ProgramData\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S "(local)\SOPHOS" -d "master" -b -Q "IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'SOPHOSENC52') BEGIN ALTER DATABASE SOPHOSENC52 SET OFFLINE WITH ROLLBACK AFTER 5 END" Attempting restore with SQL2012 backup schema. C:\ProgramData\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S "(local)\SOPHOS" -d "master" -b -Q "CREATE TABLE #backupSetInfo (BackupName NVARCHAR(128),BackupDescription NVARCHAR(255),BackupType smallint,ExpirationDate datetime,Compressed tinyint,Position smallint,DeviceType tinyint,UserName NVARCHAR(128),ServerName NVARCHAR(128),DatabaseName NVARCHAR(128),DatabaseVersion INT,DatabaseCreationDate datetime,BackupSize numeric(20,0),FirstLSN numeric(25,0),LastLSN numeric(25,0),CheckpointLSN numeric(25,0),DatabaseBackupLSN numeric(25,0),BackupStartDate datetime,BackupFinishDate datetime,SortOrder smallint,CodePage smallint,UnicodeLocaleId INT,UnicodeComparisonStyle INT,CompatibilityLevel tinyint,SoftwareVendorId INT,SoftwareVersionMajor INT,SoftwareVersionMinor INT,SoftwareVersionBuild INT,MachineName NVARCHAR(128),Flags INT,BindingID uniqueidentifier,RecoveryForkID uniqueidentifier,Collation NVARCHAR(128),FamilyGUID uniqueidentifier,HasBulkLoggedData INT,IsSnapshot INT,IsReadOnly INT,IsSingleUser INT,HasBackupChecksums INT,IsDamaged INT,BeginsLogChain INT,HasIncompleteMetaData INT,IsForceOffline INT,IsCopyOnly INT,FirstRecoveryForkID uniqueidentifier,ForkPointLSN numeric(25,0),RecoveryModel NVARCHAR(128),DifferentialBaseLSN numeric(25,0),DifferentialBaseGUID uniqueidentifier,BackupTypeDescription NVARCHAR(128),BackupSetGUID uniqueidentifier,CompressedBackupSize INT,containment tinyint); INSERT #backupSetInfo EXEC('RESTORE HEADERONLY FROM DISK=N' + '''C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak'''); DECLARE @backupsetnumber smallint; SET @backupsetnumber = (SELECT TOP(1) Position FROM #backupSetInfo ORDER BY BackupFinishDate DESC); RESTORE DATABASE SOPHOSENC52 FROM DISK = 'C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak' WITH FILE = @backupsetnumber, REPLACE, RECOVERY; DROP TABLE #backupSetInfo;" Msg 213, Level 16, State 7, Server SOPHOS\SOPHOS, Line 1 Column name or number of supplied values does not match table definition. Msg 3013, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 RESTORE HEADERONLY is terminating abnormally. Msg 3250, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 The value '0' is not within range for the FILE parameter. Msg 3013, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 RESTORE DATABASE is terminating abnormally. Attempting restore with SQL2008/SQL2008R2 backup schema. C:\ProgramData\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S "(local)\SOPHOS" -d "master" -b -Q "CREATE TABLE #backupSetInfo (BackupName NVARCHAR(128),BackupDescription NVARCHAR(255),BackupType smallint,ExpirationDate datetime,Compressed tinyint,Position smallint,DeviceType tinyint,UserName NVARCHAR(128),ServerName NVARCHAR(128),DatabaseName NVARCHAR(128),DatabaseVersion INT,DatabaseCreationDate datetime,BackupSize numeric(20,0),FirstLSN numeric(25,0),LastLSN numeric(25,0),CheckpointLSN numeric(25,0),DatabaseBackupLSN numeric(25,0),BackupStartDate datetime,BackupFinishDate datetime,SortOrder smallint,CodePage smallint,UnicodeLocaleId INT,UnicodeComparisonStyle INT,CompatibilityLevel tinyint,SoftwareVendorId INT,SoftwareVersionMajor INT,SoftwareVersionMinor INT,SoftwareVersionBuild INT,MachineName NVARCHAR(128),Flags INT,BindingID uniqueidentifier,RecoveryForkID uniqueidentifier,Collation NVARCHAR(128),FamilyGUID uniqueidentifier,HasBulkLoggedData INT,IsSnapshot INT,IsReadOnly INT,IsSingleUser INT,HasBackupChecksums INT,IsDamaged INT,BeginsLogChain INT,HasIncompleteMetaData INT,IsForceOffline INT,IsCopyOnly INT,FirstRecoveryForkID uniqueidentifier,ForkPointLSN numeric(25,0),RecoveryModel NVARCHAR(128),DifferentialBaseLSN numeric(25,0),DifferentialBaseGUID uniqueidentifier,BackupTypeDescription NVARCHAR(128),BackupSetGUID uniqueidentifier,CompressedBackupSize INT); INSERT #backupSetInfo EXEC('RESTORE HEADERONLY FROM DISK=N' + '''C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak'''); DECLARE @backupsetnumber smallint; SET @backupsetnumber = (SELECT TOP(1) Position FROM #backupSetInfo ORDER BY BackupFinishDate DESC); RESTORE DATABASE SOPHOSENC52 FROM DISK = 'C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak' WITH FILE = @backupsetnumber, REPLACE, RECOVERY; DROP TABLE #backupSetInfo;" (1 rows affected) Msg 5133, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL$SOPHOS\Data\SOPHOSENC52.mdf" failed with the operating system error 3(failed to retrieve text for this error. Reason: 15105). Msg 3156, Level 16, State 3, Server SOPHOS\SOPHOS, Line 1 File 'SOPHOSENC51' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL$SOPHOS\Data\SOPHOSENC52.mdf'. Use WITH MOVE to identify a valid location for the file. Msg 5133, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL$SOPHOS\Data\SOPHOSENC52.ldf" failed with the operating system error 3(failed to retrieve text for this error. Reason: 15105). Msg 3156, Level 16, State 3, Server SOPHOS\SOPHOS, Line 1 File 'SOPHOSENC51_log' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL$SOPHOS\Data\SOPHOSENC52.ldf'. Use WITH MOVE to identify a valid location for the file. Msg 3119, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 Problems were identified while planning for the RESTORE statement. Previous messages provide details. Msg 3013, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 RESTORE DATABASE is terminating abnormally. Attempting restore with SQL2005 backup schema. C:\ProgramData\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S "(local)\SOPHOS" -d "master" -b -Q "CREATE TABLE #backupSetInfo (BackupName NVARCHAR(128),BackupDescription NVARCHAR(255),BackupType smallint,ExpirationDate datetime,Compressed tinyint,Position smallint,DeviceType tinyint,UserName NVARCHAR(128),ServerName NVARCHAR(128),DatabaseName NVARCHAR(128),DatabaseVersion INT,DatabaseCreationDate datetime,BackupSize numeric(20,0),FirstLSN numeric(25,0),LastLSN numeric(25,0),CheckpointLSN numeric(25,0),DatabaseBackupLSN numeric(25,0),BackupStartDate datetime,BackupFinishDate datetime,SortOrder smallint,CodePage smallint,UnicodeLocaleId INT,UnicodeComparisonStyle INT,CompatibilityLevel tinyint,SoftwareVendorId INT,SoftwareVersionMajor INT,SoftwareVersionMinor INT,SoftwareVersionBuild INT,MachineName NVARCHAR(128),Flags INT,BindingID uniqueidentifier,RecoveryForkID uniqueidentifier,Collation NVARCHAR(128),FamilyGUID uniqueidentifier,HasBulkLoggedData INT,IsSnapshot INT,IsReadOnly INT,IsSingleUser INT,HasBackupChecksums INT,IsDamaged INT,BeginsLogChain INT,HasIncompleteMetaData INT,IsForceOffline INT,IsCopyOnly INT,FirstRecoveryForkID uniqueidentifier,ForkPointLSN numeric(25,0),RecoveryModel NVARCHAR(128),DifferentialBaseLSN numeric(25,0),DifferentialBaseGUID uniqueidentifier,BackupTypeDescription NVARCHAR(128),BackupSetGUID uniqueidentifier); INSERT #backupSetInfo EXEC('RESTORE HEADERONLY FROM DISK=N' + '''C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak'''); DECLARE @backupsetnumber smallint; SET @backupsetnumber = (SELECT TOP(1) Position FROM #backupSetInfo ORDER BY BackupFinishDate DESC); RESTORE DATABASE SOPHOSENC52 FROM DISK = 'C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak' WITH FILE = @backupsetnumber, REPLACE, RECOVERY; DROP TABLE #backupSetInfo;" Msg 213, Level 16, State 7, Server SOPHOS\SOPHOS, Line 1 Column name or number of supplied values does not match table definition. Msg 3013, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 RESTORE HEADERONLY is terminating abnormally. Msg 3250, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 The value '0' is not within range for the FILE parameter. Msg 3013, Level 16, State 1, Server SOPHOS\SOPHOS, Line 1 RESTORE DATABASE is terminating abnormally. Failed to restore C:\ProgramData\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S "(local)\SOPHOS" -d "master" -b -Q "ALTER DATABASE SOPHOSENC52 SET ONLINE" C:\ProgramData\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S "(local)\SOPHOS" -d "SOPHOSENC52" -b -i ResetUserMappings.sql Process 'C:\ProgramData\Sophos\ManagementServer\Backup\DataBackupRestore\TRS.bat (local)\SOPHOS SOPHOSENC52 "C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak"' returned Error 1 Build FAILED. Time Elapsed 00:00:01.23 Process 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe "C:\ProgramData\Sophos\ManagementServer\Backup\DataBackupRestore"\BackupRestore.proj /t:Restore /clp:NoSummary /p:SubSystem=all;DataSourceType=Database;ExcludeDB=False;LocationSpecific=False;SlientMode=False;DBServerInstance=' returned Error 1