1

I have been tasked with migrating file data from one SQL server DB to another. There is currently a SQL server 2005 DB that is stored file in an image type field. There is a migration happening that is moving these files to a SQL 2008 Filestream setup, which works great. The files are being migrated in batches, but I have run into a problem as the file size of the DB is not decreasing. The migration script moves the batch then deletes the batch. The records are no longer available by query in the old database and they have moved successfully, but like I said the file size does not budge.

I need the size to decrease to allow for the next batch as the initial DB is nearly 1TB, there is just not enough room to have two copies.

I have tried SHRINKFILE, but that is not working. Any help is appreciated.

1
  • What is the SHRINKFILE command you have used? You might need to do a TRUNCATE... Jun 10, 2009 at 22:57

3 Answers 3

1

Try dbcc shrinkdatabase('mydbname')

This is a safe command though I wouldn't use it when the database is in heavy use.

JR

1

Shrink Database should do the trick. It should at least tell you how much you can reclaim.

1
  • It ran for 10 minutes and I received: "Msg 0, Level 11, State 0, Line 0 A severe error occurred on the current command. The results, if any, should be discarded." Jun 11, 2009 at 19:04
0

Is the transaction committed? If not, you can't reclaim that space.

Are you sure you're doing a shrinkfile on the right data file as well? Or are you doing a shrinkdatabase?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .