How to Reduce/Shrink the SQL Server Database Size?

October 14, 2022 / MySQL
Before Shrink the Database :
  • You cannot shrink a database that is currently being backed up or vice versa i.e. cannot a take backup of a database that is currently in the shrink process.
  • The database cannot be shrunk to a size that is smaller than its minimal or initial size. For instance, if a database was initially 10MB in size but later expanded to 2GB, the smallest size to which it can be shrunk is 10MB.
There are two ways to shrink the database. 

Method 1: Using SQL Server Management Studio

Follow the steps to shrink or reduce the SQL Server database size (.MDF and .LDF).

  1. Right-click on the Database name >> Tasks >> Shrink >> Database.
  2. Then Click OK.

Method 2: Using Transact SQL Command

Follow the steps to shrink or reduce the SQL Server database size using SQL command.

  1. Open SQL Server Management Studio.
  2.  Connect to the Database Engine.
  3. From the Standard bar, click New Query.
    New Query
  4. Type the following SQL command into the query window and click Execute.
    DBCC SHRINKDATABASE (DatabaseName, 'target percent') -- 

    This command shrinks the test database




shrink SQL server

That’s it!! With this Simple steps you can easily Shrink the SQL Server Database Size-. 

Also Read : How to Backup a MySQL Database using phpMyAdmin


Spread the love
Dominos Search