This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DataBackupRestore fails

I  upgraded old server from 4.5 to 5.2, followed the documentation to migrate to new server via: http://www.sophos.com/en-us/medialibrary/PDFs/documentation/sec_52_mgeng.pdf

In section 8, for the DataBackupRestore, I get this below.  Any help would be much appreciated.

Thanks,

-Ron

-----------------------------------------------------------------------------------------------------

Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.296]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 3/18/2013 10:11:29 AM.
Copy file C:\ProgramData\Sophos\ManagementServer\Backup\Databases\SOPHOSENC52.ba
k successful.

C:\Users\All Users\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S
"(local)\SOPHOS" -d "master" -b -Q "IF EXISTS (SELECT name FROM master.dbo.sysd
atabases WHERE name = N'SOPHOSENC52') BEGIN ALTER DATABASE SOPHOSENC52 SET OFFLI
NE WITH ROLLBACK AFTER 5 END"
Attempting restore with SQL2012 backup schema.

C:\Users\All Users\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S
"(local)\SOPHOS" -d "master" -b -Q "CREATE TABLE #backupSetInfo (BackupName NVA
RCHAR(128),BackupDescription NVARCHAR(255),BackupType smallint,ExpirationDate da
tetime,Compressed tinyint,Position smallint,DeviceType tinyint,UserName NVARCHAR
(128),ServerName NVARCHAR(128),DatabaseName NVARCHAR(128),DatabaseVersion INT,Da
tabaseCreationDate datetime,BackupSize numeric(20,0),FirstLSN numeric(25,0),Last
LSN numeric(25,0),CheckpointLSN numeric(25,0),DatabaseBackupLSN numeric(25,0),Ba
ckupStartDate datetime,BackupFinishDate datetime,SortOrder smallint,CodePage sma
llint,UnicodeLocaleId INT,UnicodeComparisonStyle INT,CompatibilityLevel tinyint,
SoftwareVendorId INT,SoftwareVersionMajor INT,SoftwareVersionMinor INT,SoftwareV
ersionBuild INT,MachineName NVARCHAR(128),Flags INT,BindingID uniqueidentifier,R
ecoveryForkID uniqueidentifier,Collation NVARCHAR(128),FamilyGUID uniqueidentifi
er,HasBulkLoggedData INT,IsSnapshot INT,IsReadOnly INT,IsSingleUser INT,HasBacku
pChecksums INT,IsDamaged INT,BeginsLogChain INT,HasIncompleteMetaData INT,IsForc
eOffline INT,IsCopyOnly INT,FirstRecoveryForkID uniqueidentifier,ForkPointLSN nu
meric(25,0),RecoveryModel NVARCHAR(128),DifferentialBaseLSN numeric(25,0),Differ
entialBaseGUID uniqueidentifier,BackupTypeDescription NVARCHAR(128),BackupSetGUI
D uniqueidentifier,CompressedBackupSize INT,containment tinyint); INSERT #backup
SetInfo EXEC('RESTORE HEADERONLY FROM DISK=N' + '''C:\ProgramData\Sophos\TempDat
a\SOPHOSENC52.bak'''); DECLARE @backupsetnumber smallint; SET @backupsetnumber =
(SELECT TOP(1) Position FROM #backupSetInfo ORDER BY BackupFinishDate DESC); RE
STORE DATABASE SOPHOSENC52 FROM DISK = 'C:\ProgramData\Sophos\TempData\SOPHOSENC
52.bak' WITH FILE = @backupsetnumber, REPLACE, RECOVERY; DROP TABLE #backupSetIn
fo;"
Msg 213, Level 16, State 7, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
Column name or number of supplied values does not match table definition.
Msg 3013, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
RESTORE HEADERONLY is terminating abnormally.
Msg 3250, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
The value '0' is not within range for the FILE parameter.
Msg 3013, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
RESTORE DATABASE is terminating abnormally.
Attempting restore with SQL2008/SQL2008R2 backup schema.

C:\Users\All Users\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S
"(local)\SOPHOS" -d "master" -b -Q "CREATE TABLE #backupSetInfo (BackupName NVA
RCHAR(128),BackupDescription NVARCHAR(255),BackupType smallint,ExpirationDate da
tetime,Compressed tinyint,Position smallint,DeviceType tinyint,UserName NVARCHAR
(128),ServerName NVARCHAR(128),DatabaseName NVARCHAR(128),DatabaseVersion INT,Da
tabaseCreationDate datetime,BackupSize numeric(20,0),FirstLSN numeric(25,0),Last
LSN numeric(25,0),CheckpointLSN numeric(25,0),DatabaseBackupLSN numeric(25,0),Ba
ckupStartDate datetime,BackupFinishDate datetime,SortOrder smallint,CodePage sma
llint,UnicodeLocaleId INT,UnicodeComparisonStyle INT,CompatibilityLevel tinyint,
SoftwareVendorId INT,SoftwareVersionMajor INT,SoftwareVersionMinor INT,SoftwareV
ersionBuild INT,MachineName NVARCHAR(128),Flags INT,BindingID uniqueidentifier,R
ecoveryForkID uniqueidentifier,Collation NVARCHAR(128),FamilyGUID uniqueidentifi
er,HasBulkLoggedData INT,IsSnapshot INT,IsReadOnly INT,IsSingleUser INT,HasBacku
pChecksums INT,IsDamaged INT,BeginsLogChain INT,HasIncompleteMetaData INT,IsForc
eOffline INT,IsCopyOnly INT,FirstRecoveryForkID uniqueidentifier,ForkPointLSN nu
meric(25,0),RecoveryModel NVARCHAR(128),DifferentialBaseLSN numeric(25,0),Differ
entialBaseGUID uniqueidentifier,BackupTypeDescription NVARCHAR(128),BackupSetGUI
D uniqueidentifier,CompressedBackupSize INT); INSERT #backupSetInfo EXEC('RESTOR
E HEADERONLY FROM DISK=N' + '''C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak'''
); DECLARE @backupsetnumber smallint; SET @backupsetnumber = (SELECT TOP(1) Posi
tion FROM #backupSetInfo ORDER BY BackupFinishDate DESC); RESTORE DATABASE SOPHO
SENC52 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 PSCVM-SOPHOS-02\SOPHOS, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSS
QL\DATA\SOPHOSENC52.mdf" failed with the operating system error 3(The system can
not find the path specified.).
Msg 3156, Level 16, State 3, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
File 'SOPHOSENC51' cannot be restored to 'C:\Program Files\Microsoft SQL Server\
MSSQL.1\MSSQL\DATA\SOPHOSENC52.mdf'. Use WITH MOVE to identify a valid location
for the file.
Msg 5133, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSS
QL\DATA\SOPHOSENC52.ldf" failed with the operating system error 3(The system can
not find the path specified.).
Msg 3156, Level 16, State 3, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
File 'SOPHOSENC51_log' cannot be restored to 'C:\Program Files\Microsoft SQL Ser
ver\MSSQL.1\MSSQL\DATA\SOPHOSENC52.ldf'. Use WITH MOVE to identify a valid locat
ion for the file.
Msg 3119, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
Problems were identified while planning for the RESTORE statement. Previous mess
ages provide details.
Msg 3013, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
RESTORE DATABASE is terminating abnormally.
Attempting restore with SQL2005 backup schema.

C:\Users\All Users\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S
"(local)\SOPHOS" -d "master" -b -Q "CREATE TABLE #backupSetInfo (BackupName NVA
RCHAR(128),BackupDescription NVARCHAR(255),BackupType smallint,ExpirationDate da
tetime,Compressed tinyint,Position smallint,DeviceType tinyint,UserName NVARCHAR
(128),ServerName NVARCHAR(128),DatabaseName NVARCHAR(128),DatabaseVersion INT,Da
tabaseCreationDate datetime,BackupSize numeric(20,0),FirstLSN numeric(25,0),Last
LSN numeric(25,0),CheckpointLSN numeric(25,0),DatabaseBackupLSN numeric(25,0),Ba
ckupStartDate datetime,BackupFinishDate datetime,SortOrder smallint,CodePage sma
llint,UnicodeLocaleId INT,UnicodeComparisonStyle INT,CompatibilityLevel tinyint,
SoftwareVendorId INT,SoftwareVersionMajor INT,SoftwareVersionMinor INT,SoftwareV
ersionBuild INT,MachineName NVARCHAR(128),Flags INT,BindingID uniqueidentifier,R
ecoveryForkID uniqueidentifier,Collation NVARCHAR(128),FamilyGUID uniqueidentifi
er,HasBulkLoggedData INT,IsSnapshot INT,IsReadOnly INT,IsSingleUser INT,HasBacku
pChecksums INT,IsDamaged INT,BeginsLogChain INT,HasIncompleteMetaData INT,IsForc
eOffline INT,IsCopyOnly INT,FirstRecoveryForkID uniqueidentifier,ForkPointLSN nu
meric(25,0),RecoveryModel NVARCHAR(128),DifferentialBaseLSN numeric(25,0),Differ
entialBaseGUID uniqueidentifier,BackupTypeDescription NVARCHAR(128),BackupSetGUI
D uniqueidentifier); INSERT #backupSetInfo EXEC('RESTORE HEADERONLY FROM DISK=N'
+ '''C:\ProgramData\Sophos\TempData\SOPHOSENC52.bak'''); DECLARE @backupsetnumb
er smallint; SET @backupsetnumber = (SELECT TOP(1) Position FROM #backupSetInfo
ORDER BY BackupFinishDate DESC); RESTORE DATABASE SOPHOSENC52 FROM DISK = 'C:\Pr
ogramData\Sophos\TempData\SOPHOSENC52.bak' WITH FILE = @backupsetnumber, REPLACE
, RECOVERY; DROP TABLE #backupSetInfo;"
Msg 213, Level 16, State 7, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
Column name or number of supplied values does not match table definition.
Msg 3013, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
RESTORE HEADERONLY is terminating abnormally.
Msg 3250, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
The value '0' is not within range for the FILE parameter.
Msg 3013, Level 16, State 1, Server PSCVM-SOPHOS-02\SOPHOS, Line 1
RESTORE DATABASE is terminating abnormally.
Failed to restore

C:\Users\All Users\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S
"(local)\SOPHOS" -d "master" -b -Q "ALTER DATABASE SOPHOSENC52 SET ONLINE"

C:\Users\All Users\Sophos\ManagementServer\Backup\DataBackupRestore>sqlcmd -E -S
"(local)\SOPHOS" -d "SOPHOSENC52" -b -i ResetUserMappings.sql
Process 'C:\Users\All Users\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.60
Process 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe "C:\Users\A
ll Users\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

:38503


This thread was automatically locked due to age.
  • Hello JoshR,

    DataBackupRestore is looking for the old SQL location

    it isn't - all it does (in conjunction with the database) is identifying the most recent backup in the file and calling the SQL RESTORE DATABASE command, the (original) location is contained in the backup. RESTORE DATABASE requires the location to be writeable and in particular the path(s) must exist. (Re-)creating the original path can be one way to make the restore work - but then, it might not be possible (the files might have been on a drive which doesn't exist in the current environment) or undesirable (when you intend to use a dedicated drive for the new installation). Thus the command would need considerably more logic and extra parameters and even then might not work in all scenarios. Similar deliberations when the database to restore does not yet exist - should the original location be created or the command amended to restore WITH MOVE to the new default location? 

    Christian

    :43711
  • Did you see my solution for this issue in another thread ?

    /search?q= 43371

    :43719