语法
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