如何在SSMS中还原数据库 [英] How to restore a database in SSMS

查看:88
本文介绍了如何在SSMS中还原数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我目前有一个数据库Live的备份,我上周想要恢复我的Dev。他们都在同一台服务器上运行恢复我得到一个错误



备份集包含现有'Dev'数据库以外的数据库的备份



我正在使用Sql Server管理工作室2012

Hi

I currently have a backup of a database Live which i took last week that i would like to restore over the Dev. they both on the same server and wen i run the restore i get an error

The backup set holds a backup of a database other than the existing 'Dev' database

I am using Sql Server management studio 2012

推荐答案

参考这个


我遇到了类似的情况。但我的方案是尝试将一个数据库的文件组备份还原到另一个数据库。无论如何,最好使用T-SQL脚本而不是SSMS。



请尝试以下代码



I have faced a similar situation. But my scenario was when trying to restore a file group backup of one database on to another. Anyways, it is better to use T-SQL script instead of SSMS.

Try the following code

RESTORE FILELISTONLY FROM DISK = 'SourceDB_FullBackup_File.bak'

RESTORE DATABASE DestinationDBName
FROM DISK = 'SourceDB_FullBackup_File.bak'
WITH
MOVE 'SourceDBLogicalName' TO 'DestinationDB.mdf' 
,MOVE 'SourceDB_log' TO 'DestinationDB_logfile.ldf' 
,REPLACE
,NORECOVERY





只有当你使用时才会使用NORECOVERY要在该数据库上还原更多备份。否则你只需使用`RECOVERY`



NORECOVERY to be used only when you have more backups to be restored on that database. Otherwise you can simply use `RECOVERY`


这篇关于如何在SSMS中还原数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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