Pages

Saturday, May 17, 2014

SQL Server Shrink Log file after backup

USE TP;
GO

select name,recovery_model_desc from sys.databases

select * from sys.database_files

select * from sys.master_files

-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE TP SET RECOVERY SIMPLE;
GO

-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (HORTI_RAJ1_log, 1);
GO

-- Reset the database recovery model.
ALTER DATABASE TP SET RECOVERY FULL;
GO

No comments:

Post a Comment