Showing posts with label MS SQL Server Database. Show all posts
Showing posts with label MS SQL Server Database. Show all posts

Monday, 18 August 2014

How to purge Log in SqlServer Database



Step1: Open the SQL Server Management Studio by choosing Start > Programs > Microsoft SQL Server 2008 > SQL Server Management Studio.

Step2:  right-click on Database and open new sql query and execute following query to shrink Database log file to 20MB

USE [DB_NAME]
GO
ALTER DATABASE [DB_NAME] SET RECOVERY SIMPLE WITH NO_WAIT
dbcc shrinkfile(DB_Log_File_Name,20)
ALTER DATABASE [DB_NAME] SET RECOVERY FULL WITH NO_WAIT
GO

Note: Above colored texts are variable

USE [servicedesk]
GO
ALTER DATABASE [servicedesk] SET RECOVERY SIMPLE WITH NO_WAIT
dbcc shrinkfile(servicedesk_log,20)
ALTER DATABASE [servicedesk] SET RECOVERY FULL WITH NO_WAIT
GO