清空数据库日志


适用于MSSQL2000、2005

use databasename

BACKUP LOG databasename WITH NO_LOG  

DUMP TRANSACTION databasename WITH NO_LOG   

DBCC SHRINKDATABASE(databasename)

--查看数据库日志文件名等信息
select name from sysfiles 



适用于MSSQL2008、2012

USE[master]
GO
ALTER DATABASE databasename SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE databasename SET RECOVERY SIMPLE
GO
USE FDCS_BJLDHX_BSN 
GO
DBCC SHRINKFILE (N'databasename_log' , 1, TRUNCATEONLY)
GO
USE[master]
GO
ALTER DATABASE databasename SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE databasename SET RECOVERY FULL
GO



你可能感兴趣的:(数据库,MSSQL,数据库日志,清空数据库日志)