TechnologyMay 12, 2014

How to Simultaneously Upgrade Multiple SharePoint Databases

Will Stokes

SharePoint upgrades can be complicated, requiring many months of planning, programming, and practice.  Today I want to write about optimizing your SharePoint upgrade when using the database attach upgrade method (Microsoft has more info on this method). I’ll also cover some of the errors to look out for and how to avoid them.

what to do

The basic idea is that you attach the SharePoint content databases to the new SharePoint farm by using the Mount-SPContentDatabase command. This command will initiate the upgrade of the content database to the new version of SharePoint.  If you have dozens of content databases (or even just a few very large ones) this process can take days to complete.

The good news? It’s possible to upgrade multiple content databases at the same time.

The bad news? You can upgrade too many at once and bring your upgrades to a crashing halt.

how to upgrade faster

To speed up the upgrade process you can open multiple PowerShell windows at a time and run the Mount-SPContentDatabase command in each of these windows.  Be sure to wait a few minutes before starting the command in the next window or you will run into a conflict error when multiple upgrade commands attempt to start at the same time.  If you have dozens of content databases you can create a PowerShell script that runs one upgrade command after the next.

The total number of database upgrades you can run simultaneously depends on the power of your SQL servers.  If you have SQL servers that conform to Microsoft’s sizing guidelines you should be able to run two to three simultaneous database upgrades on each of your web front-end servers.  The maximum number I have run successfully were 12 simultaneous upgrades running on four web front-end servers and two SQL servers.  When I attempted to run more than 12 I ran into these errors:

  • A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

  • Action of of Microsoft.SharePoint.Upgrade.SpContentDatabaseSequence failed to rollback.

  • An update conflict has occurred, and you must re-try this action.  The object SPClaimProviderManager Name=ClaimProvider Manager was updated by [farm account].

  • An update conflict has occurred, and you must re-try this action.  The object SPLargeListThrottleSettings was updated by [farm account].

  • Failed to acquire the lock to object [SPWebApplication Name=[web application name] after 120 retries.

  • Could not connect to [DB server name] using integrated security: Cannot connect to database master at SQL server at [DB server name]. The database might not exist, or the current user does not have permission to connect to it.

If I limited the number of simultaneous database upgrades to 12 (or three per web front end server) I stopped seeing the errors above.

upgrade script

I followed this script during the upgrades:

1.  Open three PowerShell windows on each web front-end server.

2.  Start the first script on the first web front-end server.

3. Wait up to five minutes or until the upgrade completion percentage indicator in the PowerShell window shows more than one percent completion.  If you start another script before this you can run into the update conflict errors listed above.

4.  Start the next upgrade script in the second PowerShell window and wait as you did in the first window instance.

5.  Move to the other PowerShell and then the other web front-end servers and start the upgrade commands.

If there are any errors during the upgrade they will be shown in the PowerShell window with more details available in the upgrade log in your SharePoint log directory.  You can review and determine if they are upgrade stoppers or just warnings.

test it first

One last piece of advice: Practice! Do not attempt to upgrade your SharePoint environment without creating a test environment and running through your upgrade at least once.  It is very rare for any SharePoint upgrade to go perfectly and if you attempt to upgrade without a test run you are almost guaranteeing failure.

For more great SharePoint tips, follow us on LinkedIn. At Credera we’ve helped some of the largest companies in the world upgrade their SharePoint farms. If you have a SharePoint environment that needs upgrading, please contact us — we would love to help you!

Explore Our Microsoft Consulting Services  →