SQLServer (2005/2008) 日誌清理方法

 

--數據庫日誌名稱查詢數據庫

USE DBNAME日誌

GOast

SELECT file_id, name,* FROM sys.database_files;file

GO
-------------------------------------------------------------------------------------------------------
方法

 

--SQL SERVER 2005 清理方法數據

USE [master]查詢

BACKUP LOG DBNAME WITH no_logtab

USE APPdata

DBCC SHRINKFILE ('DBNAME_log',100)ab

-------------------------------------------------------------------------------------------------------

--SQL SERVER 2008 清理方法

USE [master];
GO
ALTER DATABASE DBNAME SET RECOVERY SIMPLE WITH NO_WAIT;
GO
ALTER DATABASE DBNAME SET RECOVERY SIMPLE;--簡單模式

GO
USE [DBNAME];
GO
DBCC SHRINKFILE (N'DBNAME_Log' , 11, TRUNCATEONLY);
GO

 

USE [master];
GO
ALTER DATABASE DBNAME SET RECOVERY FULL WITH NO_WAIT;
GO
ALTER DATABASE DBNAME SET RECOVERY FULL; --還原爲徹底模式
GO

-------------------------------------------------------------------------------------------------------

相關文章
相關標籤/搜索