尝试打开SQL文本编辑器时发生SQL Server 2012 Management Studio错误

问题描述:

尝试在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

我将我对下面答案的回复提出来了,所以我可以添加屏幕截图。 –

修复操作时,可以使用卸载通过控制面板 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 –

我建议你使用SQL Server Management Studio的更新版本。你可以下载它here。截至撰写本文时,最新版本是16.5.3。微软通常会为SSMS发布每月更新/补丁。尝试安装它。 SSMS 16.5.3与SQL Server 2012兼容。