Restore - Latest Full -- Errors

rayherringrayherring Posts: 30 Bronze 4
edited January 28, 2016 10:02AM in SQL Backup Previous Versions
Hi All,
I don't understand why I receive an error from this code.
I am using SQL Backup 7 (Server Components 7.7.0.7), Widows 2008R2EE, SQL2008R2 Std.
This version of the script works fine.
EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE Test_SIR25
	FROM DISK = ''X:TestRestoresSim-SQL-02MSSQLSIR25Sim-SQL-02_SIR25_FULL_20160109_223000.sqb''
	WITH NoRECOVERY, Replace
	, MOVE ''SIR25_Sys''		TO ''S:DB_RestoreTestSIR25_Data.mdf''
	, MOVE ''SIR25_Blob_A''	TO ''S:DB_RestoreTestSIR25_Blob_A.ndf''
	, MOVE ''SIR25_Data_A''	TO ''S:DB_RestoreTestSIR25_Data_A.ndf''
	, MOVE ''SIR25_Index_A''	TO ''S:DB_RestoreTestSIR25_Index_A.ndf''
	, MOVE ''sir25_log''		TO ''L:TestRestoreSIR25_Log.ldf''
	"';
This version fails immediately with the error message "Error 507: No valid backup sets found from provided folder(s)."
EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE Test_SIR25
	FROM DISK = ''X:TestRestoresSim-SQL-02MSSQLSIR25Sim-SQL-02_SIR25_FULL_*.sqb'' Latest_Full
	WITH NoRECOVERY, Replace
	, MOVE ''SIR25_Sys''		TO ''S:DB_RestoreTestSIR25_Data.mdf''
	, MOVE ''SIR25_Blob_A''	TO ''S:DB_RestoreTestSIR25_Blob_A.ndf''
	, MOVE ''SIR25_Data_A''	TO ''S:DB_RestoreTestSIR25_Data_A.ndf''
	, MOVE ''SIR25_Index_A''	TO ''S:DB_RestoreTestSIR25_Index_A.ndf''
	, MOVE ''sir25_log''		TO ''L:TestRestoreSIR25_Log.ldf''
	"';
As you see, I just replaced the Date/Time string with * and appended Latest_Full. I know I have used this script before. It is part of a semi-automated process to do test restores of production databases from tape archives. I don't understand why it fails now.

Any Suggestions?
Thanks,
Ray Herring

Comments

  • peteypetey Posts: 2,358 New member
    Most likely cause of the error is because the backup files were not made for the Test_SIR25 database, but for a database named SIR25. If that is indeed the case, you need to use the SOURCE option to provide the original database name, otherwise SQL Backup will look for Test_SIR25 backups to restore from.

    E.g

    EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE Test_SIR25 FROM DISK = ''X:TestRestoresSim-SQL-02MSSQLSIR25Sim-SQL-02_SIR25_FULL_*.sqb'' SOURCE = [SIR25] LATEST_FULL WITH NoRECOVERY, ...
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Well Duh!%#. :oops:
    All I had to do was read one or two sentences farther in the documentation and I would have answered my own question (plus saved a lot of time :) )

    Thanks for the assistance.
    Ray Herring
Sign In or Register to comment.