如何使用c#将备份文件从本地系统还原到远程(MSSQL)系统? [英] How to restore backup file from local system to remote ( MSSQL) system using c# ?

查看:134
本文介绍了如何使用c#将备份文件从本地系统还原到远程(MSSQL)系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想将备份文件从本地系统还原到远程系统(MSSQL)
我已经完成了对本地系统的操作,但是没有问题,但是当我尝试将备份文件还原到远程时需要执行某些代码,是否有人这样做?

Hi ,

I would like to restore a backup file from local system to remote system (MSSQL)
I have done for local system there is no problem , But when i try to restore backup file to remote need to do certain code , Is anyone one have done this ?

推荐答案

基本上,即使远程执行恢复例程,恢复例程也相同.您连接到数据库并发出正确的命令.例如,如果您使用T-SQL进行还原,则可以执行还原 [ ^ ]语句.

问题在于,还原是由SQL Server服务执行的,因此它必须有权访问要还原的文件.如果文件位于网络中的某个位置(而不是数据库服务器上),则应使用UNC路径,因为该服务无法识别您的网络映射.另外,还要确保SQL Server服务在可以访问网络的凭据下运行.
Basically the restore routine is the same even if you do it remotely. You connect to the database and issue proper commands. For example if you''re using T-SQL for the restore you execute the RESTORE[^] statement.

The catch is that the restore is executed by the SQL Server service so it has to have access to the file being restored. If the file is located somewhere in the network (not on the database server) you should use UNC paths since the service isn''t aware of your network mappings. Also make sure that the SQL Server service is run under credentials that have access to the network.


这篇关于如何使用c#将备份文件从本地系统还原到远程(MSSQL)系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆