Restore database backup over the network

前端 未结 10 1212
不思量自难忘°
不思量自难忘° 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: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
    

提交回复
热议问题