Last active
January 23, 2019 21:51
-
-
Save mattmc3/0eddc1d02f7b799ef966b5f16cfe1c26 to your computer and use it in GitHub Desktop.
MSSQL - Backup to nul
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 [MY_DATABASE] | |
go | |
checkpoint | |
go 50 | |
-- see what's blocking the log | |
select name, log_reuse_wait_desc, db.* | |
from sys.databases db | |
where db.name = 'MY_DATABASE' | |
use master | |
go | |
-- don't do full backup | |
-- backup database [MY_DATABASE] to disk = 'NUL' with compression, stats = 1; | |
backup log [MY_DATABASE] TO DISK = 'nul' WITH STATS = 1; | |
use [MY_DATABASE] | |
go | |
DBCC SHRINKFILE ([MY_DATABASE_LOG], 1, truncateonly) | |
go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment