How to Shrink Database, Data File and Log File in SQL Server

Following way we can Shrink Database, Data Files and Log Files:

1. Using SQL Server Management Studio (GUI)

2. Using T-SQL script

Please do not shrink without checking the recommendation otherwise you can see huge performance issue. This is just an example to show how to shring Database, Data Files and Log Files.

1. Using SQL Server Management Studio (GUI)

2. Using T-SQL Script:

--Shrink Database Script

USE [SalesOrders]

GO

DBCC SHRINKDATABASE(N'SalesOrders', 10 )

GO

--Shrink DB Files Scripts

USE [SalesOrders]

GO

DBCC SHRINKFILE (N'SalesOrders' , 3)

GO