Sunday 31 March 2013

How to shrink a database log file for MSSQL Using Management Studio?

Shrink a log file for a database:

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.
  2. Expand Databases and then right-click the database that you want to shrink.
  3. Point to Tasks, point to Shrink, and then click Files.
  4. Select the Log file that need to be shrunk.

Using the Transact SQL Query:

To shrink a data or log file using the Transact SQL Query:

  1. Connect to the Database Engine.
  2. From the Standard bar, click New Query.


USE <UserDB>;
GO
DBCC SHRINKFILE (UserDB_Log, 1);

No comments:

Post a Comment