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

标签 sql sql-server-2005 sql-server-2008 backup restore

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

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

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

恢复失败...DBName

数据库“数据库名”的日志尾部没有备份...

所以,我想用一个简单的操作来备份和恢复,谁能告诉我 解决方案,是基于 GUI 还是不基于 GUI?

最佳答案

使用 WITH REPLACE RESTORE 命令的选项:

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.

MSDN 中的nausem 也涵盖了该主题,请参阅Restoring Without Using a Tail-Log Backup。 ,其中包含涵盖 Management Studio 方案(即您正在使用的工具)的“操作方法”文章的链接。

关于sql - 简单快速的 sql server 数据库备份和恢复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3102273/

相关文章:

sql-server - T-SQL 是否有用于连接字符串的聚合函数?

c# - 类型 '_Default' 已经包含一个定义

sql-server - Sql Server 2008 R2 DC 插入性能更改

php - SQL 错误号 #1215 - 无法添加外键

mysql - sql group by 带分组条件

sql - 错误 : SubQuery returns more than one records

Mysql SELECT 并返回多行,但在存在时更喜欢一个列值而不是另一个列值

sql-server-2005 - 如何在字母数字列上正确执行 max()

sql - 如何在SQL Server 2005中设置数据库的默认架构?

sql - 在 SQL Server 2008 中使用分组依据和排序依据检索结果时出错