From the course: SQL Server 2022 Administration

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Shrink databases

Shrink databases

So the cost of disk space has come down substantially over the past few decades in IT, but part of your job as a DBA is still to manage that space. And databases can be configured to auto grow and take up more space as they have data added to them. You can configure them to auto shrink and you should at least occasionally go in and check your databases and see if you do need to shrink them. So this lesson I'm going to show you how you can shrink your databases, and I'm going to talk about the auto shrink option and why I think it's evil. So let's dive right in. Here's the WideWorldImporters database, which is the sample with SQL, and if I look at the properties of this, you'll see on options that it is set to false for auto shrink. This is how I recommend you treat your database. Do not use auto shrink. And the reason for that is because, and I'm not a huge fan of auto grow either, but I get it in the event of an emergency, the database is filling up, you need to have it grow so…

Contents