Sqlserver 还原网络共享文件
sqlserver 还原网络共享文件
0. 需要使用 Sqlcmd 来执行
在命令行输入 sqlcmd。
1. 打开 xp_cmdshell 用来添加网络驱动器访问权限:
exec sp_configure 'show advanced options',1
go
reconfigure
go
2. 将 xp_cmdshell 权限打开
exec sp_configure 'xp_cmdshell',1
go
reconfigure
go
3. 增加 sqlserver 对共享路径的访问权限:
exec master..xp_cmdshell 'net use Y: \\192.168.10.100\temp mplh@2020 /user:192.168.10.100\Administrator'
go
reconfigure
go