Created
February 29, 2024 13:06
-
-
Save bradleykronson/59864c92df82abec6e25f7e68afea05c to your computer and use it in GitHub Desktop.
Shink SQL Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE DatabaseName; | |
GO | |
-- Truncate the log by changing the database recovery model to SIMPLE. | |
ALTER DATABASE DatabaseName | |
SET RECOVERY SIMPLE; | |
GO | |
-- Shrink the truncated log file to 1 MB. | |
DBCC SHRINKFILE (DatabaseName_Log, 1); | |
GO | |
-- Reset the database recovery model. | |
ALTER DATABASE DatabaseName | |
SET RECOVERY FULL; | |
GO | |
-- source | |
-- https://stackoverflow.com/questions/829542/how-do-i-decrease-the-size-of-my-sql-server-log-file/829573#829573 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment