Skip to content

Instantly share code, notes, and snippets.

@thomascsd
Created April 8, 2020 09:26
Show Gist options
  • Save thomascsd/252d08d1c18f607184d026e237141588 to your computer and use it in GitHub Desktop.
Save thomascsd/252d08d1c18f607184d026e237141588 to your computer and use it in GitHub Desktop.
SqlServer 清除Log的方式
找Log TableName
SELECT name, size/128.0 FileSizeInMB,
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0
AS EmptySpaceInMB
FROM sys.database_files;
清Log
DBCC SHRINKFILE (Database_Name_log , 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment