How to truncate log file in SQL Server 2008
In SQL Server data is stored using two physical files:
(.mdf) extension which contains the data.
(.ldf) extension which contains log.
Log file size increases very rapidly and depend on the operation performed on the data. After a long time period this file becomes too large. When log file is too large it takes time to perform some operations like ( attach , de-attach, backup, restore ... etc ).
Using the code
Step 1. Copy/type the below given SQL.
Step 2. Change @DBName to < Database Name>, @DBName_log to
Step 3. Execute the SQL.
ALTER DATABASE @DBName SET RECOVERY SIMPLE WITH NO_WAIT
DBCC SHRINKFILE(@DBName_log, 1)
ALTER DATABASE @DBName SET RECOVERY FULL WITH NO_WAIT
GO
source :
http://www.codeproject.com/Tips/625760/How-to-truncate-log-file-in-SQL-Server
(.mdf) extension which contains the data.
(.ldf) extension which contains log.
Log file size increases very rapidly and depend on the operation performed on the data. After a long time period this file becomes too large. When log file is too large it takes time to perform some operations like ( attach , de-attach, backup, restore ... etc ).
Using the code
Step 1. Copy/type the below given SQL.
Step 2. Change @DBName to < Database Name>, @DBName_log to
Step 3. Execute the SQL.
ALTER DATABASE @DBName SET RECOVERY SIMPLE WITH NO_WAIT
DBCC SHRINKFILE(@DBName_log, 1)
ALTER DATABASE @DBName SET RECOVERY FULL WITH NO_WAIT
GO
source :
http://www.codeproject.com/Tips/625760/How-to-truncate-log-file-in-SQL-Server
Yorumlar