Restore script failing but using restore GUI works!

  • RESTORE DATABASE Test

       FROM DISK = 'E:\Scipts\FULLBACKUP.BAK'

       WITH RECOVERY,

            MOVE 'Data' TO 'F:\Microsoft SQL Server\MSSQL$TEST\Data\Test_Data.MDF',

            MOVE 'Log' TO 'F:\Microsoft SQL Server\MSSQL$TEST\Data\Test_Log.MDF.LDF'

    Server: Msg 3201, Level 16, State 2, Line 1

    Cannot open backup device 'E:\Scipts\FULLBACKUP.BAK'. Device error or device off-line. See the SQL Server error log for more details.

    Server: Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.

    Any ideas?

    I did this in EM GUI restore, it works!

     

  • My first guess would be that the GUI is using the user credentials of the service to perform that backup and your user does not have permissions to restore from that file.  This is just off the top of my head.

  • I would say the same as Shawn, it appears to be a permission issue. How are you running the script? Manually from Query Analzyer or as a job?

    Manually from Query Analyzer will use whatever login is used to log into QA.

    As a job it will use the login that SQL Server Agent service uses.

    -SQLBill

  • OOOOOOOOOOOOOOOOOOOOO.....Look at your Log file name extension.

    .mdf.ldf

    That could be the error right there.........typo's can cause all kinds of problems.

    2nd typo is in the E:\scipts....folder name. Shouldn't it be E:\scripts?????

    -SQLBill

  • Good eye, SQLBill.

    I made a typing typo here.

    I manually run the script from Query Analyzer that have a SA credentials.

    I checked and run this: Xp_cmdshell 'dir E:\Scipts\FULLBACKUP.BAK'

    output                                                                                                                                                                                                                                                         

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

     Volume in drive E is DATA

     Volume Serial Number is ACF9-147A

    NULL

     Directory of E:\Scipts

    NULL

    File Not Found

    NULL

    (7 row(s) affected)

    strange?

  • I would manually determine if that directory is called scripts or scipts.  I have a feeling that this is a type also.

    Try running : Xp_cmdshell 'dir E:\Scripts\FULLBACKUP.BAK' and see what you get.

  • output                                                                                                                                                                                                                                                         

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

    The system cannot find the file specified.

    NULL

    (2 row(s) affected)

  • Is this a remote server or a SAN drive?

    Can you manually ensure that it is connected?

    -SQLBill

  • it is a local server.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply