SQL Server log shrinking Issue
USE
[sample]; GO DBCC SHRINKFILE (
sample_log, 1); GO
If you are shrinking a log file, you won't be able to shrink it any less than the active log portion. In other words, if you are in Full Recovery Model, and you haven't done any transaction log backups (which is why it could have grown that large), then running a DBCC SHRINKFILE will do absolutely nothing. |
Solution:
USE [sample];
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [sample]
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (sample_log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE [sample]
SET RECOVERY FULL;
GO
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [sample]
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (sample_log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE [sample]
SET RECOVERY FULL;
GO
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment