sql2008
IBCPMS_PICC_IC这是我的数据库
USE [master]
GO
ALTER DATABASE IBCPMS_PICC_IC SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE IBCPMS_PICC_IC SET RECOVERY SIMPLE --简单模式
GO
USE IBCPMS_PICC_IC
GO
DBCC SHRINKFILE (N'IBCPMS_PICC_log' , 11, TRUNCATEONLY)
GO
-- '这里的DNName_Log 如果不知道在sys.database_files里是什么名字的话,可以用以下注释的语句进行查询
USE IBCPMS_PICC_IC
GO
SELECT file_id, name FROM sys.database_files;
GO
USE [master]
GO
ALTER DATABASE IBCPMS_PICC_IC SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE IBCPMS_PICC_IC SET RECOVERY FULL --还原为完全模式
GO
sql2005
Backup Log DNName with no_log '这里的DNName是你要收缩的数据库名,自己注意修改下面的数据库名,我就不再注释了。
go
dump transaction DNName with no_log
go
USE 数据库名称
DBCC SHRINKFILE (2)
Go