简单&快速的sql server数据库备份和恢复

发布于 2024-09-07 10:14:33 字数 312 浏览 2 评论 0原文

我正在寻找一种简单的(如果可能的话最简单的)备份和恢复数据库的方法。

我想在一种状态下进行备份,然后在执行一些操作后返回到备份状态。

尝试了数据库 -> 任务 -> 备份...,然后是数据库 -> 任务 -> 恢复,但我总是收到错误:

Restore failed for...DBName

数据库“数据库名称”的日志尾部尚未备份...

所以,我想通过一个简单的操作分别进行备份和恢复,谁能告诉我 解决方案,无论是基于 GUI 还是不基于 GUI?

I'm looking for a simple (simplest if possible) way of backing up and restoring a database.

I want to do a backup in one state and then after doing some operations get back to the backed up state.

Tried Database->Tasks->Back Up... and then Database->Tasks->Restore but I always get an error with:

Restore failed for...DBName

The tail of the log for the database "database name" has not been backed up...

So, I want to back up and restore with one simple operation each, can one advise me
to a solution, be it GUI or not GUI based?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

长梦不多时 2024-09-14 10:14:33

使用 RESTORE 的 WITH REPLACE 选项命令:

REPLACE 选项会覆盖多个选项
重要的安全检查可恢复
正常执行。被重写的
检查如下:

  • 使用另一个数据库的备份来恢复现有数据库
    数据库。使用 REPLACE 选项,
    恢复允许您覆盖
    现有数据库与任何
    数据库位于备份集中,即使
    指定的数据库名称不同
    从记录中的数据库名称
    备份集。这可能会导致
    意外覆盖数据库
    不同的数据库。
  • 使用完整或批量日志恢复模型恢复数据库
    尚未进行尾日志备份的地方
    已采取且 STOPAT 选项未
    使用过。使用 REPLACE 选项,您
    可能会失去承诺的工作,因为
    最近写入的日志尚未被写入
    已备份。
  • 覆盖现有文件。例如,一个错误可能会导致
    覆盖错误类型的文件,
    例如 .xls 文件,或者正在处理的文件
    被另一个不存在的数据库使用
    在线的。任意数据丢失是
    如果现有文件是可能的
    被覆盖,虽然恢复了
    数据库已完成。


MSDN 中的恶心部分也涵盖了该主题,请参阅不使用尾日志备份进行恢复< /a>,其中包含涵盖 Management Studio 方案(即您正在使用的工具)的“操作方法”文章的链接。

Use the WITH REPLACE option of the RESTORE command:

The REPLACE option overrides several
important safety checks that restore
normally performs. The overridden
checks are as follows:

  • Restoring over an existing database with a backup taken of another
    database. With the REPLACE option,
    restore allows you to overwrite an
    existing database with whatever
    database is in the backup set, even if
    the specified database name differs
    from the database name recorded in the
    backup set. This can result in
    accidentally overwriting a database by
    a different database.
  • Restoring over a database using the full or bulk-logged recovery model
    where a tail-log backup has not been
    taken and the STOPAT option is not
    used
    . With the REPLACE option, you
    can lose committed work, because the
    log written most recently has not been
    backed up.
  • Overwriting existing files. For example, a mistake could allow
    overwriting files of the wrong type,
    such as .xls files, or that are being
    used by another database that is not
    online. Arbitrary data loss is
    possible if existing files are
    overwritten, although the restored
    database is complete.

The topic is also covered at nauseam in MSDN see Restoring Without Using a Tail-Log Backup, which contains the links for 'How to' articles that cover Management Studio scenarios (ie. the tool you're using).

两个我 2024-09-14 10:14:33

您似乎已设置差异备份。它比恢复完整备份稍微复杂一些。

http://msdn.microsoft.com/en-us/library/ms175510。 aspx

通过执行完整备份,您将破坏 DBA 设置的备份链,因此在破坏 DBA 的备份集之前,最好先咨询一下 DBA。

编辑了非常有用的评论:

在进行备份时,您应该使用 COPY_ONLY 选项,这样就不会破坏备份链。

http://msdn.microsoft.com/en-us/library/ms186865。 ASPX

It looks like you have Differential Backups set up. It is slightly more complicated than restoring a Full backup.

http://msdn.microsoft.com/en-us/library/ms175510.aspx

By doing a Full backup, you are going to break the chain of backups that the DBA set up, so it would be a good idea to check first with the DBA before you break his backup set.

Edited for very helpful comments:

You should use the COPY_ONLY option when you do a backup so that you do not break the chain of backups.

http://msdn.microsoft.com/en-us/library/ms186865.aspx

送君千里 2024-09-14 10:14:33

恢复时需要勾选“覆盖现有数据库”选项,否则会失败。

MSSQL 2005 及更高版本功能快照,听起来它很适合您的要求。

When restoring you need to check the option to Overwrite existing database, if you are, otherwise it will fail.

MSSQL 2005 and up features snapshots, sounds like it suits your requirements nicely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文