question

Bj54 avatar image
Bj54 asked

Can I shrink replicated db.

I just configured FileStream on a 500 gb database and can now reclaim about 400 gb from the database so I'm planning to shrink it. Are there any issues shrinking a database (data file not log file)that's being replicated? The table that is configured for file tables is not being replicated. Question 2: why do I have to shrink the data file twice to actually reclaim all of the available space? I've tested this a number of times and I always have to shrink multiple times.
sqldatabaseshrink
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
As to shrinking multiple times, that has to do with rearranging the pages. Can you shrink the replicated database? Yes. While the shrink runs you're going to see blocking and you could get timeouts, so be prepared for that. The real question is, why are you shrinking so often that you're very familiar with all the inner workings of shrinking. Shrinking databases can be done, but should be done only extremely sparingly in very restricted circumstances. If you find yourself doing lots and lots of shrinks, you have data management issues you should address. Also, if you find yourself doing lots of shrinks, you're fragmenting the file storage of your databases which will cause serious negative impacts to performance.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bj54 avatar image Bj54 commented ·
Thanks Grant..... I was shrinking the data file multiple times to test the process and see where there may be problems. The only issue I saw was that when I restarted sql after the changes (documents stored on disk is 300 gb) the DB was in Recovery mode for longer than 2 hours. I think that was mainly due to the file stream and the size of docents being stored but I'm not sure.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.