Restoring database by specifying network path for a local pc

  • I am using sql server 2008 r2. When i try to restore the database by using restore command

    RESTORE DATABASE [dbname] FROM DISK = N'\\PC91\D\backup.BAK' WITH FILE = 1, MOVE N'test' TO N'\\PC91\D\dbname.MDF', MOVE N'test_log' TO N'\\PC91\D\dbname_log.LDF', NOUNLOAD, STATS = 10

    I get error like

    Msg 3634, Level 16, State 1, Line 1

    The operating system returned the error '5(Access is denied.)' while attempting 'CreateFileW' on '\\PC91\D\dbname.MDF'.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.

    Here in above code i use network path,But this network path is network path of my pc where sql server exists.

    If i use below restore command then it works

    RESTORE DATABASE [dbname] FROM DISK = N'D:\backup.BAK' WITH FILE = 1, MOVE N'test' TO N'D:\dbname.MDF', MOVE N'test_log' TO N'D:\dbname_log.LDF', NOUNLOAD, STATS = 10

    This command also restores the database to same folder.So if i specify the network path why does error comes?

  • Hi

    Shares have permission specific problems/errors. Have you tried using the fully qualified server name directory instead? assuming you already rights on the machine/disks...

  • Which authentication are you using? If you have logged in using SA, ensure SA has full permissions on the folder.

Viewing 3 posts - 1 through 2 (of 2 total)

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