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

前端之家收集整理的这篇文章主要介绍了sql – FILESTREAM文件在行删除后留下前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经在我的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.

原文链接:https://www.f2er.com/mssql/82736.html

猜你在找的MsSQL相关文章