Restore DB From Network Drive

  • Hi All,

    I am trying to restore database from an backup file which is located on development server.

    Steps I followed.

    1.Created share path and gave full access in development server.

    2.Map the share path of development to drive in my local server with name Z.

    3.Then I executed this statement to make SQL server access the mapped drive

    exec xp_cmdshell 'net use Z: \\servername\Share password/user:domain\username'

    and the error was System error 85 has occurred.The local device name is already in use.

    Astonishing thing is that when i issued dir Z:\*.bak in command line prompt,it listed all the bakup files

    but same thing queried in sql server using xp_cmdshell (exec xp_cmdshell 'dir Z:\*.sql')it returned

    The system cannot find the path specified.

    Why this discrepancy anything I missed out please suggest.

  • Don't use a mapped drive, use the UNC path instead.

    Give the sql server user the appropriate permissions on that path and run the restore command.

    -- Gianluca Sartori

  • Thanks,Could you please guide me with an example,it will be grateful to me.

  • RESTORE DATABASE yourDatabaseName FROM DISK = '\\UNCPATH\yourackupFile.bak' WITH RECOVERY;

    -- Gianluca Sartori

  • How to create UNC Path?

  • Give the full path ie \\servername\c$\folder\backup.bak

  • the UNC path is the path to the shared folder,

    so in the example you provided it will be

    restore database ######### from disk = '\\servername\Share\##.bak'

  • Yes I tried,and it doesn't worked for me as the domain of the development server differs.

  • Two options:

    1) set up domain trust

    2) download the file locally with FTP or SMB and then restore from local disk

    -- Gianluca Sartori

  • along with trusts in place, try using the FQDN so \\server.domain.com\share

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

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