DBCC SHRINKFILE (@LogicalFileName, @NewSize)
再是
BACKUP LOG dbname WITH TRUNCATE_ONLY
或者,先设置数据库为简单恢复模式,再收缩文件,然后再设置数据库为完整恢复模式。(要是数据库原来就是简单恢复模式,就直接收缩文件即可)
e.g:
USE AdventureWorks;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE AdventureWorks
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (AdventureWorks_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE AdventureWorks
SET RECOVERY FULL;
GO
要是截断日志,可以这样:
BACKUP LOG dbname WITH NO_LOG
Dbcc Shrinkdatabase('dbname')
再是
BACKUP LOG dbname WITH TRUNCATE_ONLY
或者,先设置数据库为简单恢复模式,再收缩文件,然后再设置数据库为完整恢复模式。(要是数据库原来就是简单恢复模式,就直接收缩文件即可)
e.g:
USE AdventureWorks;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE AdventureWorks
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (AdventureWorks_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE AdventureWorks
SET RECOVERY FULL;
GO
要是截断日志,可以这样:
BACKUP LOG dbname WITH NO_LOG
Dbcc Shrinkdatabase('dbname')