SharePoint dev machine – keep your SQL databases sizes neat

Ok, time to go back to the blog posting.


I do often create single-server SharePoint based environments purely for development purposes. In this environment we often face an issue of overgrowing databases logs.

To make things worse, now I use SSDs in Azure, which are rather limited in size.

So for DEVELOPER machine it would be fine to switch the recovery model to simple and thus the log should be truncated.

Prior to SQL 2012, there was a special option "truncate log on checkpoint", but as of SQL 2012 I cannot find this option anymore. See


The blog here contains a good set of commands to keep your database in place (I really like the title "Shrinking Ginormous SharePoint Database Transaction Log Files" :)), but it only deals with one database.


So I have found an undocumented procedure sp_MSForEachDB (you could read more here or here ) that can run a particular command on every database.


The final syntax I use comes like this (but, of course, you could use your commands and avoid shrinking or set autoshrink if it suits your environment).



Disclaimer: I am not in any case saying that simple recovery model is ok for production.

Hope this post would be useful.

Skip to main content