{"id":1803,"date":"2015-10-16T16:29:41","date_gmt":"2015-10-16T16:29:41","guid":{"rendered":"http:\/\/www.obieta.com\/?p=1803"},"modified":"2015-10-16T16:29:41","modified_gmt":"2015-10-16T16:29:41","slug":"how-to-tame-your-wss_logging-database-size-on-a-test-sharepoint-2013-server","status":"publish","type":"post","link":"https:\/\/obieta.com\/?p=1803","title":{"rendered":"How to tame your WSS_Logging database size on a test SharePoint 2013 server"},"content":{"rendered":"<p>Reblog from Todd Klindt : <a href=\"http:\/\/www.toddklindt.com\/ShrinkWSSLogging\">http:\/\/www.toddklindt.com\/ShrinkWSSLogging<\/a><\/p>\n<p>By default the WSS_Logging keeps 14 days\u2019 worth of information. That results in a big database. 3 days\u2019 worth of logging is probably sufficient for most test VMs. Here\u2019s how mine looked this morning:<\/p>\n<p><a href=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-10-52-30-AM_2_2016977B.png\"><img loading=\"lazy\" title=\"Logging 3-26-2013 10-52-30 AM\" src=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-10-52-30-AM_thumb_2016977B.png\" alt=\"Logging 3-26-2013 10-52-30 AM\" width=\"633\" height=\"266\" border=\"0\" \/><\/a><\/p>\n<p>The WSS_Logging DB\u2019s MDF and LDF are taking 2.2 GB with 14% of the MDF free and 60% of the transaction log free. Since the transaction log is 6 MB, I didn\u2019t care about that. Since this is a test VM, I shrunk the DB, to see what that would get me. I got the 14% back. That shrunk it down to 1.7 GB.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-15-29-PM_2_2016977B.png\"><img loading=\"lazy\" title=\"Logging 3-26-2013 2-15-29 PM\" src=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-15-29-PM_thumb_2016977B.png\" alt=\"Logging 3-26-2013 2-15-29 PM\" width=\"632\" height=\"258\" border=\"0\" \/><\/a><\/p>\n<p>We can do better. <img class=\"wlEmoticon wlEmoticon-smile\" src=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/wlEmoticon-smile_2_2016977B.png\" alt=\"Smile\" \/> The next thing I did was change the Usage retention from 14 days to 3 days. I do that with PowerShell. Here\u2019s how I did it:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-49-14-PM_2_2016977B.png\"><img loading=\"lazy\" title=\"Logging 3-26-2013 2-49-14 PM\" src=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-49-14-PM_thumb_2016977B.png\" alt=\"Logging 3-26-2013 2-49-14 PM\" width=\"514\" height=\"625\" border=\"0\" \/><\/a><\/p>\n<p>Get-SPUsageDefinition shows me all the things that are retained, and for how long. I want to set them all to 3 days from 14. I use the following PowerShell to do that:<\/p>\n<blockquote><p><span style=\"font-family: Courier New;\">Get-SPUsageDefinition\u00a0 | ForEach-Object { Set-SPUsageDefinition $_ \u2013DaysRetained 3}<\/span><\/p><\/blockquote>\n<p>The next time the Usage Log File timer jobs run it\u2019ll clean out everything more than 3 days old. If we want to manually trigger those jobs we can use this PowerShell:<\/p>\n<blockquote><p><span style=\"font-family: Courier New;\">Get-SPTimerJob | Where-Object { $_.title -like &#8220;*usage data*&#8221; } | Start-SPTimerJob<\/span><\/p><\/blockquote>\n<p>The second Timer Job failed because I haven\u2019t enabled it on my farm. You may or may not get that same error.<\/p>\n<p>Now let\u2019s check in with SQL Server Management Studio and see how our database looks:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-34-56-PM_4_2016977B.png\"><img loading=\"lazy\" title=\"Logging 3-26-2013 2-34-56 PM\" src=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-34-56-PM_thumb_1_2016977B.png\" alt=\"Logging 3-26-2013 2-34-56 PM\" width=\"488\" height=\"341\" border=\"0\" \/><\/a><\/p>\n<p>The MDF file is still 1.7 GB, but it\u2019s got a lot of unallocated space. We can shrink the database to get that back:<\/p>\n<p><a href=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-35-39-PM_2_2016977B.png\"><img loading=\"lazy\" title=\"Logging 3-26-2013 2-35-39 PM\" src=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-35-39-PM_thumb_2016977B.png\" alt=\"Logging 3-26-2013 2-35-39 PM\" width=\"490\" height=\"312\" border=\"0\" \/><\/a><\/p>\n<p>Then<\/p>\n<p><a href=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-36-18-PM_2_2016977B.png\"><img loading=\"lazy\" title=\"Logging 3-26-2013 2-36-18 PM\" src=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-36-18-PM_thumb_2016977B.png\" alt=\"Logging 3-26-2013 2-36-18 PM\" width=\"504\" height=\"452\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Normally shrinking a database is the Devil\u2019s work, but since this is a test VM, and since we don\u2019t anticipate the database growing it\u2019s less demonic.<\/p>\n<p>Once that\u2019s all finished we can see our database is taking about 300 MB on disk:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-46-29-PM_2_2016977B.png\"><img loading=\"lazy\" title=\"Logging 3-26-2013 2-46-29 PM\" src=\"http:\/\/www.toddklindt.com\/blog\/Lists\/Posts\/Attachments\/400\/Logging-3-26-2013-2-46-29-PM_thumb_2016977B.png\" alt=\"Logging 3-26-2013 2-46-29 PM\" width=\"610\" height=\"246\" border=\"0\" \/><\/a><\/p>\n<p>That\u2019s much better.<\/p>\n<p>Again, you only want to do this in a test environment. Don\u2019t do it in production.<\/p>\n<p>tk<\/p>\n<p>ShortURL: <a href=\"http:\/\/www.toddklindt.com\/ShrinkWSSLogging\">http:\/\/www.toddklindt.com\/ShrinkWSSLogging<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reblog from Todd Klindt : http:\/\/www.toddklindt.com\/ShrinkWSSLogging By default the WSS_Logging keeps 14 days\u2019 worth of information. That results in a big database. 3 days\u2019 worth of logging is probably sufficient for most test VMs. Here\u2019s how mine looked this morning: The WSS_Logging DB\u2019s MDF and LDF are taking 2.2 GB with 14% of the MDF [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/posts\/1803"}],"collection":[{"href":"https:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obieta.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1803"}],"version-history":[{"count":0,"href":"https:\/\/obieta.com\/index.php?rest_route=\/wp\/v2\/posts\/1803\/revisions"}],"wp:attachment":[{"href":"https:\/\/obieta.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/obieta.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/obieta.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}