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.

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...