清除数据库日志方法

语法

USE DATABASENAME; GO

-- Truncate the log by changing the database recovery model to SIMPLE.

ALTER DATABASE DATABASENAME SET RECOVERY SIMPLE;

GO

-- Shrink the trun cated log file to 1 MB.

DBCC SHRINKFILE (DATABASENAME_Log, 1); GO

-- Reset the database recovery model.

ALTER DATABASE DATABASENAME SET RECOVERY FULL; GO

 

示例:

USE ZL_GETDATA
GO

-- Truncate the log by changing the database recovery model to SIMPLE.

ALTER DATABASE ZL_GETDATA SET RECOVERY SIMPLE

GO

-- Shrink the trun cated log file to 1 MB.

DBCC SHRINKFILE (ZL_DB_log, 1)
GO

-- Reset the database recovery model.

ALTER DATABASE ZL_GETDATA SET RECOVERY FULL
GO

select * from sys.database_files

posted on 2018-11-23 16:20  不悔的青春  阅读(422)  评论(0编辑  收藏  举报

导航