[SQL] 命令远程恢复数据库

sp_configure 'show advanced options', 1; 
RECONFIGURE;
GO
sp_configure 'xp_cmdshell', 1; 
RECONFIGURE;
GO
EXEC master..xp_cmdshell 'net use  \\70.2.199.153\1111 sds@3150 /user:ARISAMDEV153\spfarm';

--RESTORE DATABASE ArisamCafe FILE = N'ArisamCafe' FROM  DISK = N'\\70.2.199.153\1111\ArisamCafe_20160824.bak'
--WITH MOVE 'ArisamCafe_Data' TO 'D:\Microsoft SQL Server\MSSQL10_50.SPS\MSSQL\DATA\ArisamCafe_Data.mdf',
--   MOVE 'ArisamCafe_Log' TO 'D:\Microsoft SQL Server\MSSQL10_50.SPS\MSSQL\DATA\ArisamCafe_Log.ldf' ,REPLACE;
--GO
RESTORE DATABASE ArisamDB FILE = N'ArisamDB' FROM  DISK = N'\\70.2.199.153\1111\ArisamDB_20160824.bak'
WITH MOVE 'ArisamDB' TO 'D:\Microsoft SQL Server\MSSQL10_50.SPS\MSSQL\DATA\ArisamDB.mdf',
    MOVE 'ArisamDB2' TO 'D:\Microsoft SQL Server\MSSQL10_50.SPS\MSSQL\DATA\ArisamDB2.mdf',
   MOVE 'ArisamDB_log' TO 'D:\Microsoft SQL Server\MSSQL10_50.SPS\MSSQL\DATA\ArisamDB_log.ldf',
   MOVE 'ArisamDB_log2' TO 'D:\Microsoft SQL Server\MSSQL10_50.SPS\MSSQL\DATA\ArisamDB_log2.ldf' ,REPLACE;
GO

 

 

posted @ 2016-08-25 14:34  Areas  阅读(376)  评论(0编辑  收藏  举报