Running Test-SPContentDatabase
Now that the databases are restored and
configured correctly, you can start testing them to see how nicely
they’ll play with SharePoint 2013. When upgrading from SharePoint 2007
to SharePoint 2010, you had a great way to assess the challenges that
lay ahead of you: the preupgrade-check operation in STSADM.EXE. It
would inventory your SharePoint 2007 environment and point you to any
problems you might have before you upgraded. Unfortunately, this tool
is not available when upgrading to SharePoint 2013, but there is a
suitable replacement in Test-SPContentDatabase.
You can run this cmdlet on either SharePoint 2010 or on SharePoint 2013
before the database is attached. It needs the name of the database you
want to attach, and the web application to which you want to attach it.
When it executes, it goes through the database and compares it to the
farm and the web application to ensure that all the pieces needed to
render the content in the database are in place. Some databases are
more cooperative than others. Figures 2 and 3 show the output from the following statement:
Test-SPContentDatabase -Name WSS_Content_tk_com -WebApplication
http://upgrade.contoso.com
These figures show a few things. The first line is Get-SPWebApplication, which returns a list of all the web apps in the SharePoint 2013 farm by name and URL. When using Test-SPContentDatabase you can use the web app’s URL or its name. Without any additional parameters, Test-SPContentDatabase
simply lists the objects in the content database that the web
application or the farm cannot support. Figures 6 and 7 show a few
errors in the content database. Before addressing each issue, however,
let’s look at some techniques you can use when you have a particularly
troublesome database like the one shown here. When you have
a database with a significant number of issues, they can fill the
screen buffer and you miss the issues at the top. If you run Start-Transcript before you run Test-SPContentdatabase,
all of its output will be written to the transcript file saved in your
Documents folder. You can reference that file if any issues scroll off
the screen. You can also pipe the output through the more command so that it only shows one page at a time, like this:
Test-SPContentDatabase -Name WSS_Content_tk_com -WebApplication
http://upgrade.contoso.com | more
Press the spacebar to see the next page.
When mounting a database, you’ll end up fixing an issue or two, then rerunning Test-SPContentDatabase
to see how much progress you’ve made. If your database has a lot of
issues, like the one in the figures, it’s easy to lose track of how
many issues you’ve cleared and how many you have left. You can use the count
property to get the number of issues. As you clear up issues, you will
see the number go down. To get only the number of issues in the
database, use the following syntax:
(Test-SPContentDatabase -Name WSS_Content_tk_com -WebApplication
http://upgrade.contoso.com).count
Your only output will be a number; the smaller the better.
Now let’s walk through each issue and see what can be done to address it.