SQL2008压缩日志文件 这么操作为何不行呢? USE DBNAME GO -- Truncate the log by changing the database recovery model to SIMPLE. ALTER DATABASE DBNAME SET RECOVERY SIMPLE; GO -- Shrink the truncated log file to 1 MB. DBCC SHRINKFILE (DBNAME_Log, 1,TRUNCATEONLY); GO -- Reset the database recovery model. ALTER DATABASE DBNAME SET RECOVERY FULL; GO
会报错:Msg 8985, Level 16, State 1, Line 2 Could not locate file 'DBNAME_Log' for database 'DBNAME' in sys.database_files. The file either does not exist, or was dropped.
CREATE DATABASE DBT
go
USE DBT
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE DBT
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (DBT_Log, 1,TRUNCATEONLY);
GO
-- Reset the database recovery model.
ALTER DATABASE DBT
SET RECOVERY FULL;
GO
------解决方案-------------------- The file either does not exist, or was dropped.