何时以及如何在Sql Server中使用还原命令 [英] When And How I Must Use Restore Command In Sql Server

查看:93
本文介绍了何时以及如何在Sql Server中使用还原命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



我正在使用sqlserver 2008和c#为商店创建应用程序。对于这个商店,我希望有时例如每周用户可以将他的数据库信息备份到计算机硬盘中的文件,他可以恢复它们。我可以使用sql命令将数据库备份到硬盘但我的问题是当我想恢复该文件。实际上我不知道什么时候必须恢复备份文件。当我必须使用restore命令时,请说我。什么条件必须在那里?



谢谢大家;

hi all.

i am creating an application for a shop with sqlserver 2008 and c#. for this shop i want sometimes for example in every week user can backup his database information to a file in computer hard disk and he can restore them. i can use sql command's to backup database to hard disk but my problem is when i want to restore that file. in fact i do not know when i must restore backup file. please say me when i must use restore command. and what condition must be in there?

thank you all;

推荐答案

这解释了怎么做来自C#:用C#备份SQL数据库 [ ^ 并且可能有帮助。



但在正常情况下你永远不应该使用恢复:一旦你的备份系统到位并经过测试,你只需要它就可以了一个问题和实时数据库已损坏或丢失 - 因为数据库还原操作旨在将数据库恢复到它的最后一个已知良好状态:您备份它的点。为此,它会抛弃现有数据,并将其替换为执行备份时的数据。出于这个原因,你应该定期(和频繁)备份:每日都很好,但每周都有可能 - 这取决于你可以承受多少数据丢失或必须重新输入。



优先考虑,至少要运行祖父/父/子备份方案:如果儿子有问题,你可以使用父亲,等等。并且将备份存储在远离它们复制的主要文件中,最好是在现场之外!



有一次你希望你必须进行恢复就是测试你的备份,并确保它们仍在工作:这是值得每年刻意做几次,只是为了确定! (最好在刚刚完成一组特别好的备份之后立即进行!)
This explains how to do it from C#: Backing up an SQL Database in C#[^] and may help.

But under normal circumstances you should never use Restore: once your backup system is in place and tested, you would only need it if there has been a problem and the "live" database is corrupted or missing - because a database restore operation is designed to put a database back to it's last known good state: the point at which you backed it up. To do this, it throws away the existing data and replaces it with the data as it was when the backup was taken. For this reason, you should take regular (and frequent) backups: Daily is good, but weekly may be possible - it depends how much data you can afford to lose or have to reenter.

By preference, operate a Grandfather / Father / Son backup scheme as a minimum: if the son is faulty, you can use the Father, and so on. And store backups away from the primary they were copied from, preferably off site!

The one time you should hope you ever have to do a restore is to test your backups, and make sure they are still working: and that is worth doing deliberately a couple of times a year, just to be sure! (Preferably immediately after a extra special set of really good backups have just been done!)


这篇关于何时以及如何在Sql Server中使用还原命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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