Upgrading your SharePoint databases
If you look at the “Review database status” page under “Upgrade and Migration” in SharePoint 2010 Central Administration, you may see a message in the status column that says something like “Database in compatibility range and an upgrade is recommended”. To do this you need to run the PowerShell command “Upgrade-SPContentDatabase but to do this you need to get the identity of each database you want to upgrade and run this command for each one. I have numerous clients that have more than one content db, and you may also want to upgrade the Central Admin databases too, so I have written a PowerShell function that takes in the Web Application and upgrades all databases attached to it:
Function UpgradeDatabases($webApp)
{
$web = Get-SPWebApplication -Identity $webApp
foreach($contentDB in $web.ContentDatabases)
{
Upgrade-SPContentDatabase -id $contentDB
}
}
A pretty straight forward function. Below is the ps1 file.
Download UpgradeDatabases file
Disclaimer:
Please read the disclaimer if you plan on using anything from this article.
