===================================sql
附加數據庫 對於 服務器「WIN-xxxxxxx」失敗。 (Microsoft.SqlServer.Smo)數據庫
------------------------------
有關幫助信息,請單擊: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=附加數據庫+Server&LinkId=20476服務器
------------------------------
程序位置:ide
在 Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)
在 Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabaseData.PrimaryFile.Attach()
在 Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.SendDataToServer()io
===================================ast
執行 Transact-SQL 語句或批處理時發生了異常。 (Microsoft.SqlServer.ConnectionInfo)file
------------------------------
程序位置:程序
在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
在 Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
在 Microsoft.SqlServer.Management.Smo.Server.AttachDatabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions)
在 Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)im
===================================技術
恢復期間出錯,致使數據庫 'SQL_HB_D001' (數據庫 ID 7)沒法從新啓動。請診斷並糾正這些恢復錯誤,或者從已知的正確備份中還原。若是沒法更正錯誤,或者爲意外錯誤,請與技術支持人員聯繫。
沒法打開新數據庫 'SQL_HB_D001'。CREATE DATABASE 停止。 (.Net SqlClient Data Provider)
------------------------------
有關幫助信息,請單擊: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=3414&LinkId=20476
------------------------------
服務器名稱: (local)
錯誤號: 3414
嚴重性: 21
狀態: 2
行號: 1
------------------------------
程序位置:
在 Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
在 Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
===================================
===================================
===================================
修復辦法以下:
--一、要先將原文件保存一份後,在SQL Server中刪除原數據,再新建一個同名數據庫。--二、執行以一段代碼:use Master go alter database SQL_HB_D001 set emergency --將置疑數據庫設爲「緊急」,SQL_HB_D001是數據庫名go--三、停用服務器,將新文件用保存的原文件覆蓋,再啓用服務器。--四、執行以一段代碼:use Master declare @databasename varchar(255) set @databasename= 'SQL_HB_D001' --你的.mdf文件文件名 exec sp_dboption @databasename, N'single', N'true' --將目標數據庫置爲單用戶狀態 dbcc checkdb(@databasename,REPAIR_ALLOW_DATA_LOSS) dbcc checkdb(@databasename,REPAIR_REBUILD) exec sp_dboption @databasename, N'single', N'false'