问题:

我使用SQL Server 2008 R2 Standard(版本10.50.1600.1)作为我的生产网站,使用SQL Server Express版本和Advanced Services(v10.50.1600.1)作为数据库。

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

错误:指定的演员表无效。 (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'

它会产生不同的错误

Msg 3154,Level 16,State 4,Line 1
备份集包含除现有“发布”数据库之外的数据库的备份。
Msg 3013,Level 16,State 1,Line 1
RESTORE DATABASE异常终止。

我已经交叉检查了版本。 它们似乎都与我匹配,如下图所示

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

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

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

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.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:Error: Specified cast is not valid.(SqlManagerUI)and when I try to restore the database using commandIt generates a different errorMsg 3154, Level 16, State 4, Line 1The backup set holds a backup of a database other than the existing ‘Publications’ database.Msg 3013, Level 16, State 1, Line 1RESTORE DATABASE is terminating abnormally.I have cross checked the versions.They all seem matching to me as shown in the image belowPreviously 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 regardingIssue was resolved as it seems .bak file was corrupt.When I tried it with a different file it worked.

问题:

我实际上正在尝试制作一个脚本(在Sql Server 2008中)以从一个备份文件还原一个数据库。 我做了以下代码,但出现错误-

Msg 3101, Level 16, State 1, Line 3
Exclusive access could not be obtained because 
the database is in use.
Msg 3013, Level 16, State 1, Line 3
RESTORE DATABASE is terminating abnormally.

我该如何解决这个问题?

IF DB_ID('AdventureWorksDW') IS NOT NULL 
BEGIN 
RESTORE DATABASE [AdventureWorksDW] 
FILE = N'AdventureWorksDW_Data' 
FROM  
DISK = N'C:\Program Files\Microsoft SQL Server\
MSSQL10_50.SS2008\MSSQL\Backup\AdventureWorksDW.bak' 
WITH  FILE = 1, 
MOVE N'AdventureWorksDW_Data' 
TO N'C:\Program Files\Microsoft SQL Server\
MSSQL10_50.SS2008\MSSQL\DATA\AdventureWorksDW.mdf', 
MOVE N'AdventureWorksDW_Log'  
TO N'C:\Program Files\Microsoft SQL Server\
MSSQL10_50.SS2008\MSSQL\DATA\AdventureWorksDW_0.LDF', 
NOUNLOAD,  STATS = 10 
END

I am actually trying to make a script (in Sql Server 2008) to restore one database from one backup file.I made the following code and I am getting an error -How do I fix this problem ?

问题:

当我尝试从本地环境连接生产数据库时,我收到以下错误。

之前我能够连接Production DB,但突然间我得到了跟随错误,有什么想法吗?

已成功与服务器建立连接,但在登录前握手期间发生错误。 (提供者:TCP提供者,错误:0 – 句柄无效。)

我试图在本地PC上运行asp.net网站,它有生产数据库的连接字符串,以下是我在本地环境中获取的错误的堆栈跟踪。

在MyWebsiteDAL.clsForumQuestion.SelectAll(Int32 CurrentPageIndex,Int32 PageSize)的D:\\ EDrive \\ My WebSites \\ MyWebsite \\ MyWebsite \\ MyWebsiteDAL \\ clsForumQuestion.cs:第8行,位于D的CodeConnect.Default.Page_Load(Object sender,EventArgs e): \\ EDrive \\ My WebSites \\ MyWebsite \\ MyWebsite \\ MyWebsite \\ Default.aspx.cs:System.Web.Util的System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,Object o,Object t,EventArgs e)第100行。 System.Web.UI.Page.ProcessRequestMain上的System.Web.UI.Control.LoadRecursive()处的System.Web.UI.Control.OnLoad(EventArgs e)上的CalliEventHandlerDelegateProxy.Callback(Object sender,EventArgs e)(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

知道这里可能出了什么问题吗?

I am getting following error when i am trying to connect Production DB from Local Environment.I was able to connect Production DB before, but suddenly i am getting following error, any idea?A connection was successfully established with the server, but then an error occurred during the pre-login handshake.(provider: TCP Provider, error: 0 – The handle is invalid.)I was trying to run asp.net website in local PC, which has connection string of Production DB, following is stack trace for error I am getting in local environment.at MyWebsiteDAL.clsForumQuestion.SelectAll(Int32 CurrentPageIndex, Int32 PageSize) in D:\\EDrive\\My WebSites\\MyWebsite\\MyWebsite\\MyWebsiteDAL\\clsForumQuestion.cs:line 821 at CodeConnect.Default.Page_Load(Object sender, EventArgs e) in D:\\EDrive\\My WebSites\\MyWebsite\\MyWebsite\\MyWebsite\\Default.aspx.cs:line 100 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)Any idea what might have gone wrong here?

问题:

尝试使用Management Studio连接到SQL Server 2008实例时,出现以下错误:

登录失败。 该登录名来自不受信任的域,不能与Windows身份验证一起使用。 (Microsoft SQL Server,错误:18452)

我可以使用SQL身份验证登录而不会出现问题。 我突然收到了这个错误。 我已启用混合模式身份验证。

有人对这个有经验么?

附加信息:Windows 2003 Server上的64位版本的SQL Enterprise Edition

When attempting to connect to a SQL Server 2008 Instance using Management Studio, I get the following error:Login failed.The login is from an untrusted domain and cannot be used with Windows authentication.(Microsoft SQL Server, Error: 18452)I can login using SQL Authentication without problem.I’ve been getting this error all of a sudden.I have Mixed Mode Authentication turned on.Does anyone have any experience with this?Additional Info: 64-bit version of SQL Enterprise Edition On Windows 2003 Server

问题:

我有4个sql脚本,我想在PostDeployment中的DACPAC中运行,但是当我尝试为其中3个构建VS项目时,我收到此错误:

Only one statement is allowed per batch. A batch separator, such as 'GO', might be required between statements.

这些脚本仅包含DB上不同表中的INSERT语句。 而且所有这些都是这样构建的

IF NOT EXISTS (SELECT 1 FROM dbo.Criteria WHERE Name = 'Mileage') INSERT INTO dbo.Criteria(Name) VALUES ('Mileage');

仅限于不同的表格和不同的数据。

我的问题是,当语法和操作方面的所有脚本相同时,为什么VS会抱怨其中的3个?

PS:在语句之间添加“GO”,因为错误表明没有做任何事情。

I have 4 sql scripts that I want to run in a DACPAC in PostDeployment, but when I try to build the VS project for 3 of them I get this error:The scripts contain only INSERT statements in different tables on the DB.And all of them are structured like soonly on different tables and with different data.My question is why is VS complaining about 3 of them when all the scripts are the same in terms of syntax and operations?PS: Adding ‘GO’ between statements as the error suggests doesn’t do anything.