Skip to content

Instantly share code, notes, and snippets.

@johnsonz
Created July 12, 2017 03:16
Show Gist options
  • Save johnsonz/793cf3284ec619b287fe002117377616 to your computer and use it in GitHub Desktop.
Save johnsonz/793cf3284ec619b287fe002117377616 to your computer and use it in GitHub Desktop.
USE [master]
GO
ALTER DATABASE students SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE students SET RECOVERY SIMPLE
GO
USE students
GO
--此处需要注意,并非所有数据库的日志文件名都是“数据库名_log”
DBCC SHRINKFILE (N'students_log' , 0,TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE students SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE students SET RECOVERY FULL
GO
--查询指定数据库的日志文件名称
USE students
GO
SELECT name FROM SYS.database_files WHERE type_desc='LOG'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment