将数据库从远程服务器备份到本地计算机.

编程入门 行业动态 更新时间:2024-10-26 20:34:53
本文介绍了将数据库从远程服务器备份到本地计算机.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用smo从远程服务器进行数据库备份,但是我的问题是备份文件正存储在远程计算机上.我希望在本地计算机上而不是在sm中使用smo在C#中创建相同的备份文件. 我如何在C#中使用smo来实现这一目标.

Hi, i am taking backup of database from remote server using smo but my problem is backup file is getting stored on remote machine.i want same backup file should be created on local machine instead of remote machine in C# using smo. how can i achive this using smo in C#.

推荐答案

首先,通常在远程计算机上创建备份不是一个好主意.如果这只是一种情况,那就很好.但是,如果您要重复执行此操作,例如在网络故障的情况下将要发生的事情,则根本没有备份... 但是答案.这可以通过多种方式来完成.将备份直接备份到远程计算机最简单的方法是使用UNC路径.您可以在backup命令中使用它们,也可以预定义转储设备.要获取更多信息,请查看 sp_addumpdevice [ ^ ],尤其是示例B. First, typically it''s not a good idea to create a backup on remote computer. If this is just a single case, then fine. But if you''re going to do this repeatedly what''s going to happen for example in case of a network failure, you don''t have a backup at all... But to the answer. This can be done in numerous ways. The easiest way is direct the backup to remote computer is to use UNC paths. You can use them in the backup command or you can predefine a dump device. Te get more info, have a look at sp_addumpdevice[^] and especially example B.

SQL Server只能备份到物理连接到实际SQL Server计算机的驱动器.在任何情况下,您都无法将远程SQL Server备份到本地硬盘上-几乎不可能(无论在SMO中还是在SQL Server Management Studio中). 作为解决方法,可以使数据库调用主机中的命令行程序,该程序通过ftp发送文件,然后将其复制到某个共享文件夹中. SQL Server can only ever back up to a drive physically attached to the actual SQL Server machine. You cannot under any circumstances back up a remote SQL Server to your local harddisk - just not possible (neither in SMO, or in SQL Server Management Studio). As a workaround you can make that your database call a command line program in the host, that send the file by ftp, copy it to some shared folder.

更多推荐

将数据库从远程服务器备份到本地计算机.

本文发布于:2023-10-17 02:51:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1499556.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:备份   服务器   数据库   计算机

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!