如何获得备份和恢复 [英] how to get backup and restore

查看:89
本文介绍了如何获得备份和恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我创建了学校管理应用程序。

我已安装在客户端计算机上。它运行成功。

如何使用c#应用程序在客户端机器上备份和恢复数据库。

客户机安装了sql express。

数据库在应用程序路径目录中。





尽快回复...

推荐答案

请参考以下链接:

以编程方式使用SMO备份和恢复SQL Server数据库 [ ^ ]

创建备份&在MSSQL中恢复数据库[ASP.NET / C#] [ ^ ]





- Amit
Refer the links below:
Backup and Restore SQL Server databases programmatically with SMO[^]
Create Backups & Restoring Database In MSSQL [ASP.NET / C#][^]


--Amit






即使您有数据库文件路径,也无法直接制作一份副本。你需要停止SQL服务器来做到这一点。如果您的数据库处于联机状态或您的服务正在运行,则可能无法执行还原操作。虽然备份将完成。



但我建议您仅在数据库脱机或服务未运行时执行备份/恢复。如果该机器上只有一个数据库,则停止sql服务不会有任何问题。在其他情况下,您需要使数据库脱机。



如果您在谷歌搜索,您可以轻松找到将数据库状态更改为离线的查询。 />


希望这些信息对您有所帮助。



谢谢

-Amit
Hi,

Even you have database file path you can not directly make a copy of that. you need to stop SQL server service to do that. If your database is online or your service is running then you may not able to perform restore operation. Although backup will be done.

But i suggest you to perform backup/restore only when your database is offline or your service is not running. If you have only single database on that machine then there will not be any problem with stopping sql service. In other case you need to make your database offline.

If you search in google, you can easily find the query to change state of your database to offline.

Hope this information will help you.

Thanks
-Amit


见这里:

在C#中备份SQL数据库 [ ^ ]


这篇关于如何获得备份和恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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