SQL Server Hosting – Easy to Shrink a Live SQL Server Database and Logs

SQL Server Hosting

SQL Server is a relational database management system (RDBMS) from Microsoft that’s designed for the enterprise environment. SQL Server runs on T-SQL (Transact -SQL), a set of programming extensions from Sybase and Microsoft that add several features to standard SQL, including transaction control, exception and error handling, row processing, and declared variables.

Easy to Shrink a Live SQL Server Database and Logs

If you have deleted a lot of data in the database and truncated some tables, probably you may want to shrink database files to recover the unused space. Basically shrinking will move the data pages at the end of the file into unoccupied space, available in the front of the file. 

You can use the DBCC SHRINKDATABASE command. For example, this command 

DBCC SHRINKDATABASE (your_database,10)

will decrease database size and allow for 10 percent free space. 

You can also shrink log file alone using DBCC SHRINKFILE command Take full back up of the database and run the following : 

It will set the log file size to 10 MB 

Caveats of shrinking database and logs: 

  1. SHRINK commands should not be done frequently as it will increase the index fragmentation. 
  2. It is a fully logged operation which will increase the log size and slows down the performance 
  3. Shrinking is not possible while the current database is being backed up up or restored 
  4. Shrinking is not possible when columnstore index is enabled 

Best practices 

  1. Use SHRINK only if a lot of operations such as TRUNCATE and DROP has lead to unused space 
  2. Take full backup before shrinking database files. If you shrink log file, set the Recovery mode into SIMPLE before shrinking and make it FULL after shrinking 
  3. Never turn ON AUTO SHRINK option 
  4. Always rebuild indexes after SHRINKING the database files to avoid fragmentation


ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers SQL 2016 hosting starts from $5. ASPHostPortal also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable SQL 2014 Hosting, ASPHostPortal should be your best choice.