Database log increases with increasing transactions and database activity. At times it is not required to maintain the log after some period. So in such cases it becomes quite beneficial to shrink the database log file as it saves much disk space. Below query can be used to do the needful.
sometimes it is better to set the database to simple recovery before compressing log.
Consider below query in those cases:
use @databaseName;
Go
ALTER DATABASE @databaseName SET RECOVERY SIMPLE
DBCC shrinkfile (@logFileName, 8);
ALTER DATABASE @databaseName SET RECOVERY FULL
Output:
sometimes it is better to set the database to simple recovery before compressing log.
Consider below query in those cases:
use @databaseName;
Go
ALTER DATABASE @databaseName SET RECOVERY SIMPLE
DBCC shrinkfile (@logFileName, 8);
ALTER DATABASE @databaseName SET RECOVERY FULL
No comments:
Post a Comment