使用SQL Server 2012 FileTable创建目录后,资源管理器不会更新

时间:2023-01-17 08:44:41

I am trying to create directories in a SQL Server FileTable via a stored procedure where I call the following code:

我试图通过存储过程在SQL Server FileTable中创建目录,我调用以下代码:

INSERT INTO tblMyFiles (name, is_directory, is_archive) 
VALUES ('foldername', 1, 0); 

After calling this code I can see the row sitting in the File Table if I select the rows in SQL Server Management Studio but if I explore to the File Table directory via Windows Explorer I can not see the newly created directory. If I refresh Windows Explorer then the directory still does not show up. If I create a file in the File Table directory in Explorer then it seems to wake Explorer up and then all my directories that were created via the stored procedure appear.

调用此代码后,如果我在SQL Server Management Studio中选择行,但是如果我通过Windows资源管理器浏览到文件表目录,则无法看到新创建的目录。如果我刷新Windows资源管理器,则该目录仍然不会显示。如果我在资源管理器的文件表目录中创建一个文件,它似乎唤醒了资源管理器,然后出现通过存储过程创建的所有目录。

I do not run into this problem when running this on the same SQL box and for a different database and I have compared all the properties and they appear identical but I must be missing something and don't know what? Any help would be much appreciated. Thanks in advance

我在同一个SQL框和另一个数据库上运行它时没有遇到这个问题,我已经比较了所有的属性,它们看起来完全相同,但我必须遗漏一些东西,不知道是什么?任何帮助将非常感激。提前致谢

1 个解决方案

#1


5  

I've seen this same issue - there seems to be a problem with Explorer caching the network share directory structure indefinitely. I also noticed that it won't refresh until I create a file and then delete it - then magically the cache refreshes. Deleting a file must force a directory cache refresh.

我已经看到了同样的问题 - 资源管理器似乎无限期缓存网络共享目录结构。我还注意到它不会刷新,直到我创建一个文件然后删除它 - 然后神奇地缓存刷新。删除文件必须强制刷新目录缓存。

This cache problem seems to be SMB related - I tried both SMB 2 (Windows 7) and SMB 3 (Windows 8) and experienced this same issue. SQL 2012 FileTables are supposed to support SMB 3.

此缓存问题似乎与SMB相关 - 我尝试了SMB 2(Windows 7)和SMB 3(Windows 8)并遇到了同样的问题。 SQL 2012 FileTables应该支持SMB 3。

After following this TechNet forum post, disabling the SMB directory cache makes it refresh every time (verified on Win7 and Win8). I'm guessing it could be SQL Server not sending the proper SMB messages or a bug in the SMB client stack. Either way - Microsoft needs to address it since they manage both the client and server design.

在关注此TechNet论坛帖子后,禁用SMB目录缓存会使其每次刷新(在Win7和Win8上验证)。我猜测它可能是SQL Server没有发送正确的SMB消息或SMB客户端堆栈中的错误。无论哪种方式 - 微软需要解决它,因为他们管理客户端和服务器设计。

Disabling the SMB Directory Cache

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters] "DirectoryCacheLifetime"=dword:00000000

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ LanmanWorkstation \ Parameters]“DirectoryCacheLifetime”= dword:00000000

#1


5  

I've seen this same issue - there seems to be a problem with Explorer caching the network share directory structure indefinitely. I also noticed that it won't refresh until I create a file and then delete it - then magically the cache refreshes. Deleting a file must force a directory cache refresh.

我已经看到了同样的问题 - 资源管理器似乎无限期缓存网络共享目录结构。我还注意到它不会刷新,直到我创建一个文件然后删除它 - 然后神奇地缓存刷新。删除文件必须强制刷新目录缓存。

This cache problem seems to be SMB related - I tried both SMB 2 (Windows 7) and SMB 3 (Windows 8) and experienced this same issue. SQL 2012 FileTables are supposed to support SMB 3.

此缓存问题似乎与SMB相关 - 我尝试了SMB 2(Windows 7)和SMB 3(Windows 8)并遇到了同样的问题。 SQL 2012 FileTables应该支持SMB 3。

After following this TechNet forum post, disabling the SMB directory cache makes it refresh every time (verified on Win7 and Win8). I'm guessing it could be SQL Server not sending the proper SMB messages or a bug in the SMB client stack. Either way - Microsoft needs to address it since they manage both the client and server design.

在关注此TechNet论坛帖子后,禁用SMB目录缓存会使其每次刷新(在Win7和Win8上验证)。我猜测它可能是SQL Server没有发送正确的SMB消息或SMB客户端堆栈中的错误。无论哪种方式 - 微软需要解决它,因为他们管理客户端和服务器设计。

Disabling the SMB Directory Cache

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters] "DirectoryCacheLifetime"=dword:00000000

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ LanmanWorkstation \ Parameters]“DirectoryCacheLifetime”= dword:00000000