Datapolis Process System

Search:

Contents
:
IndexBookmarkPrint
Home > Installation Guide > Migration scenarios > Advanced migration scenarios > Migrating of SharePoint 2013 Web Application

Migrating of SharePoint 2013 Web Application

 

If you cannot migrate your SharePoint 2013 farm to another Sharepoint 2013 farm all at once, following steps will show how to migrate your Datapolis Process System workflows only from one selected SharePoint web application.

  1. On old SharePoint 2013 make sure your installed Datapolis Process System version is 4.3.20.4702 or higher. 
  2. On new SharePoint 2013 make sure your installed Datapolis Process System version is same as on old SharePoint 2013.
  3. Migrate your old SharePoint 2013 web application content to new SharePoint 2013 following Microsoft guidelines.
    1. It is highly recommended uninstall the Datapolis Process System for the time of creating SharePoint 2013 web application content database backup. (Install Datapolis Process System after it again)
  4. Migrate all your custom Datapolis Process System solution such as features and activities to the new environment.
  5. Create temporary database with following script
    (remember to replace <temporary_database_name>).

     

    -- create temporary db

     

    CREATE DATABASE <temporary_database_name>

    GO

     

    USE <temporary_database_name>

    GO

     

     -- create tables

    SET ANSI_NULLS ON

    GO

     

    SET QUOTED_IDENTIFIER ON

    GO

     

    CREATE TABLE [dbo].[Associations](

           [Id] [int] IDENTITY(1,1) NOT NULL,

           [AssociationId] [uniqueidentifier] NULL,

           [AppId] [uniqueidentifier] NULL,

           [SiteId] [uniqueidentifier] NULL,

           [WebId] [uniqueidentifier] NULL,

           [ListId] [uniqueidentifier] NULL,

           [AssociationType] [int] NULL,

           [AssociationContent] [nvarchar](max) NULL,

           [WBVersion] [nvarchar](20) NULL,

           [AssociationReferenceId] [uniqueidentifier] NULL,

     CONSTRAINT [PK_Associations] PRIMARY KEY CLUSTERED

    (

           [Id] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

     

    GO

     

    CREATE TABLE [dbo].[History](

           [Id] [int] IDENTITY(1,1) NOT NULL,

           [WorkflowInstanceId] [uniqueidentifier] NULL,

           [AssociationId] [uniqueidentifier] NULL,

           [TemplateId] [uniqueidentifier] NULL,

           [AppId] [uniqueidentifier] NULL,

           [SiteId] [uniqueidentifier] NULL,

           [WebId] [uniqueidentifier] NULL,

           [ListId] [uniqueidentifier] NULL,

           [ItemId] [int] NULL,

           [UserId] [int] NULL,

           [UserLogin] [nvarchar](100) NULL,

           [Occured] [datetime2](7) NULL,

           [EventType] [int] NULL,

           [EventName] [nvarchar](100) NULL,

           [EventTitle] [nvarchar](100) NULL,

           [EventContent] [nvarchar](max) NULL,

           [WBVersion] [nvarchar](20) NULL,

           [AssociationReferenceId] [uniqueidentifier] NULL,

     CONSTRAINT [PK_History] PRIMARY KEY CLUSTERED

    (

           [Id] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

     

    GO

     

    CREATE TABLE [dbo].[WBXml](

           [Id] [int] IDENTITY(1,1) NOT NULL,

           [AppId] [uniqueidentifier] NULL,

           [SiteId] [uniqueidentifier] NULL,

           [WebId] [uniqueidentifier] NULL,

           [ListId] [uniqueidentifier] NULL,

           [BaseId] [uniqueidentifier] NULL,

           [ItemId] [int] NULL,

           [WorkflowInstanceId] [uniqueidentifier] NULL,

           [AssociationId] [uniqueidentifier] NULL,

           [StateTitle] [nvarchar](100) NULL,

           [ShowActions] [bit] NULL,

           [WBXmlContent] [nvarchar](max) NULL,

           [WBVersion] [nvarchar](20) NULL,

     CONSTRAINT [PK_WBXml] PRIMARY KEY CLUSTERED

    (

           [Id] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

     

    GO

     

    CREATE TABLE [dbo].[Tasks](

           [Id] [int] IDENTITY(1,1) NOT NULL,

           [TaskType] [int] NULL,

           [CreatedBy] [nvarchar](100) NULL,

           [Created] [datetime2](7) NULL,

           [Started] [datetime2](7) NULL,

           [Finished] [datetime2](7) NULL,

           [TaskState] [int] NULL,

           [Progress] [int] NULL,

           [AppId] [uniqueidentifier] NULL,

           [SiteId] [uniqueidentifier] NULL,

           [WebId] [uniqueidentifier] NULL,

           [ListId] [uniqueidentifier] NULL,

           [ItemId] [int] NULL,

           [ItemIds] [nvarchar](max) NULL,

           [WorkflowId] [uniqueidentifier] NULL,

           [WorkflowIds] [nvarchar](max) NULL,

           [TaskContent] [nvarchar](max) NULL,

           [Result] [nvarchar](max) NULL,

           [StartDate] [datetime2](7) NULL,

           [WorkflowInstanceId] [uniqueidentifier] NULL,

           [ActionName][nvarchar](100) NULL,

           [StateInstanceId] [uniqueidentifier] NULL,

           [WorkflowId] [uniqueidentifier] NULL,

           [WorkflowIds] [nvarchar](max) NULL,

           [TaskContent] [nvarchar](max) NULL,

           [Result] [nvarchar](max) NULL,

     CONSTRAINT [PK_Tasks] PRIMARY KEY CLUSTERED

    (

           [Id] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

     

    GO

     

     

  6. Copy Workbox database (DP_DB_<guid_of_your_old_2013_SPFarm>) selected content to the temporary database with following script:
    (remember to replace <source_DP_DB_old)2013_database_name>, <temporary_database_name> and indicate your web application id (@appId_SOURCE) variable value).

     

    --from

    --SOURCE DB <source_DP_DB_2010_database_name>

    --to

    --TEMP DB <temporary_database_name>

     

    -- remeber to replace database names in scrips !!!

     

    SET STATISTICS TIME ON

    DECLARE @TranName VARCHAR(50);

    SET @TranName = 'CopyDPDBContentToTemp';

     

    BEGIN TRANSACTION @TranName;

     

    -- id of the web application that will be migrated

    DECLARE @appId_SOURCE uniqueidentifier = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

     

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[Associations] ON

    INSERT INTO <temporary_database_name>.[dbo].[Associations]

    ([Id]

    ,[AssociationId]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[AssociationType]

    ,[AssociationContent]

    ,[WBVersion]

    ,[AssociationReferenceId])

    SELECT [Id]

    ,[AssociationId]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[AssociationType]

    ,[AssociationContent]

    ,[WBVersion]

    ,[AssociationReferenceId] FROM <source_DP_DB_old_2013_database_name>.[dbo].[Associations] WHERE [AppId] = @appId_SOURCE

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[Associations] OFF

     

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[History] ON

    INSERT INTO <temporary_database_name>.[dbo].[History]

    ([Id]

    ,[WorkflowInstanceId]

    ,[AssociationId]

    ,[TemplateId]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[UserId]

    ,[UserLogin]

    ,[Occured]

    ,[EventType]

    ,[EventName]

    ,[EventTitle]

    ,[EventContent]

    ,[WBVersion]

    ,[AssociationReferenceId])

    SELECT [Id]

    ,[WorkflowInstanceId]

    ,[AssociationId]

    ,[TemplateId]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[UserId]

    ,[UserLogin]

    ,[Occured]

    ,[EventType]

    ,[EventName]

    ,[EventTitle]

    ,[EventContent]

    ,[WBVersion]

    ,[AssociationReferenceId] FROM <source_DP_DB_old_2013_database_name>.[dbo].[History] WHERE [AppId] = @appId_SOURCE

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[History] OFF

     

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[Tasks] ON

    INSERT INTO <temporary_database_name>.[dbo].[Tasks]

    ([Id]

    ,[TaskType]

    ,[CreatedBy]

    ,[Created]

    ,[Started]

    ,[Finished]

    ,[TaskState]

    ,[Progress]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[ItemIds]

    ,[WorkflowId]

    ,[WorkflowIds]

    ,[TaskContent]

    ,[Result])

    SELECT [Id]

    ,[TaskType]

    ,[CreatedBy]

    ,[Created]

    ,[Started]

    ,[Finished]

    ,[TaskState]

    ,[Progress]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[ItemIds]

    ,[WorkflowId]

    ,[WorkflowIds]

    ,[TaskContent]

    ,[Result]  FROM <source_DP_DB_old_2013_database_name>.[dbo].[Tasks] WHERE [AppId] = @appId_SOURCE

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[Tasks] OFF

     

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[WBXml] ON

    INSERT INTO <temporary_database_name>.[dbo].[WBXml]

    ([Id]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[BaseId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[AssociationId]

    ,[StateTitle]

    ,[ShowActions]

    ,[WBXmlContent]

    ,[WBVersion])

    SELECT [Id]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[BaseId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[AssociationId]

    ,[StateTitle]

    ,[ShowActions]

    ,[WBXmlContent]

    ,[WBVersion] FROM <source_DP_DB_old_2013_database_name>.[dbo].[WBXml] WHERE [AppId] = @appId_SOURCE

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[WBXml] OFF

     

    COMMIT TRANSACTION @TranName

     

    SET STATISTICS TIME OFF

     

     

  7. Now you can make a backup of the temporary database and move it to the destination SharePoint 2013 environment.
  8. ​When the temporary database is in place you can append it's content to the Datapolis Process System database (DP_DB_<guid_of_your_new_2013_SPFarm>) with the following script
    (remember to replace <destination_DP_DB_2013_database_name>, <temporary_database_name> and indicate your web applications ids (@appId_SOURCE, @appId_DEST) variables values).

     

    --from

    --TEMPORARY DB <temporary_database_name>

    --to

    --DESTINATION DB <destination_DP_DB_2013_database_name>

     

    -- remeber to replace databasenames in scrips !!!

     

    SET STATISTICS TIME ON

     

    DECLARE @TranName VARCHAR(50);

    SET @TranName = 'MigrateContent';

     

    BEGIN TRANSACTION @TranName;

     

    DECLARE @appId_SOURCE uniqueidentifier = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

    DECLARE @appId_DEST uniqueidentifier = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

     

    INSERT INTO <destination_DP_DB_2013_database_name>.[dbo].[Associations]

    ([AssociationId]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[AssociationType]

    ,[AssociationContent]

    ,[WBVersion]

    ,[AssociationReferenceId])

    SELECT [AssociationId]

    ,@appId_DEST -- set new app id

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[AssociationType]

    ,[AssociationContent]

    ,[WBVersion]

    ,[AssociationReferenceId] FROM <temporary_database_name>.[dbo].[Associations] WHERE [AppId] = @appId_SOURCE

     

    INSERT INTO <destination_DP_DB_2013_database_name>.[dbo].[History]

    ([WorkflowInstanceId]

    ,[AssociationId]

    ,[TemplateId]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[UserId]

    ,[UserLogin]

    ,[Occured]

    ,[EventType]

    ,[EventName]

    ,[EventTitle]

    ,[EventContent]

    ,[WBVersion]

    ,[AssociationReferenceId])

    SELECT [WorkflowInstanceId]

    ,[AssociationId]

    ,[TemplateId]

    ,@appId_DEST -- set new app id

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[UserId]

    ,[UserLogin]

    ,[Occured]

    ,[EventType]

    ,[EventName]

    ,[EventTitle]

    ,[EventContent]

    ,[WBVersion]

    ,[AssociationReferenceId] FROM <temporary_database_name>.[dbo].[History] WHERE [AppId] = @appId_SOURCE

     

    DECLARE @now datetime2(7) = GETDATE()

    INSERT INTO <destination_DP_DB_2013_database_name>.[dbo].[WBXml]

    ([AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[BaseId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[AssociationId]

    ,[StateTitle]

    ,[ShowActions]

    ,[WBXmlContent]

    ,[WBVersion]

    ,[Status]

    ,[StatusDetails]

    ,[StatusLog]

    ,[DateOfLastUpdate])

    SELECT @appId_DEST -- set new app id

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[BaseId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[AssociationId]

    ,[StateTitle]

    ,[ShowActions]

    ,[WBXmlContent]

    ,[WBVersion]

    ,N'Active'

    ,N'Normal'

    ,N'Migration'

    ,@now FROM <temporary_database_name>.[dbo].[WBXml] WHERE [AppId] = @appId_SOURCE

     

    INSERT INTO <destination_DP_DB_2013_database_name>.[dbo].[Tasks]

    ([TaskType]

    ,[CreatedBy]

    ,[Created]

    ,[Started]

    ,[Finished]

    ,[TaskState]

    ,[Progress]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[ItemIds]

    ,[WorkflowId]

    ,[WorkflowIds]

    ,[TaskContent]

    ,[Result]

    ,[StartDate]

    ,[Priority]

    ,[TriesLeft]

    ,[RetryInterval])

    SELECT [TaskType]

    ,[CreatedBy]

    ,[Created]

    ,[Started]

    ,[Finished]

    ,[TaskState]

    ,[Progress]

    ,@appId_DEST -- set new app id

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[ItemIds]

    ,[WorkflowId]

    ,[WorkflowIds]

    ,[TaskContent]

    ,[Result]

    ,[Started]

    ,900

    ,3

    ,0 FROM <temporary_database_name>.[dbo].[Tasks] WHERE [AppId] = @appId_SOURCE

     

    COMMIT TRANSACTION @TranName;

     

    SET STATISTICS TIME OFF