SQL Backup failed with exit code: 507 SQL error code: 0

Hello, 

I just upgraded to the latest version of RedGate backup and now my automated restore has stopped working. I can restore this particular .sqb using a script generated by the RedGate GUI, however the (almost) same command in scheduled task it does not work. 

We have been using a wildcard search and the LATEST_FULL for a few years and this appears to be the problem.   I think it is something to do with this combination of wildcard search of the latest full backup as I can "break" the new scripted command by adding in "LATEST_FULL" these commands in. 

My input folder has a file in this format: 

I:\Transfers\Inbound\TestDb\FULL_(local)_TestDb_20180915_221500.sqb

Original (not-working)
EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE [TestDb] FROM DISK = ''I:\Transfers\Inbound\GXB_LIVE\FULL*TestDb*.sqb'' LATEST_FULL WITH MOVETO=''I:\Transfers\Inbound\TestDb\Done\'', ERASEFILES = 1b, MAILTO = ''[email protected]'', RECOVERY, DISCONNECT_EXISTING, REPLACE, ORPHAN_CHECK, LOGTO=''I:\Transfers\Inbound\TestDb_Restore_20181609.log'', CHECKDB = ''NO_INFOMSGS, ALL_ERRORMSGS''" 


Scripted code from RG GUI (working) 
EXECUTE master..sqlbackup 
'-SQL "RESTORE DATABASE [TestDb] 
FROM DISK = ''I:\Transfers\Inbound\TestDb\FULL*TestDb*.sqb'' 
WITH RECOVERY, MOVE ''lochdata'' TO ''H:\MSSQL12.MSSQLSERVER\MSSQL\DATA\TestDb_20181609.mdf'', 
MOVE ''lochdataLog'' TO ''F:\MSSQL12.MSSQLSERVER\MSSQL\Logs\TestDb_20181609_1.LDF''"'

Same code as above but including the LATEST_FULL (not working). 
EXECUTE master..sqlbackup 
'-SQL "RESTORE DATABASE [TestDb] 
FROM DISK = ''I:\Transfers\Inbound\TestDb\FULL*TestDb*.sqb'' LATEST_FULL 
WITH RECOVERY, MOVE ''lochdata'' TO ''H:\MSSQL12.MSSQLSERVER\MSSQL\DATA\TestDb_20181609.mdf'', 
MOVE ''lochdataLog'' TO ''F:\MSSQL12.MSSQLSERVER\MSSQL\Logs\TestDb_20181609_1.LDF''"'

TestDb is not a real db and is just used to test this.  I have tried my original command with and without a database called TestDb existing on the server. Both times I get the same result. 

Can anyone tell me what I have done wrong. 
Sign In or Register to comment.