Datapolis Process System

Search:

Contents
:
IndexBookmarkPrint
Home > Installation Guide > Migration scenarios > Advanced migration scenarios > Migrating from SharePoint 2010 to 2013 (splitting database scenario)

Migrating from SharePoint 2010 to 2013 (splitting database scenario)

 

If you cannot migrate your SharePoint 2010 farm to the 2013 all at once, following steps will show how to migrate your Datapolis Workbox 2010 workflows only from one selected SharePoint web application.

  1. On SharePoint 2010 make sure your installed Workbox 2010 version is  2.3.20.1582 and Workbox database version is 1.0.0.3 
  2. On SharePoint 2013 make sure your installed Datapolis Process System version is 4.2.0.4616  and Workbox database version is 1.0.0.20
  3. Migrate your SharePoint 2010 web application content to SharePoint 2013 following Microsoft guidelines.
    1. It is highly recommended uninstall the Workbox 2010 for the time of creating SharePoint 2010 web application content database backup. (Install Workbox after it again)
  4. Migrate all your custom Workbox 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].[SelfTimers](

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

           [AppId] [uniqueidentifier] NULL,

           [SiteId] [uniqueidentifier] NULL,

           [WebId] [uniqueidentifier] NULL,

           [ListId] [uniqueidentifier] NULL,

           [ItemId] [int] NULL,

           [WorkflowInstanceId] [uniqueidentifier] NULL,

           [StartTime] [datetime2](7) NULL,

           [ActionName] [nvarchar](100) NULL,

           [StateInstanceId] [uniqueidentifier] NULL,

     CONSTRAINT [PK_SelfTimers] 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]

     

    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,

     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_2010_SPFarm>) selected content to the temporary database with following script:
    (remember to replace <source_DP_DB_2010_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_2010_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_2010_database_name>.[dbo].[History] WHERE [AppId] = @appId_SOURCE

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

     

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

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

    ([Id]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[StartTime]

    ,[ActionName]

    ,[StateInstanceId])

    SELECT [Id]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[StartTime]

    ,[ActionName]

    ,[StateInstanceId] FROM <source_DP_DB_2010_database_name>.[dbo].[SelfTimers] WHERE [AppId] = @appId_SOURCE

    SET IDENTITY_INSERT <temporary_database_name>.[dbo].[SelfTimers] 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_2010_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_2010_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_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

     

    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]

    ,[WorkflowInstanceId]

    ,[ActionName]

    ,[StateInstanceId])

    SELECT 5

    ,N'SHAREPOINT\SYSTEM'

    ,@now

    ,[StartTime]

    ,[StartTime]

    ,0

    ,0

    ,@appId_DEST -- set new app id

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,N''

    ,[WorkflowInstanceId]

    ,N''

    ,N''

    ,N'<Result />'

    ,[StartTime]

    ,1000

    ,20

    ,20

    ,[WorkflowInstanceId]

    ,[ActionName]

    ,[StateInstanceId] FROM <temporary_database_name>.[dbo].[SelfTimers] WHERE [AppId] = @appId_SOURCE

     

    COMMIT TRANSACTION @TranName;

     

    SET STATISTICS TIME OFF