sql server 数据库清理语句

MSSQL ningjian

sql server 数据库清理语句

USE master
ALTER DATABASE DeviceDataInfo SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE DeviceDataInfo SET RECOVERY SIMPLE --简单模式
GO
USE DeviceDataInfo
DBCC SHRINKFILE (N'DeviceDataInfo_log' , 2, TRUNCATEONLY)
GO
/*4.还原为完全模式*/
USE master
GO
ALTER DATABASE DeviceDataInfo SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE DeviceDataInfo SET RECOVERY FULL --还原为完全模式
GO

USE master

ALTER DATABASE platformDianli SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE platformDianli SET RECOVERY SIMPLE --简单模式
GO
USE platformDianli
DBCC SHRINKFILE (N'platform-Dianli_log' , 2, TRUNCATEONLY)
GO


/*4.还原为完全模式*/
USE master
GO
ALTER DATABASE platformDianli SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE platformDianli SET RECOVERY FULL --还原为完全模式
GO

发表评论:

验证码