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.

2 comments:

  1. How do you upgrade the other databases - such as App Management Database, Configuration Database, MetadataWebServiceDatabase,SeachAdminDatabase, etc?

    ReplyDelete
    Replies
    1. Hi John,
      The Database that you are mentionning are system DB and not Content Database.
      To upgrade the system Database, I'm using the classical upgrade via the Configuration Wizard.
      This ticket is only to solve the issue with Content Database that doesn't want to be upgraded with the Configuration Wizard.
      If you check the cmdlets that I've used, they are all related with the "SPContentDatabase".

      Delete