shutterstock_184473665.jpg

Summit 7 Team Blogs

Content migration with Nintex Workflows for SharePoint 2013

A lot of customers have recently wanted to know the best way to keep SharePoint 2013 content synchronized between production and test environments. In my opinion, the best way to accomplish this is through the database attach method. Over time, the test environment will get filled with unused site collections, content, updates, workflows, and solutions. This will leave your test environment unusable and different than your production environment, defeating the purpose of having a test environment in the first place. To prevent this, I recommend refreshing the content in your test environment once every few months.

If you have running Nintex Workflows in your production environment, the refreshing of content can be become daunting. I have recently had to migrate content with running workflows between two SharePoint 2013 environments and perform an upgrade from SharePoint 2010 to SharePoint 2013. During this process I ran into a few issues that set me back a few days. This guide, based off of the Nintex Migration guide, should help avoid those issues. One thing to keep in mind is that the Nintex Workflow engine relies on the SharePoint 2013 Workflow engine to be fully functional, you need to be able to create SharePoint 2010 workflows and run them successfully before using this guide.

Note: I recommend using host files on the SharePoint 2013 environment while testing the content migration steps provided.

Pre-requisites

  1. Nintex is installed and versions are the same in both environments
  2. SharePoint 2013 patch levels are the same in both environments
  3. SharePoint 2010 workflow are functional in both environments

Database attach

  1. Stop the SharePoint Timer Service in production
    • Navigate to Administrative Tools on the server
    • Select Services
    • Right-click SharePoint Timer Service
    • Select Stop
  2. Disable Workflow Timer Service in production
    • Navigate to Central Administration
    • Select Monitoring
    • Select Review Job Definitions
    • Select Workflow
    • Select Disable
    • Select OK

Note: The Nintex Workflow Schedule gets deleted when the web application it is attached to is deleted. If the Nintex Workflow Schedule is missing, open Command Prompt as Administrator and run the following commands to add it:

CD "%ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\15\Bin"

.\NWAdmin.exe -o InstallTimerJob -job ScheduledWorkflows -url <WEB APPLICATION>

IISReset

  1. Disable Nintex Workflow Scheduler in production
  • Navigate to Central Administration
  • Select Monitoring
  • Select Review Job Definitions
  • Select Nintex Workflow Scheduler
  • Select Disable
  • Select OK

Note: The Nintex documentation mentions to use DetachDatabase. This command is only required if using Nintex Live Workflows.

  1. In production take a copy-only backup of the Nintex Configuration database
  2. In production take a copy-only backup of the Nintex Content databases
  3. In production take a copy-only backup of the SharePoint content databases
    1. Copy-only backups are used to not interfere with existing backup/restore procedures.

Figure1: SQL Copy-only Backup

  1. Enable Nintex Workflow Scheduler in production
  2. Enable the Workflow Timer Job in production
  3. Start the SharePoint Timer Service in production

Note: At this point all production workflows will continue to work and the production servers can be logged out of.

  1. Restore all databases in the test environments SQL server, make sure to change the names of the databases during the restore to match your test farm database naming convention.
  2. Grant the test farm's farm account database owner permissions to all restored databases

    Figure2: SQL db_owner permissions

  3. Login to the test environment with the farm account
  4. Navigate to Central Administration
  5. Select Web Application Management
  6. Select Manage Content Databases
  7. Select the Web Application you want to restore databases to
  8. Select the Existing Database
  9. Select Remove content database (remove all content databases)

Note: The content databases need to be removed in order to restore the new databases from the production (or SharePoint 2010) environment.

  1. Select OK (This will not delete the database from SQL, it will still be available for re-attaching if needed)

Figure3: Web Application content database removal

  1. Verify all solutions that are deployed in production are also deployed in test
  2. Verify Nintex is installed/deployed and activated in the test environment
  3. Verify the Nintex Workflow Scheduler timer job is installed in test
  4. Disable the Workflow Timer Job in test
  5. Disable the Nintex Workflow Scheduler Timer Job in test
  6. Stop the SharePoint Timer Service in test

Figure4: Stop timer services and jobs

  1. While logged into the test server as the test farm account, run the following PowerShell to mount each content database. Restore the root site collection content database first:
Mount-SPContentDatabase "DATABASENAME" -WebApplication "WEBAPPLICATIONURL"
  1. Verify no errors occurred while mounting the databases, if any errors did occur it is most likely from a solution that was not moved over correctly or a permissions issue. When moving solutions from a 2010 to 2013 environment I found it useful to deploy the solutions with the following PowerShell to avoid database mounting issues that were occurring:
Install-SPSolution -Identity "NAMEOFWSP" -GACDeployment -CompatibilityLevel All -WebApplication "WEBAPPLICATIONURL" -Force

Note: If the Nintex configuration database was not moved, skip steps 28 and 29. Some environments do not have separate Nintex content databases configured, and all configuration/content is stored in the configuration database itself.

  1. In SQL navigate to the test Nintex configuration database
    1. Expand the database
    2. Select the Programmability folder
    3. Expand the Stored Procedures folder
    4. Right-Click and execute the stored procedure "_PrepareForNewEnvironment"

Figure5: Nintex configuration database Stored Procedure

  1. Connect Nintex to the new Configuration database
    • Navigate to Central Administration
    • Select Nintex Workflow Management
    • Select Workflow Database Setup
    • Enter in the new configuration database name you just restored to SQL
  2. Connect Nintex to the new Content databases if applicable
    • Navigate to Central Administration
    • Select Add Content Database
    • Enter in the new content database name you just restored to SQL
  3. Check Nintex Mappings
    • Navigate to Central Administration
    • Select Nintex Workflow Database Setup
    • Select Manage Database Mappings
    • Setup the mappings as needed

Figure6: Nintex Database Mapping

  1. Perform an IIS Reset on the test farm
  2. Start/Enable all the previously stopped timer Jobs
    • Nintex Workflow Scheduler
    • Workflow
    • SharePoint Timer Service
  3. If you are moving from SharePoint 2010 to SharePoint 2013 and you need to convert to claims, run the following PowerShell command:
Convert-SPWebApplication –Identity "WebApplication" –TO Claims –FROM Legacy –RetainPermissions

Note: I ran into issues with this part of the migration, Nintex was not converting users in the Nintex database over to claims automatically. It has a built-in hidden procedure that should auto convert the users for you. If this does not happen upgrade your Nintex version in SharePoint 2010 and SharePoint 2013 to the latest versions and repeat steps 10-34.

To see if they are being converted, navigate to SQL while the Convert-SPWebApplication command is running -> Select the Nintex content database -> Select Tables -> Select dbo.delegationHistory -> Right-click and Select Top 10000 Rows -> verify all users are now showing in claims format (i.e. i:0#.w|domain\username)

  1. Change Site collection administrators to your test users and test your workflows, all running workflows should continue as expected.

Let me know in the comments if you run into any issues. Thank you!

SHARE THIS STORY | |