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.
[解决办法]
貌似是log的名称写错了。查一下sys.database_files
我执行的语句,没有问题。
CREATE DATABASE DBT goUSE DBTGO-- Truncate the log by changing the database recovery model to SIMPLE.ALTER DATABASE DBTSET 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 DBTSET RECOVERY FULL;GO
[解决办法]
The file either does not exist, or was dropped.
文件不存在或者被删除了。
[解决办法]
文件不存在或被删除。
[解决办法]