Warning: count(): Parameter must be an array or an object that implements Countable in /nfs/c01/h05/mnt/6385/domains/uhleeka.com/html/blog/wp-content/plugins/uhleeka-codebox/uhleeka-codebox.php on line 65
Microsoft SQL Server 2008 no longer allows you to truncate the transaction log using the no_log syntax. Essentially, Microsoft decided (arguably correctly) that too many people were “abusing” the statement and doing harm to themselves.
But when your logfiles have grown too large because you are not backing them up often enough, you can use the following code to accomplish the same results as “with no_log”. If you don’t understand why Microsoft deprecated the “with no_log”, you should probably do more digging before you use anything posted here.
USE MASTER GO ALTER DATABASE database_name SET RECOVERY SIMPLE GO USE database_name GO DBCC SHRINKFILE (database_name_log, 1) GO ALTER DATABASE database_name SET RECOVERY FULL GO
SQL 2008 returns a table of shrinkfile related results plus the following confirmation:
(1 row(s) affected) DBCC execution completed. If DBCC printed error messages, contact your system administrator.