Below is one of the scenarios, I recently witnessed where a query was failing when executed from SSMS (SQL 2008) on windows client machine. There is no local SQL installation on the machine and had registered a remote SQL Server instance. When tried to run any query, we encountered below mentioned error message :"An error occurred while executing batch. Error message is: The file exists."In case you come across such situation, you might get the same error message even if you are clicking on any database and trying to expand its property.You may think at this point that there could be some corruption with some dll files and that reinstalling the Shared components will resolve the issue. However, if you try to uninstall the shared component using :
· Add/Remove Programs or
· %program files%\Microsoft SQL server\100\setup bootstrap\release\x64\setuparp.exe ( for 32 bit, it will be under x32) to uninstall the components, the un-installation may fail with the below mentioned error message on the GUI window :
Message: One or more command-line switches were invalid.If we drill down and look for the detail message we will see the below message :
2010-05-05 15:33:43 Slp: Installing WMI Provider2010-05-05 15:33:43 Slp: Sco: Attempting to create base registry key HKEY_LOCAL_MACHINE, machine 2010-05-05 15:33:43 Slp: Sco: Attempting to open registry subkey SOFTWARE\Microsoft\Microsoft SQL Server\1002010-05-05 15:33:43 Slp: Sco: Attempting to get registry value SharedCode2010-05-05 15:33:43 Slp: SharedDirPath is C:\Program Files\Microsoft SQL Server\100\Shared\2010-05-05 15:33:43 Slp: Attempting to install MOF/MFL file for WMI Provider C:\Program Files\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof2010-05-05 15:33:43 Slp: Sco: Attempting to install MOF file2010-05-05 15:33:43 Slp: Running: C:\Windows\system32\WBEM\mofcomp.exe "C:\Program Files\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof"2010-05-05 15:33:43 Slp: Microsoft (R) MOF Compiler Version 6.1.7600.163852010-05-05 15:33:43 Slp: Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.2010-05-05 15:33:43 Slp: Parsing MOF file: C:\Program Files\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof2010-05-05 15:33:47 Slp: C:\Program Files\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof (1): error SYNTAX 0X8004402f: Error creating temporary file2010-05-05 15:33:47 Slp: 2010-05-05 15:33:47 Slp: Compiler returned error 0x8004402f2010-05-05 15:33:47 Slp: Sco: Compile operation for mof file C:\Program Files\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof failed. Exit code 22010-05-05 15:33:47 Slp: Configuration action failed for feature CommonFiles during timing ConfigNonRC and scenario ConfigNonRC.2010-05-05 15:33:47 Slp: One or more command-line switches were invalid.2010-05-05 15:33:47 Slp: Configuration action failed for feature CommonFiles during timing ConfigNonRC and scenario ConfigNonRC.2010-05-05 15:33:47 Slp: Microsoft.SqlServer.Configuration.Sco.ScoException: One or more command-line switches were invalid.2010-05-05 15:33:47 Slp: at Microsoft.SqlServer.Configuration.Sco.WmiProvider.InstallMof()2010-05-05 15:33:47 Slp: at Microsoft.SqlServer.Configuration.Slp.SlpConfigurationPrivate.Install_ConfigWMIProvider(Dictionary`2 actionData)2010-05-05 15:33:47 Slp: at Microsoft.SqlServer.Configuration.Slp.SlpConfigurationPrivate.Install_PostMSI(Dictionary`2 actionData, PublicConfigurationBase spcb)2010-05-05 15:33:47 Slp: at Microsoft.SqlServer.Configuration.Slp.SlpConfigurationPrivate.InstallImpl(ConfigActionTiming timing, Dictionary`2 actionData, PublicConfigurationBase spcb)2010-05-05 15:33:47 Slp: at Microsoft.SqlServer.Configuration.Slp.SlpConfigurationPrivate.Repair(ConfigActionTiming timing, Dictionary`2 actionData, PublicConfigurationBase spcb)2010-05-05 15:33:47 Slp: at Microsoft.SqlServer.Configuration.SqlConfigBase.PrivateConfigurationBase.Execute(ConfigActionScenario scenario, ConfigActionTiming timing, Dictionary`2 actionData, PublicConfigurationBase spcbCurrent)2010-05-05 15:33:47 Slp: at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.ExecuteAction(String actionId)2010-05-05 15:33:47 Slp: at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute(String actionId, TextWriter errorStream)2010-05-05 15:33:47 Slp: Exception: Microsoft.SqlServer.Configuration.Sco.ScoException.2010-05-05 15:33:47 Slp: Source: Microsoft.SqlServer.Configuration.Sco.2010-05-05 15:33:47 Slp: Message: One or more command-line switches were invalid..2010-05-05 15:33:47 Slp: Watson Bucket 1 Original Parameter Values
The error message is self explanatory and says that we are failing to create temporary files. This can occur if WMI is unable to access the TEMP and/or TMP location, either because of permissions or because the path is invalid.We checked the environment variable and changed it to "C:\Windows\Temp".Ran the un-installation and this time it went on fine. Reinstalled the client component and we were now able to get the output of the results. However later when we were trying to register a new server it was failing with the below mentioned error message.
“Unhandled exception has occurred in a component in your application. If you click Continue, the application will ignore this error and attempt to continue.” Key not valid for use in specified state.
Followed the below 2 step :
1. Close SSMS;
2. Go to the folder %appdata%\Microsoft\Microsoft SQL Server\100\Tools\ and check if there is a Shell folder, if so, rename it to Shell_Old;
Each time SSMS starts it creates this folder and will use old files. Hence by renaming the folder we are re-creating all the required components.
Regards,
Gaurav Srivastava
SE, SQL support
Reviewed by:
Nickson Dicson & Saket Suman
TL, SQL support
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
Microsoft.SqlServer.Management.RegisteredServers.RegisteredServerException: Unable to read the list of previously registered servers on this system. Re-register your servers in the 'Registered Servers' window. ---> Microsoft.SqlServer.Management.Sdk.Sfc.SfcSerializationException: Serialization output is invalid. ---> System.Xml.XmlException: 'None' is an invalid XmlNodeType. Line 7, position 9.
at System.Xml.XmlReader.ReadStartElement()
at Microsoft.SqlServer.Management.Sdk.Sfc.SfcSerializer.Deserialize(XmlReader xmlReader, SfcObjectState state)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore.InitChildObjects(String file)
at Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore.InitializeLocalRegisteredServersStore()
at Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore.get_LocalFileStore()
at Microsoft.SqlServer.Management.UI.ConnectionDlg.ConnectionDialog.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3615 (GDR.050727-3600)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
AppIDPackage
Assembly Version: 10.0.0.0
Win32 Version: 10.0.2531.0 ((Katmai_PCU_Main).090329-1015 )
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/AppIDPackage.DLL
System
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
Microsoft.SqlServer.SqlTools.VSIntegration
Win32 Version: 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.SqlTools.VSIntegration.DLL
Microsoft.VisualStudio.Shell.Interop
Assembly Version: 7.1.40304.0
Win32 Version: 7.10.6071
CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.Shell.Interop/7.1.40304.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Shell.Interop.dll
Microsoft.VisualStudio.OLE.Interop
Win32 Version: 7.10.6070
CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.OLE.Interop/7.1.40304.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.OLE.Interop.dll
System.Windows.Forms
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
System.Drawing
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
SqlWorkbench.Interfaces
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/SqlWorkbench.Interfaces.DLL
Microsoft.SqlServer.SqlTDiagM
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.SqlTDiagM/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.SqlTDiagM.dll
Microsoft.SqlServer.Instapi
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Instapi/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Instapi.dll
Microsoft.VisualStudio.Shell
Win32 Version: 2.0.50727.1826 (QFE.050727-1800)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Shell/2.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Shell.dll
Microsoft.VisualStudio.Shell.Interop.8.0
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.1826 (QFE.050727-1800)
CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.Shell.Interop.8.0/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Shell.Interop.8.0.dll
Microsoft.SqlServer.Management.SDK.SqlStudio
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.SDK.SqlStudio.DLL
Microsoft.SqlServer.Management.Sdk.Sfc
Win32 Version: 10.0.2531.0 ((Katmai_PCU_Main).090329-1045 )
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Management.Sdk.Sfc/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Management.Sdk.Sfc.dll
Microsoft.SqlServer.Management.Reports
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.Reports.DLL
ObjectExplorer
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/ObjectExplorer.DLL
SqlMgmt
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/SqlMgmt.DLL
Microsoft.VisualStudio
Win32 Version: 2.0.50727.1826 built by: QFE
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio/2.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.dll
System.Drawing.Design
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing.Design/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.Design.dll
Microsoft.VisualStudio.Designer.Interfaces
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.VisualStudio.Designer.Interfaces/1.0.5000.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Designer.Interfaces.dll
ConnectionDlg
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/ConnectionDlg.DLL
Microsoft.SqlServer.Management.Controls
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.Controls.DLL
Microsoft.SqlServer.Management.UserSettings
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.UserSettings.DLL
Accessibility
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
Microsoft.SqlServer.RegSvrEnum
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.RegSvrEnum/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.RegSvrEnum.dll
Microsoft.SqlServer.Management.SqlStudio.Explorer
CodeBase: file:///E:/Program%20Files%20(x86)/Microsoft%20SQL%20Server/100/Tools/Binn/VSShell/Common7/IDE/Microsoft.SqlServer.Management.SqlStudio.Explorer.DLL
System.Design
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Design/2.0.0.0__b03f5f7f11d50a3a/System.Design.dll
System.Data
CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
Microsoft.NetEnterpriseServers.ExceptionMessageBox
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.NetEnterpriseServers.ExceptionMessageBox/10.0.0.0__89845dcd8080cc91/Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll
Microsoft.SqlServer.ConnectionInfo
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.ConnectionInfo/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Management.RegisteredServers
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.SqlServer.Management.RegisteredServers/10.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Management.RegisteredServers.dll
System.Xml
Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Hi,
I followed these steps, but still I'm getting the same error.
Could you please provide me some more information.
Thank you.