处理SQL FILESTREAM数据损坏和备份

时间:2013-03-08 20:24:40

标签: sql sql-server backup filestream corruption

在工作中,我们将为我们的客户存储媒体,如视频,高清照片和音频,我建议使用SQL FILESTREAM存储此类媒体。

这种方法的一个主要问题是如果FILEGROUP被破坏会发生什么?

  • 这是否会影响数据库或其功能?
  • 是否有任何警告数据可能已损坏?
  • 使用损坏的FILEGROUPS备份数据库是否会引发任何警告?或者只是正常备份?
  • 如果可以使用损坏的数据进行备份,那么还原呢?

我们应该考虑其他任何问题吗?

2 个答案:

答案 0 :(得分:1)

请阅读CIL。

这种方法的一个主要问题是如果FILEGROUP被破坏会发生什么?

A: If Filestream Filegroup corrupted, then you database will be in "recovery pending" 
status, just like other filegroup corrupted. But almost only one kind of corruption
of FileStream FileGroup can happen, which is hdr corrupted, which is kind of
dictionary file, saving file header information.

•这是否会影响数据库或其功能?

A: Yes, this will leave your database not functional.

•是否有任何警告数据可能已损坏?

A: No, if just data is corrupted in your BLOB files, there is no warning. 
Actually those just binary files, I can't think a scenario it can be corrupted.

•使用损坏的FILEGROUPS备份数据库是否会引发任何警告?还是只是正常备份?

A: If the Filestream FileGroup is corrupted, your database is not functional,
you have to restore the database.

•如果可以使用损坏的数据进行备份,那么恢复呢?

A: Backup can't be made with corrupted data, maybe dirty data possible,
but dirty data still is legal data. When I say dirty data, for example,
someone has permission to your filestream in SQL Server will also have the
permission to your BLOB files, they can directly update the BLOB file content,
which may involve some dirty data.
As of other concerns, you need to do full backup/Differential backup/Tranlog backup 
of your database regularly, just in case disaster happens. Filegroup backup will not
help you.

答案 1 :(得分:0)

如果您关心数据 - 正如您显然所做的那样,基于这个问题 - 那么为何选择putz?在数据库中声明BLOB列,让DBMS处理您提出的问题。

有人,也许是你团队中的某个人,可能反对这太慢了。首先,我挑战这个假设。其次,如果它经过测试并且速度太慢,那么无论如何都要这样做(!)并将FILESTREAM版本保留为外部缓存。这种方式转储/恢复可以忽略它,并且可以使用一个SELECT语句纠正损坏/删除。