Friday, March 28, 2014

Thursday, March 27, 2014

SharePoint Products Configuration Wizard – Tip

When you will run the “SharePoint Products Configuration Wizard” on a farm that has large databases (greater than 100GB), it’s advisable to change the recovery mode of all SharePoint databases to simple mode, avoiding a possible storage overflow in database log files or disk unit.

After that, adjust the recovery mode of each database following your enterprise rules or the Microsoft recommendation at link http://technet.microsoft.com/en-us/library/cc678868(v=office.15).aspx

Cheers ;-)

Friday, March 7, 2014

Why SharePoint 2013 Content Database grows up fast?

Today (2014.03.07) my DBA colleague got my attention about the fast growth of one of the content database in our SharePoint 2013 farm.

The content DB was normally at 04GB but after something, its size was doubled.

growth1

So I started the verification and the first thing that I did was looking for with table inside my Content DB was taking most of the space.

You Can check it from the SQL Server Management Studio. Login to SQL Server Management Studio -> Select your Content DB (Right Click) -> Reports- > Standard Reports -> Disk Usage by Top Tables.

growth2

Our report says that the “dbo.AuditData” are taking most of the space inside Content database of our site collection:

growth3

My conclusion: if you have enabled something like view auditing, a search crawl that crawls all the content could increase database size because the audit entries are stored inside the content DB. Workflow history events and User Profiles Sync are also stored in the content db and could be another possible explanation for the “mysterious growth”.

I have checked what our customer had set up for Audit in his site, and I have seen that he had selected everything. So if you want to reduce it, you must to decide what really is important for you audit.

growth10

More references:

http://technet.microsoft.com/en-us/library/cc678868%28v=office.15%29.aspx

Session: Content database

Content database size estimation

Content database size varies significantly with the usage of the site. Growth factors include the number of documents, number of users, use of versioning, use of Recycle Bins, size of quotas, whether the audit trail is configured, and how many items are chosen for auditing.

If Power Pivot for SharePoint is being used, the Excel files stored in SharePoint Server grow larger, which increases the size of the content database. For more information, see Plan a PowerPivot Deployment in a SharePoint Farm.

For detailed recommendations about how to calculate the size of a content database, see Storage and SQL Server capacity planning and configuration (SharePoint Server 2013).

Monday, March 3, 2014

How to reduce the size of logging database and how to purge the old data from Logging Database

Depending what you have selected to log on SharePoint 2013 logs, the WSS logging database grows very fast and it cause the storage problem most of the time.

In SharePoint 2013, you can selectively collect the ULS and Windows event logs from all the servers in a farm to a central Usage and Health database. The default data retention period is 14 days and bellow, I have my own sample of events selection:

clip_image001

The Logging database stores the following things:

  • ULS Logs from 15 Hive\LOGS
  • Raw Resources Usage Data

clip_image002

There are two timer jobs used to import and to process the raw data in the database:

  1. Microsoft SharePoint Foundation Usage Data Import
  2. Microsoft SharePoint Foundation Usage Data Processing

clip_image003

clip_image004

By following PowerShell commands we can check and change the value of retention days for the events selected on this database:

Check settings:

Get-spusagedefinition

Change settings:

Set-SPUsageDefinition 

To reduce the size of the logging database and to purge the old data from the logging database we can follow these steps.

1. Check the retention’s days typing the PowerShell on a SharePoint 2013 Management Shell prompt as administrator:

Get-spusagedefinition

clip_image005

2. Find the Logging Database Name:

Login to Central Administration -> Monitoring -> Configure Usage and health data collection:

clip_image006

Check the name in the “Database Name” of the “Logging Database Server” section:

clip_image007

3. Now you need to find which table is taking most of the space inside the WSS logging Database.

You Can check the same from the SQL Server. Login to SQL Server Management Studio -> Select your logging Database (Right Click) -> Reports- > Standard Reports -> Disk Usage by Top Tables.

clip_image008

Our report says that the “dbo.RequestUsage_*” are taking most of the space inside WSS Logging database, so  you can bring down the retention period of  Page Request Event from 14 to 5 for example.

clip_image009

4. By following the PowerShell below, you will bring down the retentions period of the “Page Requests” from 14 to 5:

Set-SPUsageDefinition -Identity “Page Requests” -DaysRetained 5

clip_image010

5. Run again the PowerShell to check the new value was changed or not:

Get-spusagedefinition

clip_image011

6. After that we need to run the two timer jobs to clean the old data “Microsoft SharePoint Foundation Usage Data Import” and “Microsoft SharePoint Foundation Usage Data Processing”.

Go to Sharepoint Central Administration -> Monitoring -> Configure Usage and health data collection-> Log Collection Schedule:

clip_image003[1]

It will take you to the “Job Definitions” page:

clip_image004[1]

7. Now Click on both the Job Definitions one by one and hit ‘Run Now’ to run the timer jobs:

clip_image012

clip_image013

8. Check if the timer jobs have run with success for all servers of the farm:

clip_image014

9. Once the timer jobs had run with success, you can check and confirm database has released the space. Note that now, I don’t have “dbo.RequestUsage_Partition4″ and “dbo.RequestUsage_Partition3″. It have reduced almost 5GB on my storage.

clip_image015

Alternatively, you can choose bring down all definitions at once time. Below a sample to bring down all definitions to 1 day:

Get-SPUsageDefinition | ForEach-Object {Set-SPUsageDefinition -Identity $_.name -DaysRetained 1}

Once that’s finished, a plain Get-SPUsageDefinition command should confirm that everything’s been set to 1 day.

clip_image016

After that, you can use SQL tools to shrink the database back to a more manageable size on disk. (Reminder, you may not need to have the WSS_Logging database in fully-logged, full recovery mode, which generates larger SQL transaction logs. Simple recovery mode usually works best here and it is the MS recommendation).

You may consider in a large production environments that the best option is to move the Usage and Health database to a separate physical database server using the Powershell below or at least have a separated disk to host this database:

Set-SPUsageApplication -DatabaseServer <DatabaseServerName> -DatabaseName <DatabaseName> [-DatabaseUserName <UserName>] [-DatabasePassword <Password>] [-Verbose]

References:

http://technet.microsoft.com/en-us/library/jj715694.aspx

http://technet.microsoft.com/en-us/library/cc678868(v=office.15).aspx