gpt4 book ai didi

sql - 在 Windows 资源管理器中创建文件锁定 FileTable

转载 作者:行者123 更新时间:2023-12-02 03:32:22 25 4
gpt4 key购买 nike

我刚刚开始在 SQL Server 2012 中使用 FileTables。我已经在远程服务器上设置了所有内容,并且没有任何问题。非事务性文件插入等工作得非常好。

但是,当我尝试从 Windows 资源管理器(右键单击 -> 新建 -> 文本文档)在 FileTable 共享目录中创建一个新的文本文件时,它完全卡住了。现在,当我在 FileTable 上执行查询时,查询会卡住并且我没有得到任何响应。所以我认为我从文件系统中的非事务性插入已经锁定了 FileTable。

无论如何,这是我迄今为止尝试过的(没有成功):

  • 杀死正在进行的文件流句柄 ( http://msdn.microsoft.com/en-us/library/gg492061.aspx#BasicsKilling ) 没有结果。处决只是卡住。
    -- Kill all handles on database
    EXEC sp_kill_filestream_non_transacted_handles;
    GO

    -- Kill handles on filetable
    EXEC sp_kill_filestream_non_transacted_handles @table_name = 'dbo.MyFileTable';
    GO

    -- Kill single handle
    EXEC sp_kill_filestream_non_transacted_handles @handle_id = <handle id>;
    GO
  • 使数据库脱机。这会导致错误消息:
    Msg 5061, Level 16, State 1, Line 2
    ALTER DATABASE failed because a lock could not be placed on database 'FOO'. Try again later.
  • 删除数据库。这会导致错误消息:
    Msg 3702, Level 16, State 4, Line 2
    Cannot drop database "FOO" because it is currently in use.
  • 在我的数据库上终止正在进行的 session (?):
    EXEC sp_who2
    KILL <SPID>

  • 如前所述,我无法与我的 FileTable 进行事务性和非事务性交互。如您所见,我什至不能删除自己的数据库。

    可能导致这种情况的任何建议?我应该小心使用 FileTables 吗?有关如何解决此问题的任何建议?

    最佳答案

    通过重新启动 SQL Server 实例解决了它。不过,这是最后的手段,因为它是我公司使用的远程实例。

    我相信这个问题是由我 引起的。已创建 直接在我的 FileTable 目录中的一个文件。在文档( http://msdn.microsoft.com/en-us/library/gg492083.aspx#HowToLoadNew )中,声明如下:

    The methods that you can use to load files into a FileTable include the following:

    • Drag and drop files from the source folders to the new FileTable folder in Windows Explorer.

    • Use command line options such as MOVE, COPY, XCOPY, or ROBOCOPY from the command prompt or in a batch file or script.

    • Write a custom application in C# or Visual Basic.NET that uses methods from the System.IO namespace to move or copy the files.



    但是,并没有说明 创建文件 可能会导致问题。不幸的是,在我的情况下确实如此。希望这个答案可以帮助将来有类似问题的人。

    关于sql - 在 Windows 资源管理器中创建文件锁定 FileTable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25864542/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com