2017-03-16 107 views
0

嘗試在SSMS 2012中打開SQL文本編輯器時出現奇怪的錯誤。錯誤引發任何選項,如新建查詢,修改存儲過程,選擇前1000行,任何打開腳本編輯器的操作。當我進入工具/選項/文本編輯器/ [任何語言]程序中斷並顯示Windows錯誤。嘗試打開SQL文本編輯器時發生SQL Server 2012 Management Studio錯誤

這是奇怪的錯誤。我複製了錯誤細節,但對我來說沒有任何意義。

This the weird error

===================================

發生內部錯誤。附加信息: ''。 (mscorlib程序)

------------------------------項目地點:

在 System.ComponentModel。 Composition.Hosting.ImportEngine.InPrerequisiteLoop() 在 System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportsStateMachine(partManager partManager,ComposablePart部分)在 System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImports(partManager partManager,ComposablePart部分,布爾shouldTrackImports)在 System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImports(ComposablePart 部分)在 System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine 發動機,ComposablePart部分,ExportDefinition定義)在 System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(CatalogPart 部分,ExportDefinition出口,布爾isSharedPart )在 System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore() 在System.ComponentModel.Composition.Primitives.Export.get_Value()
在 System.ComponentModel.Composition.ExportServices.GetCastedExportedValue [T](導出 導出)在 System.ComponentModel.Composition.Hosting.ExportP rovider.GetExportedValueCore [T](字符串 contractName,ImportCardinality基數)在 System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValue [T](字符串 contractName)在 System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValueT 在 Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetServiceT 處 微軟 Microsoft.VisualStudio.Editor.Implementation.VsDocDataAdapter.SetSite(對象 pUnkSite)在 Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.SetSite(對象 pUnkSite) .SqlServer.Management.UI.VSIntegration.ShellTextBuffer.SetSite(Object 的ServiceProvider)處 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptEditorControl.Initialize(對象 SP) Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextEditorControl.CreateAndInitTextBuffer(對象 SP)在 Microsoft.SqlServer .Management.UI.VSIntegration.Editors.ScriptAndResultsEditorControl.Initialize(Object sp)at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.SqlScriptEditorControl。在初始化時 Microsoft.SqlServer.Management.UI.VSIntegration.Editors Microsoft.SqlServer.Management.UI.VSIntegration.Editors.SqlScriptEditorControl.CreateInstance(對象 的ServiceProvider,布爾withEncoding,字符串的綽號)(對象 SP,字符串的綽號) .EditorFactorySql.CreateEditorInstance(的IServiceProvider 的ServiceProvider,布爾storeActiveConnIfNeeded,字符串綽號)
在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.EditorFactoryBase.Microsoft.VisualStudio.Shell.Interop.IVsEditorFactory.CreateEditorInstance(UInt32的 createFlags,字符串名字,String physicalView,IVsHierarchy 層次結構,UInt32 itemId,IntPtr existingDocData,IntPtr & docViewIntPtr,IntPtr的& docDataIntPtr,字符串&字幕,的Guid & cmdUIGuid,的Int32 &結果)在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(的Int32 的errorCode,IntPtr的errorInfo中)在 Microsoft.SqlServer.Management.UI。 VSIntegration.Editors.ScriptFactory.CreateNewScript(字符串 strFullPathToScript,IVsProject projectToAddScriptTo, UIConnectionGroupInfo connectionInfoList,的IDbConnection liveCon, 字符串ROOTNAME)在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(字符串 strFullPathToScript,IVsEx ternalFilesManager extFileMgr, UIConnectionGroupInfo connectionInfoList,的IDbConnection liveCon, 字符串ROOTNAME)維持在 微軟 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(字符串 strFullPathToScript,UIConnectionGroupInfo connectionInfoList, 的IDbConnection liveCon,字符串fileRoot)。 SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(字符串 strFullPathToScript,UIConnectionInfo Cl,的IDbConnection liveCon)在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NewQueryMenuHandler.Invoke() 在 Microsoft.SqlServer。 Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItemBase.MenuInvokedHandler(Object sender,EventArgs args)

我試圖修復SSMS,但我不知道我在哪裏可以做到這一點。 我無法找到的Microsoft SQL Server Management Studio中的 「程序和功能」

enter image description here

我執行chkdsk並有我的SSD驅動器

Windows已經掃描的文件系統上沒有壞道並沒有發現問題。不需要進一步操作 。

131449855 KB總磁盤空間。 54907808 KB在218559個文件中。 137392KB在61261個索引中。 0 KB的壞道。 392375 KB由系統使用。 65536 KB由日誌文件佔用。 76012280 KB可用於磁盤。

4096 bytes in each allocation unit. 32862463 total allocation units on disk. 19003070 allocation units available on disk. 
+0

當您通過控制面板_uninstall_ SSMS進行修復操作時,儘管完全卸載/重新安裝可能是一個更好的主意,但要確保不會將文件複製回潛在的問題本地磁盤上的扇區。 [這裏是](https://www.techwalla.com/articles/how-to-repair-sql-server-management-studio)一篇文章,將指導你完成整個過程。 –

+0

@JohnEisbrener我有Windows 10,而SQL Server Management Studio不是「程序和功能」中的已安裝程序。 –

+0

我將我對下面答案的回覆提出來了,所以我可以添加屏幕截圖。 –

回答

0

修復操作時,可以使用卸載通過控制面板 SSMS,雖然完全卸載/重裝可能是一個更好的主意只是爲了確保你不將文件複製回潛在的不良本地驅動器上的扇區。

Here's這篇文章將引導您完成整個過程。

每您的評論仔細檢查你正在尋找正確的地方,因爲它應該在Microsoft SQL Server Management Studio中列出:

enter image description here

如果沒有的話,你已經卸載它?我不確定如何在未安裝SSMS的情況下運行SSMS,但這可能是您問題的根本原因。在這種情況下,只需安裝另一個副本,並確保對本地驅動器運行CHKDSK操作,以確保您沒有遇到任何磁盤損壞。

+0

我更新了我的答案,告訴您Microsoft Sql Server Management Studio不在「程序和功能」中。其實我從來沒有見過它,因爲我使用Windows 10和Sql Server 2012.我嘗試過使用chkdsk。謝謝你的建議。我會嘗試重新安裝Windows和SQL Server –

0

我建議你使用SQL Server Management Studio的更新版本。你可以下載它here。截至撰寫本文時,最新版本是16.5.3。微軟通常會爲SSMS發佈每月更新/補丁。嘗試安裝它。 SSMS 16.5.3與SQL Server 2012兼容。

相關問題