Datapolis Process System

Search:

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

Migration of SharePoint 2010 Web Application

 

The steps below will show you how to move your Workbox 2010 workflows with one of web application from one SharePoint 2010 Farm to to another.

  1. Make sure your installed Workbox 2010 version is  2.3.20.1582 and Workbox database version is 1.0.0.3 on both farms.
  2. Migrate your SharePoint 2010 web application content from one farm to another following Microsoft guidelines.
  3. Install all your custom Workbox solution such as features and activities in the new environment.
  4. 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

     

  5. Copy Workbox database (DP_DB_<guid_of_your_2010_SPFarm>) 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

     

  6. ​When the temporary database is in place you can append it's content to the destination Workbox 2010 database (DP_DB_<guid_of_your_2010_destination_SPFarm>) with the following script
    (remember to replace <destination_DP_DB_2010_database_name>, <temporary_database_name> and indicate your web applications ids (@appId_SOURCE, @appId_DEST) variables values).

     

    --from

    --TEMPORARY DATABASE <temporary_database_name>

    --to

    --DESTINATION DATABASE <destination_DP_DB_2010_database_name>

     

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

     

    SET STATISTICS TIME ON

    DECLARE @TranName VARCHAR(50);

    SET @TranName = 'CopyContentFromTemp';

     

    BEGIN TRANSACTION @TranName;

     

    -- ids of the web applications that will be migrated

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

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

     

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

    ([AssociationId]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[AssociationType]

    ,[AssociationContent]

    ,[WBVersion]

    ,[AssociationReferenceId])

    SELECT [AssociationId]

    ,@appId_DEST

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[AssociationType]

    ,[AssociationContent]

    ,[WBVersion]

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

     

    INSERT INTO <destination_DP_DB_2010_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

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[UserId]

    ,[UserLogin]

    ,[Occured]

    ,[EventType]

    ,[EventName]

    ,[EventTitle]

    ,[EventContent]

    ,[WBVersion]

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

     

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

    ([AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[StartTime]

    ,[ActionName]

    ,[StateInstanceId])

    SELECT @appId_DEST

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[StartTime]

    ,[ActionName]

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

     

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

    ([TaskType]

    ,[CreatedBy]

    ,[Created]

    ,[Started]

    ,[Finished]

    ,[TaskState]

    ,[Progress]

    ,[AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[ItemIds]

    ,[WorkflowId]

    ,[WorkflowIds]

    ,[TaskContent]

    ,[Result])

    SELECT [TaskType]

    ,[CreatedBy]

    ,[Created]

    ,[Started]

    ,[Finished]

    ,[TaskState]

    ,[Progress]

    ,@appId_DEST

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[ItemId]

    ,[ItemIds]

    ,[WorkflowId]

    ,[WorkflowIds]

    ,[TaskContent]

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

     

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

    ([AppId]

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[BaseId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[AssociationId]

    ,[StateTitle]

    ,[ShowActions]

    ,[WBXmlContent]

    ,[WBVersion])

    SELECT @appId_DEST

    ,[SiteId]

    ,[WebId]

    ,[ListId]

    ,[BaseId]

    ,[ItemId]

    ,[WorkflowInstanceId]

    ,[AssociationId]

    ,[StateTitle]

    ,[ShowActions]

    ,[WBXmlContent]

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

    COMMIT TRANSACTION @TranName

     

    SET STATISTICS TIME OFF