我正在寻找一种简单(如果可能的话是最简单的)备份和恢复数据库的方法。
我想在一种状态下进行备份,然后在执行一些操作后返回备份状态。
尝试了数据库->任务->备份...然后数据库->任务->恢复,但我总是收到以下错误:
恢复失败...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/