Thursday 28 November 2013

PowerShell cmdlets for SharePoint ::: Check DB that must be upgraded

Hi all,

Today, I’ll write down the PowerShell cmdlets used to diagnostic and solve the error “Database is in compatibility range and upgrade is recommended”.

The reason of this error is simple: I ran the SharePoint Feb 2013 Cumulative Update on my production Farm, and I got errors.
Thus, some DB’s are upgraded, other are not.

Now, I want to list them, and check in my test environment if I can upgrade each DB one by one without having my entire Farm down.
If my farm is down during the process, I must prepare a technical activity and work on it during the night.

I found a post from academicjargon giving the cmdlets to use. 

List DB that need to be upgraded:
Get-SPDatabase | ?{$_.NeedsUpgrade –eq $true} | Select Name

List DB that need to be upgraded and upgrade them:
Get-SPContentDatabase | ?{$_.NeedsUpgrade –eq $true} | Upgrade-SPContentDatabase

And this cmdlet if you want to upgrade one specific content DB:
                Get-SPContentDatabase –Identity SP2010_MySiteContentDB | Upgrade-SPContentDatabase





Job’s done.