0

I want to run exactly this command:

DBCC SHRINKDATABASE mydb

When I run this just for a while and then kill it, will the physical database file be a little bit smaller?

In other words: Does the command immediatedly free physical disk space during its run, or does it first a full reorganization, and only then free all physical space?

EDIT: We have simple recovery model, so our log file is very small and we only have one big database file.

askolotl
  • 255
  • 1
  • 3
  • 10

1 Answers1

2

DBCC SHRINKDATABASE does not rollback when the process is killed so theoretically you'd be able to run it for a period of a time, kill the process, and have some reclaimed space (assuming there is any that can be reclaimed). See this for more information.

Also please see and research the warnings I provided against shrinking in my answer to your other StackExchange question.

...[it's] heavy operations, generally nonsensical to do because if they grew to a certain size they'll likely grow back to that size soon anyway and a growth operation is also heavy, and shrinking any database files (except Temporary) does have a small risk of data corruption.

J.D.
  • 40,776
  • 12
  • 62
  • 141