在 sql server management studio 中运行任何查询时出错:文件存在
当我在 sql server management studio 中运行任何查询时,出现以下错误:
执行批处理时发生错误。错误消息是:文件存在。
重新启动 SSMS 没有帮助。重新启动机器也没有。我在 Google 上发现的唯一内容是有人说“向 microsoft 报告错误”:P
(Windows XP Pro x64, SSMS 2005)
When I run any query in sql server management studio, I get the following error:
An error occurred while executing batch. Error message is: The file exists.
Restarting SSMS didn't help. Neither did rebooting the machine. The only thing I found on Google was someone saying "report the bug to microsoft" :P
(Windows XP Pro x64, SSMS 2005)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我已经被这个问题困扰了一段时间,当我最近安装 Toad for MySQL 时,我遇到了同样的问题。
我安装了 sysInternals 进程监视器工具来尝试找出导致问题的文件。
答案是临时文件。
SQL Server Management Studio 和 Toad 都对其临时文件使用类似的命名约定。两者都使用“文档和设置”中用户帐户下的临时目录。就我而言,该目录中有超过 6 万个 *.tmp 文件。
通过进程监视器观察查询的执行情况,我可以看到 SQL IDE 不断尝试识别不存在的临时文件名,但始终失败,直到最终放弃并出现“文件存在”错误。
解决方案只是清除本地设置临时目录中的 *.tmp 文件。
SQL Management Studio 和 Toad for MySQL 现在在我的机器上运行良好。
希望这有帮助。
I've been struggling with this one for while and when I recently installed Toad for MySQL I got the same issue.
I installed sysInternals process monitor tool to try and work out which file was causing the issue.
The answer is temp files.
Both SQL server management studio and toad use a similar naming convention for their temp files. Both use the temp directory under your user account in Documents and Settings. In my case, there were over 60 thousand *.tmp files in that directory.
Watching the query execute through process monitor I could see the SQL IDE continually trying and failing to identify a temp file name which didn't exist until it finally gives up with a "The file exists" error.
The solution is simply to clear out the *.tmp files in your local settings temp directory.
Both SQL Management Studio and Toad for MySQL are now working fine on my machine.
Hope this helps.
进一步了解 Stephen 的答案,路径为:
C:\Documents and Settings\%USERNAME%\Local Settings\Temp
C:\Users\ %USERNAME%\AppData\Local\Temp
%TEMP%
粘贴到 Windows 资源管理器地址栏中即可获取路径。我推荐这个小插件,以防您无法访问路线:
取得所有权
http://www.sevenforums.com/tutorials/1911-take-ownership-shortcut.html< /a>
Going further into Stephen's answer, the path would be:
C:\Documents and Settings\%USERNAME%\Local Settings\Temp
C:\Users\%USERNAME%\AppData\Local\Temp
%TEMP%
into the Windows Explorer address bar to get the path.I recommend this little plugin in case you can't access the route:
Take Ownership
http://www.sevenforums.com/tutorials/1911-take-ownership-shortcut.html
我在 Windows 8.1 上运行 SQL Server 2012 时遇到了同样的问题。正如@Stephen 提到的,问题出在临时文件上,但我在他提到的位置找不到它们。通过运行磁盘清理并指示其删除临时文件解决了该问题。
I ran into the same issue with SQL Server 2012 running on Windows 8.1. As @Stephen mentioned, the issue is with the temp files but I couldn't find them in the location he mentioned. Solved the problem by running disk cleanup and directing it to delete Temporary Files.
我已经清除了临时文件,尽管问题没有解决,因此我通过 revo 卸载程序卸载了该软件,从而清除了所有软件日志和软件相关的注册表数据。重新安装后问题解决了
I have cleared temp files although issue was not solved hence I uninstalled the software through revo uninstaller thus it cleared all the software logs and software related registry data. And after re-installing problem was solved
我已经解决了这个问题,在目录上创建另一个文件夹。
只要用户在其中打开新选项卡,SSMS 就会创建编号文件夹。
如果您遇到同样的问题,只需在以下位置创建一个编号文件夹即可
C:\Users%USERNAME%\AppData\Local\Temp 和 SSMS 将不再返回此信息。
I've solved this question creating another folder on directory.
SSMS creates numbered folders anytime the user open a new tab on it.
If you're having the same trouble, just create a numbered folder on
C:\Users%USERNAME%\AppData\Local\Temp and SSMS will return this no more.