SharePoint User Profile Database Continuously Growing

A customer reported a very large SharePoint User Profile Database (500+ GB) that was continuously growing.  The ActivityEventsConsolidated and ActivityEventsPublished tables in the User Profile Database were the largest.  These tables store user profile information for the newsfeed service.

If you are not using the newsfeed service, here are the steps to resolve.

1) Use SharePoint Management Shell to get the SharePoint User Profile Service Application and set DaysWorthOfActivityFeedsToKeep to zero

$ups = Get-SPServiceApplication -name “User Profile Services”

$ups.DaysWorthOfActivityFeedsToKeep = 0

$ups.Update()

2) In Central Admin click Monitoring, Review job definitions, User Profile Services – Activity Feed Cleanup Job

edit timer job

3) Run the User Profile Services – Activity Feed Cleanup Job and monitor completion under Monitoring, Check Job Status
Note: This job may require several hours to complete

run user profile services

4) In Central Admin, click Monitoring, Review problems and solutions, click and automatically repair the Database has large amounts of unused space problem

5) Check Job Status for the Microsoft.SharePoint.Administration.Health.DatabaseCanBeShrinked On Demand Health Analysis Job to complete
Note: This job may require several hours to complete