3. Attach Content Databases
If you have followed the previous section
about attaching service application databases, then the process for
attaching content databases should not phase you. The process to attach
content databases to the SharePoint 2013 SQL Server instance is identical to that of the service applications, as follows:
- Open SQL Management Studio.
- Right-click the Databases node in the Object Explorer.
- Click the Restore Database menu item.
- Change the source location as From device.
- Click the ellipses, then the Add button on the next dialog.
- Browse for the database backup file.
- Click the OK button.
- Check the check box to restore the selected database.
- Click the drop-down for the destination database.
- Select the database to restore.
Once you have attached the content databases, you will notice that the databases are read-only
(if you followed the earlier detachment process). The following steps
demonstrate setting the content databases as writable, which SharePoint
2013 requires to perform an upgrade:
- Right-click the database in SQL Management Studio.
- Select the Properties menu item.
- Choose the Options category on the right of the dialog.
- Scroll down to the option for Database Read-Only.
- Set the option to False and then click the OK button.
With the content databases attached to SQL
Server and set as writable, you are now ready to begin the upgrade
process. Each web application hosts a single content database, so you
must create your web applications first, before attaching the content
databases for upgrade.
Before creating
your web applications, consider the following points, which will make
the process of upgrading to SharePoint 2013 smoother:
- Create your web applications on the same URLs and ports, to keep compatibility with bookmarks and Office applications
- Configure alternate access mappings and managed paths so site collections upgrade correctly
- Use the same authentication configuration—if you wish to upgrade
from Classic to Claims-Based-Authentication, upgrade the web
application post database upgrade
- Configure e-mail settings for the application
- Configure self-service settings for the application
- Re-create any web application security policies
You can create new web applications within Central Administration.
However, CA will create a default content database, and CA will not
allow you to create Classic Authentication Mode applications. As is
often the case, PowerShell provides granular control and is what I
shall use in my demonstration.
I shall
re-create both these applications in my new SharePoint 2013 farm. I
adopted best practice and used Claims-Based-Authentication prior and so
provision the new web applications the same. The following Cmdlet
creates a new web application for my Intranet:
New-SPWebApplication -Name 'Intranet' -ApplicationPool 'Intranet App Pool' -ApplicationPoolAccount 'ROBDEMO\sp_app_pool' -URL ' http://robdemo-sp/ ' -Port 80 -AuthenticationProvider (New-SPAuthenticationProvider)
The following Cmdlet creates a similar web application for my public facing Web Site:
New-SPWebApplication-Name 'Public Web Site' -ApplicationPool 'Public Site App Pool' -ApplicationPoolAccount 'ROBDEMO\sp_app_pool' -URL ' http://robdemo-sp/ ' -Port 5000 -AuthenticationProvider (New-SPAuthenticationProvider) –AllowAnonymousAccess
Notice that in the previous Cmdlet I specified
a different port allow anonymous access, because my public site does
not require authentication for most users.
INSTALL CUSTOMIZATIONS
Now that you have your web applications
created, it is a good time to install any customizations that apply to
the applications. You can ignore any visual customizations
and metadata customizations that reside in the database because the
database attach upgrade will take care of these. However, you must
install any Global Assembly assemblies, assemblies installed in the web
application BIN, and files deployed to the hive.
If you have any “globally deployed” solution
packages, you can deploy them to the farm and activate any web
application scoped features. Make sure you also deploy any site
collection and site scoped features; even though the site collection or
sites in the database reference the feature, you still need to ensure
that you deploy any dependencies (such as hive files).
If you have made manual configuration changes
to your configuration files in the legacy farm, and not packaged these
as solution packages (tsk, tsk), now is also the time to apply these
changes to the newly created web applications.
My demonstration sites do not depend on any
visual files in the hive (they live in the Style Gallery and Master
Page Gallery), so I have no need to perform any additional
customizations to my SharePoint 2013 farm.
Note SharePoint 2013 supports legacy hive customizations. Deploy any legacy customizations to the Web Server Extensions\14 directory if you plan to operate sites in SharePoint 2010 legacy mode. New customizations deploy to the Web Server Extensions\15 directory.
Before you upgrade your content databases and
attach them to your web applications, you should test them first.
Content databases can reach large sizes, and the last thing you want is
to wait hours for an upgrade only to have it fail part way. The
following PowerShell Cmdlet allows users to test
a content database. If you have multiple content databases for a web
application, test them all:
Test-SPContentDatabase -Name DatabaseName -WebApplication URL
Now, finally, the moment you have been waiting
for—it is time to mount your legacy content databases and let
SharePoint 2013 upgrade them. Issue the following PowerShell Cmdlet for
each of your content databases:
Mount-SPContentDatabase -Name DatabaseName -DatabaseServer ServerName -WebApplication URL
Note Use separate PowerShell windows to upgrade multiple content databases in parallel.
I executed the following PowerShell Cmdlets in my environment to upgrade my two web application content databases:
Mount-SPContentDatabase -Name 'WSS_Content_Pub' -DatabaseServer ROBDEMO-SP -WebApplication http://robdemo-sp:5000
Mount-SPContentDatabase -Name 'ROBDEMO_PortalContent' -DatabaseServer ROBDEMO-SP -WebApplication http://robdemo-sp
Similar to upgrading the service application
database, you can check on the status of your content database upgrades
from Central Administration, under the Upgrade and Migration heading (Figure 8).
Note Upgrading
the My Sites database is a similar process to upgrading content
databases. However, make sure that you have a working My Site Host web
application and that you upgrade the database containing the My Site
Host root site collection first.