Last active
May 11, 2019 17:00
-
-
Save geo-stanciu/da9afa935f3f1d9fb1f67c1a53433564 to your computer and use it in GitHub Desktop.
SQL Server - Shrink the transaction log file
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
-- First, create a full backup | |
sqlcmd -d devel | |
use devel | |
go | |
select name,recovery_model_desc from sys.databases | |
go | |
ALTER DATABASE devel SET RECOVERY simple | |
go | |
DBCC SHRINKFILE (devel_log , 1) | |
go | |
ALTER DATABASE devel SET RECOVERY full | |
go | |
exit | |
-- Now create another backup. | |
-- AFAIK shrinking made impossible to create a point in time recovery prior to the backup taken earlier. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment