Created
April 6, 2017 14:29
-
-
Save mattmc3/69b2b4e6250617c79bf6c06f395ab471 to your computer and use it in GitHub Desktop.
MSSQL - Truncate log file
This file contains hidden or 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
| -- http://dba.stackexchange.com/questions/6996/how-do-i-truncate-the-transaction-log-in-a-sql-server-2008-database | |
| ALTER DATABASE {{db}} SET RECOVERY SIMPLE | |
| go | |
| SELECT name | |
| FROM sys.master_files | |
| WHERE database_id = DB_ID('{{db}}') | |
| go | |
| -- Shrink the log file | |
| DBCC SHRINKFILE (N'{{db}}_log' , 0, TRUNCATEONLY) | |
| go | |
| ALTER DATABASE {{db}} SET RECOVERY FULL | |
| go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment