Monday, March 13, 2017

UPGRADE SITE COLLECTIONS TO SHAREPOINT 2016

UPGRADE SITE COLLECTIONS TO SHAREPOINT 2016

In this blog post, I want to show you a practical way in order to upgrade a simple SharePoint 2013 site collection to SharePoint 2016. When you want to Upgrade your SharePoint 2013 site collection to a SharePoint 2016, you should have installed SharePoint 2013 service pack 1 before beginning the upgrade process.
We use the database attach method in order to upgrade to SharePoint 2016 and it is assumed that you have a working farm of SharePoint 2016. In this blog post, I don’t cover how to setup the SharePoint 2016 farm and configure the service applications.

SHAREPOINT 2013 TO SHAREPOINT 2016 UPGRADE STEPS

  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

You may currently have a site collection that you can use to do your POC (proof of concept) upgrade. But in this blog post, I will create a brand new site collection in the SharePoint 2013 environment to test the upgrade process from SharePoint 2013 to SharePoint 2016.

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.
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:
These powershells must be run on your SharePoint 2016 farm

6

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.
7
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.
8
ou see the upgrade page, you can now click on the Review Site Collection Upgrade Status to see the report.
9
As you see in the upgrade process is done without any error or warnings
10

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:

Post a Comment