SQL Server 数据库还原错误:指定的强制转换无效.(SqlManagerUI) [英] SQL Server database restore error: specified cast is not valid. (SqlManagerUI)

查看:35
本文介绍了SQL Server 数据库还原错误:指定的强制转换无效.(SqlManagerUI)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的生产网站使用的是 SQL Server 2008 R2 Standard(版本 10.50.1600.1),并且带有高级服务的 SQL Server Express 版 (v10.50.1600.1),用于我的本地主机作为数据库.

I am using SQL Server 2008 R2 Standard (version 10.50.1600.1) for my production website and SQL Server Express edition with Advanced Services (v10.50.1600.1) for my localhost as a database.

几天前我的 SQL Server 崩溃了,我不得不在我的本地主机上安装一个新的 2008 R2 Express 版本.当我恢复一些从 Express 版本获取的旧版本时,它工作正常,但是当我尝试从从生产服务器获取的 .bak 文件恢复数据库时,它会导致以下错误:

Few days back my SQL Server crashed and I had to install a new 2008 R2 Express version on my localhost. It worked fine when I restored some older versions taken from Express edition but when I try to restore database from .bak file which is taken from production server it is causing the following error:

错误:指定的演员表无效.(SqlManagerUI)

当我尝试使用命令

Use Master
Go
RESTORE DATABASE Publications
FROM DISK = 'C:\Publications.bak'
WITH MOVE 'Publications' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.mdf',--adjust path
MOVE 'AlPublications_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.ldf'

它产生一个不同的错误

消息 3154,级别 16,状态 4,第 1 行
备份集保存现有出版物"数据库以外的数据库的备份.
消息 3013,级别 16,状态 1,第 1 行
RESTORE DATABASE 异常终止.

我已经交叉检查了版本.如下图所示,它们似乎都适合我

I have cross checked the versions. They all seem matching to me as shown in the image below

以前我可以将数据库从标准版恢复到快速版,但现在失败了.我删除了数据库并尝试重新创建它.这也失败了.

Previously I was able to restore a database from standard version to express edition but now it fails. I deleted the database and tried to recreate it. That fails, too.

我不确定我做错了什么.我很感激这方面的帮助

I am not sure what I am doing wrong. I would appreciate help in this regarding

问题已解决,因为 .bak 文件似乎已损坏.当我用不同的文件尝试它时,它起作用了.

Issue was resolved as it seems .bak file was corrupt. When I tried it with a different file it worked.

推荐答案

GUI 有时变化无常.您在使用 T-SQL 时遇到的错误是因为您试图覆盖现有数据库,但未指定覆盖/替换现有数据库.以下可能有效:

The GUI can be fickle at times. The error you got when using T-SQL is because you're trying to overwrite an existing database, but did not specify to overwrite/replace the existing database. The following might work:

Use Master
Go
RESTORE DATABASE Publications
  FROM DISK = 'C:\Publications_backup_2012_10_15_010004_5648316.bak'
  WITH 
    MOVE 'Publications' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.mdf',--adjust path
    MOVE 'Publications_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.ldf'
, REPLACE -- Add REPLACE to specify the existing database which should be overwritten.

这篇关于SQL Server 数据库还原错误:指定的强制转换无效.(SqlManagerUI)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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