Wednesday, March 29, 2017

Upgrade SharePoint 2013 to SharePoint 2016 Steps

There is no in-place upgrade from SharePoint 2013. You must upgrade each content database using the Database Attach and upgrade Method. SharePoint 2016 does not support classic mode authentication. Many SharePoint 2013 web applications still utilize classic mode authentication.  For content databases using classic mode authentication, you must migrate to Claims Based authentication before you begin migrating your data. According to the Microsoft TechNet Article, “SharePoint Server 2016 supports an upgrade from SharePoint Server 2013 with Service Pack 1 (SP1) with March 2013 PU, version 15.0.4481.1005 or higher. All database must be upgraded to version 15.0.4481.1005 or higher, otherwise upgrade to SharePoint Server 2016 will be blocked.”  https://technet.microsoft.com/en-us/library/cc262483(v=office.16).aspx
  1. Create a new site collection in SharePoint 2013
  2. Move the site to a temporary database
  3. Make a copy of DB in SharePoint 2013 environment and move it to the SharePoint 2016 database server
  4. Test the SharePoint 2013 attached DB in SharePoint 2016 environment, Mount the DB and upgrade DB
  5. Change the site collection owner and Hit the site and test everything

STEP 1 – CREATE A NEW SITE COLLECTION IN THE SHAREPOINT 2013

Create a brand new site collection in the SharePoint 2013 environment to test the upgrade process from SharePoint 2013 to SharePoint 2016.

$template = Get-SPWebTemplate "STS#0"
New-SPSite -Url $varSharePoint2013SiteCol -OwnerAlias $varSharePoint2013admin -Template $template

in this Powershell cmdlet, we create a new site collection in SharePoint 2013 based on the team site template.

STEP 2 – MOVE THE SITE COLLECTION TO A TEMPORARY DATABASE

It is always good to move the site collection into a new database and then move the new database to SharePoint 2016. By doing this, you will not face any orphaned object problem while upgrading. Sometimes SharePoint doesn’t clear the database nicely when you delete items from the interface and this will cause the orphaned object problem. Orphaned object means you have deleted something from the SharePoint interface (list, subsite,..), but the object is still exist in the database level. So it is always a good practice to move the site collection to a new database before upgrading.

New-SPContentDatabase $varSharePoint2013TempDB -DatabaseServer $varSharePoint2013DBServerName -WebApplication $varSharePoint2013WebApp
Move-SPSite $varSharePoint2013SiteCol -DestinationDatabase $varSharePoint2013TempDB

After moving the site into a new db, you have to do IIS reset

STEP 3 – MOVE THE DB

This step is done on SQL Servers. First you have to login to your SharePoint 2013 SQL Server machine and connect to your SQL Server instance with the SQL Server management studio.
Expand databases node, right click on the database name -> tasks -> backup
Copy the backup file to the SharePoint 2016 database server.
Open SQL server management studio in SharePoint 2016 database server.
Connect to the database server
Right click on database, select restore database
Select the device and select your backup file
Double check everything, and click on ok
The database name will show in the list of databases
Now you have to add the farm account to the database as the db_owner role.
Expand the database name -> security – > users and add the SharePoint 2016 farm account
[I have different accounts for setup and farm as Microsoft suggested in the best practice, I added both of them as the user of this db and made them db_owner]

STEP 4 – TEST AND MOUNT THE DB

If the managed path does not exist in SharePoint 2016, you can create it with this cmdlet:

New-SPManagedPath "Teams" -WebApplication "http://somesite"

These powershells must be run on your SharePoint 2016 farm

Test-SPContentDatabase -Name $varSharePoint2013TempDB -WebApplication $varSharePoint2016WebApp
Mount-SPContentDatabase -Name $varSharePoint2013TempDB -DatabaseServer $varSharePoint2016DBServerName -WebApplication $varSharePoint2016WebApp
$wa = Get-SPWebApplication -identity $varSharePoint2016WebApp
$wa.GrantAccessToProcessIdentity($varSharePoint2016ServiceApp)

STEP 5 – VERIFICATION

now the upgrade process is completed. It is likely that you have different accounts to access your SharePoint 2013 and SharePoint 2016 environment. So now if you hit the site you will see an access denied message. You have to login to the SharePoint 2016 central administration and change the site collection administrator for the newly upgraded site to your SharePoint 2016 site admin. Then you can hit the site and see the home page of the site.
In order to verify that the upgrade process is done without any error, you have to go to the site settings and under the “Site Collection Administration” section, click on the Site collection upgrade link.
You see the upgrade page, you can now click on the Review Site Collection Upgrade Status to see the report.
As you see in the upgrade process is done without any error or warnings
Here you have the whole powershell script for this blogpost. You can use this powershell to upgrade your sites from SharePoint 2013 to SharePoint 2016. Just remember step 1 and 2 are done in SharePoint 2013 environment, step 3 are done on SQL servers of both environment via GUI and step 4 and 5 are in SharePoint 2016 environment

$snapin = Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue -PassThru
if ($snapin -eq $null) {
    Write-Error "Unable to load the Microsoft.SharePoint.PowerShell Snapin! Have you installed SharePoint?"
    return
}
#############
# Parameters
#############
$varSharePoint2013admin = ""
$varSharePoint2013WebApp = ""
$varSharePoint2013SiteCol = ""
$varSharePoint2013TempDB = ""
$varSharePoint2013DBServerName = ""
$varSharePoint2016admin = ""
$varSharePoint2016WebApp = ""
$varSharePoint2016SiteCol = ""
$varSharePoint2016ManagedPath = ""
$varSharePoint2016DBServerName = ""
$varSharePoint2016ServiceApp =" "
###################
# step 1 - create site collection
###################
$template = Get-SPWebTemplate "STS#0"
New-SPSite -Url $varSharePoint2013SiteCol -OwnerAlias $varSharePoint2013admin -Template $template
###################
# step 2 - Move the site collection to a new DB
###################
New-SPContentDatabase $varSharePoint2013TempDB -DatabaseServer $varSharePoint2013DBServerName -WebApplication $varSharePoint2013WebApp
Move-SPSite $varSharePoint2013SiteCol -DestinationDatabase $varSharePoint2013TempDB
###################
# step 3 - Move DB to 16 env [done via GUI]
###################
###################
# step 4 - upgrade
###################
Test-SPContentDatabase -Name $varSharePoint2013TempDB -WebApplication $varSharePoint2016WebApp
Mount-SPContentDatabase -Name $varSharePoint2013TempDB -DatabaseServer $varSharePoint2016DBServerName -WebApplication $varSharePoint2016WebApp
$wa = Get-SPWebApplication -identity $varSharePoint2016WebApp
$wa.GrantAccessToProcessIdentity($varSharePoint2016ServiceApp)
###################
# step 5 - verify
###################
Start iexplore $varSharePoint2016SiteCol


No comments: