Restore database backup over the network

前端 未结 10 1200
不思量自难忘°
不思量自难忘° 2021-01-30 03:58

How do you restore a database backup using SQL Server 2005 over the network? I recall doing this before but there was something odd about the way you had to do it.

相关标签:
10条回答
  • 2021-01-30 04:50

    You cannot do this through the SSMS GUI, but you can do it using a script. RESTORE DATABASE from DISK='\unc\path\filename' If you need this process automated, the best way is to setup a SQL Server Job and run it as a user with access to the file location.

    0 讨论(0)
  • 2021-01-30 04:50

    You can use the SP xp_cmdshell to map the networkdrive for sql server, after that it will show up in the file browsing window.

    EXEC xp_cmdshell 'NET USE Z: SERVERLOCATION PASSWORD /USER:DOMAIN\USERNAME'
    

    more info here: DB Restore from Network Drive

    Worked for me!

    0 讨论(0)
  • 2021-01-30 04:53

    Create a shared drive on machine that has the backups, say server1 has the backups in folder "Backups". Grant full control to the account running the SQL Server. On the Server that you want to restore to launch SSMS go restore database and select "From Device". In the "Locate Backup file-"Server"" dialog box and remove anything in the "Selected Path" field and in the "File Name" field supply full path so "\server\backups\db.bak". At least it worked for me when migrating from 05 to 08. Not the preferred method because any network hiccup can cause an issue with the restore.

    0 讨论(0)
  • 2021-01-30 04:53
    EXEC sp_configure 'show advanced options', 1
    GO
    

    -- Update currently configured values for advanced options.

    RECONFIGURE
    GO
    -- To enable xp_cmdshell
    EXEC sp_configure 'xp_cmdshell', 1
    GO
    

    -- Update currently configured values for advanced options.

    RECONFIGURE
    GO
    

    --This should be run on command prompt (cmd)

    NET USE Z: \\172.100.1.100\Shared Password /USER:administrator /Persistent:no
    

    then on SQL Server

    EXEC xp_cmdshell 'NET USE Z: \\172.100.1.100\Shared Password /USER:administrator /Persistent:no'
    

    --Afterwards drive Z: will be visible in Server Management studio, or just

    RESTORE DATABASE DB FROM DISK = 'Z:\DB.BAK'
    WITH REPLACE
    
    0 讨论(0)
提交回复
热议问题