What are the challenges you face when working across database platforms? Take the survey
Options

Restore log error

ThrallThrall Posts: 6
edited March 15, 2007 6:04AM in SQL Backup Previous Versions
Here is my code:

DECLARE @RestoreCommand VARCHAR(1000)
SET @RestoreCommand = N'-SQL "RESTORE LOG [MSN_Doc]
FROM DISK = ''c:\filename.sqb''
WITH MOVETO = ''D:\SQL_Data\''"'
PRINT @RestoreCommand
EXECUTE master..sqlbackup @RestoreCommand
SET @RestoreCommand = NULL

I get this error:

Warning 220: No log files found to be restored.

SQL Backup exit code: 220

I know that the file is there I checked th directory name and filename multiple times and had a co-worker to check it too so I am unsure of what the problem is?

Comments

  • Options
    peteypetey Posts: 2,358 New member
    Could you pls send me via private message or email, the value of the DISK parameter, and a list of the files in the folder where the backup file is found? Thanks.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Options
    Either I am missing something or it is odd behavior. But I try to do a log restore with redgate and it seems that with log restores that redgate does not support the "MOVE" native command with sql but it does support it with database restore?

    Is this true? If so how do you provide the same funtionality without the move command? MOVETO seems to have issues if there are other ldfs in the folder.
  • Options
    peteypetey Posts: 2,358 New member
    From the command you sent me, the backup file is located on a network share. Does the SQL Backup service startup user have access to that network share? Try running the following:

    EXEC master..sqlbackup '-sql "RESTORE SQBHEADERONLY FROM DISK = [<file name>]"'

    SQL Backup does not support the MOVE command with log restores, but does with full database restores. It was common for MOVE to be used with full database restores.

    If you really need to use MOVE with a log restore, I would suggest converting the log backup to the native format, then performing the log restore using SQL Server commands.

    MOVETO does not provide the same functionality as the native MOVE command. MOVETO moves a backup file from the original location specified in the DISK parameters, to the MOVETO folder.

    E.g.
    EXEC master..sqlbackup '-sql "RESTORE LOG pubs FROM DISK = &#91;&#91;b&#93;e:\backups\pubs\log.sqb&#91;/b&#93;&#93; WITH MOVETO = &#91;&#91;b&#93;e:\backups\pubs\processed&#91;/b&#93;&#93;, NORECOVERY " '
    
    SQL Backup will perform the trx log restore using the log.sqb file in e:\backups\pubs\. Once the restore has completed, log.sqb is moved to the e:\backups\pubs\processed folder.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
Sign In or Register to comment.