SQL Server log shrinking Issue
undefined
undefined
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)
- SSIS Logging Table Customizing
- Getting column description and Update descriptions in SQL Server
- SQL SERVER Start and Stop services Using SSIS
- SQL Server log shrinking Issue
- Dynamic Pivot on Single Column in a Table Sql Server 2008
- Run same command on all SQL Server databases without cursors
- SQL SERVER – ReIndexing Database Tables and Update Statistics on Tables
- Delete Original Data and maintain history with single SQl statement......(Magic tables)
- SQL Server Recursive CTE
- SQL Server Advanced Queries
- Which index will SQL Server use to count all rows
- SQL Server Performance Tips
- Sql Server Temporary Tables vs Table Variables
- Differences between sqlserver 2000, 2005 and 2008 versions
- SSIS Interview Quesions and Answers
0 comments:
Post a Comment