使用 SQL Server 2005 恢复数据库
我已使用旧服务器上的 SQL Server 将数据库备份到文件中。
现在我想将该文件恢复到我的新服务器上的新数据库中。
我创建了一个同名的数据库,但收到一条错误消息:
“备份集保存了现有‘*****’数据库以外的数据库的备份”
有什么想法吗?
谢谢
I have backed up a database into a file using SQL Server from my old server.
Now i would like to restore that file into a new database on my new server.
I created a DB with the same name , I am getting an error saying :
"The Backup set holds a backup of the database other than the existing '*****' database"
Any thoughts?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在还原中添加WITH REPLACE选项:
Add a WITH REPLACE option to your restore:
删除新数据库 - 它妨碍了您要恢复的数据库。
然后,当您尝试恢复旧数据库时,选择要恢复的文件,该名称将神奇地出现在 SSMS 的“至数据库”目标字段中。
Drop the new database - it's sitting in the way of the one you want to restore.
THen when you try to restore your old database, select the file to restore from, and the name will magically appear in the "to database" destination field in SSMS.
当您从备份恢复数据库时,您将在 SQL 实例上创建一个新数据库。如果该 SQL 实例上已存在具有该名称的数据库,您将收到错误消息 - 除非您选择覆盖任何现有数据库的选项,在这种情况下,旧数据库将被清除并替换。
When you restore a database from backup, you are creating a new database on the SQL instance. If a database by that name is already present on that SQL instance, you will get an error--unless you select the option to overwrite any existing database, in which case the old database will be wiped out and replaced.
我遇到了同样的问题,但即使使用 REPLACE 时,也会发生错误。我有一个与备份同名的空数据库,但问题是我用来备份的 .trn 文件有两个备份集,并且我选择从完整数据库和事务日志< /强>。我只选择了完整数据库并且它有效。
I was having the same issue, but even when putting WITH REPLACE, the error occurred. I had an empty database with the same name as the back up, but the problem was my .trn file I was using to backup from had two backup sets and I was choosing to restore from the full database AND the transaction log. I chose only the Full Database and it worked.