加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql – FILESTREAM文件在行删除后留下

发布时间:2020-12-12 16:13:42 所属栏目:MsSql教程 来源:网络整理
导读:我已经在我的SQL 2008服务器上成功设置了FILESTREAM;但是我注意到,即使删除了包含FILESTREAM数据的行,物理数据文件似乎也没有被删除. 通过物理文件,我的意思是SQLServer的托管目录中的文件,其中uniqueidentifer作为文件名,而不是原始文件添加到dbase. 有人知
我已经在我的SQL 2008服务器上成功设置了FILESTREAM;但是我注意到,即使删除了包含FILESTREAM数据的行,物理数据文件似乎也没有被删除.

通过物理文件,我的意思是SQLServer的托管目录中的文件,其中uniqueidentifer作为文件名,而不是原始文件添加到dbase.

有人知道SQLServer是否会最终删除该文件?如果从dbase中删除了大量文件,我希望能够快速回收这个空间.

谢谢,

戴尔

解决方法

FILESTREAM数据受事务控制,因此不会立即删除.

相反,SQL Server运行一个垃圾收集器,当它确定最终被删除时会清除旧的数据.

documentation

FILESTREAM garbage collection is a background task that is triggered by the database checkpoint process. A checkpoint is automatically run when enough transaction log has been generated. For more information,see the SQL Server 2008 Books Online topic “CHECKPOINT and the Active Portion of the Log” (07001). Given that FILESTREAM file operations are minimally logged in the database’s transaction log,it may take a while before the number of transaction log records generated triggers a checkpoint process and garbage collection occurs. If this becomes a problem,you can force garbage collection by using the CHECKPOINTstatement.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读