Search

Monday, July 18, 2011

Error coming in Client system while running query


One day when tried to run a query in Client system, I encountered below mentioned error message :"An error occurred while executing batch. Error message is: The file exists."
The same error message is showing even if I click on any database and trying to expand its property. I think that there might be corruption with some dll files and that re installing the Shared components will resolve the issue. When I try to uninstall the Shared component using either 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 failed with the below mentioned error message on the GUI window :
Message: One or more command-line switches were invalid.
When I drill drill down and look for the detail message I see the below message :
2010-05-05 15:33:43 Slp: Installing WMI Provider
2010-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\100
2010-05-05 15:33:43 Slp: Sco: Attempting to get registry value SharedCode
2010-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.mof
2010-05-05 15:33:43 Slp: Sco: Attempting to install MOF file
2010-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.16385
2010-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.mof
2010-05-05 15:33:47 Slp: C:\Program Files\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof (1): error SYNTAX 0X8004402f: Error creating temporary file
2010-05-05 15:33:47 Slp:
2010-05-05 15:33:47 Slp: Compiler returned error 0x8004402f
2010-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 2
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: 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 Client system is 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.
I checked the environment variable and changed it to "C:\Windows\Temp".
Then again I ran the un-installation and this time it went on fine. Then I re installed the client component and now I was able to get the output of the results. After some time when I try 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.

Now I 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 I was re-creating all the required components.

Now all the problem were solved.

1 comment:

  1. Thanks for the help..adding the tmp folder to the environment variables helped in resolving this issue

    ReplyDelete