Restore database excluding datafile filestream data

Alen Cappelletti 1,047 Reputation points
2023-06-26T10:16:20.42+00:00

Hi all,
I would like to know if it is possible to implement such an action...

A got a big db with 3 data file:

  • .mdf (system only)
  • .ndf (user data)
  • .log (as the name))
    • 900 Gb of steam data (another data file dedicated).

I just read this post: https://learn.microsoft.com/en-us/answers/questions/794391/export-copy-database-without-filestream-data
"A backup/copy is always an exact 1:1 copy with anything included in the database, you can not make a partial backup/copy of a database". OK clear isn't possible."

But partitioning on a table of type Filestream is it possible? I never tried...
I would like to create 4 datafiles of type stream data....
cold, warm, hot, actual (example) for restoring not all the database but only the filegroup that I need, in my case last one (actual).

My alternative is to feed a simple active data window... moving records in and out of the Filestream folder directly on my filesystem obviously on another database dedicated for DEV.

I used this switching technique with a partitioning normal table using a partition function.

Thanks Alen.

SQL Server | Other
{count} votes

Accepted answer
  1. Erland Sommarskog 121.7K Reputation points MVP Volunteer Moderator
    2023-06-26T21:37:02.94+00:00

    When you restore a database, you can opt to only restore certain files or filegroups. You can restore a filegroup, apply logs, then apply the last log WITH RECOVERY, so that the database is partly accessible. That is, you will not be able to access tables on the filegroups you have not restored, and there can be issues if there are indexes on the non-restored filegroup as well.

    Thus, in your case, you should be able to restore only the PRIMARY filegroup and bring it online. The filestream data is its own filegroup, so it is not included. But since filestream table itself, is located in this filegroup, I guess you should be able to access the other column in this table.

    I need to add the caveat that I have not actually tested this.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.