Datapolis Process System

Search:

Contents
:
IndexBookmarkPrint
Home > Installation Guide > Migration scenarios > Advanced migration scenarios > Restoring Web Application from farm backup (Sharepoint 2013)

Restoring Web Application from farm backup (Sharepoint 2013)

 

If you want to restore single Web Application from backup, please follow below steps.

Please note that this instruction applies to Datapolis Process System 4.3.20.4702 or later with database version 1.0.0.24 ​or later.
  1. Restore your SharePoint 2013 following Microsoft guidelines.
  2. Restore all your custom Datapolis Process System solution such as features and activities if needed.
  3. Restore your "DP_DB_<FarmID>" database into new <temporary_database_name>). database, do not override the existing DP_DB_<FarmID>"
  4. Than you have to remove all data related to your Web Appliction from DP_DB_... that will be replaced with the one we saved in <temporary_database_name>.  
    USE <DP_DB_guid_of_your_2013_SPFarm>
    DECLARE @appId uniqueidentifier = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' -- id of the web application which content is being restored
    DELETE FROM [dbo].Associations
          WHERE AppId=@appId
    GO
    DELETE FROM [dbo].History
          WHERE AppId=@appId
    GO
    DELETE FROM [dbo].Tasks
          WHERE AppId=@appId
    GO
    DELETE FROM [dbo].WBXml
          WHERE AppId=@appId
    GO
  5. ​Now you can copy backuped content of your web application to the Datapolis Process System database (<DP_DB_guid_of_your_2013_SPFarm>) with the following script
    (remember to replace <DP_DB_guid_of_your_2013_SPFarm>, <temporary_database_name> and indicate your web applications ids (@appId) 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 uniqueidentifier = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' -- id of the web application which content is being restored
      
    INSERT INTO <DP_DB_guid_of_your_2013_SPFarm>.[dbo].[Associations]
    ([AssociationId]
    ,[AppId]
    ,[SiteId]
    ,[WebId]
    ,[ListId]
    ,[AssociationType]
    ,[AssociationContent]
    ,[WBVersion]
    ,[AssociationReferenceId])
    SELECT [AssociationId]
    ,[AppId]
    ,[SiteId]
    ,[WebId]
    ,[ListId]
    ,[AssociationType]
    ,[AssociationContent]
    ,[WBVersion]
    ,[AssociationReferenceId] FROM <temporary_database_name>.[dbo].[Associations] WHERE [AppId] = @appId
      
    INSERT INTO <DP_DB_guid_of_your_2013_SPFarm>.[dbo].[History]
    ([WorkflowInstanceId]
    ,[AssociationId]
    ,[TemplateId]
    ,[AppId]
    ,[SiteId]
    ,[WebId]
    ,[ListId]
    ,[ItemId]
    ,[UserId]
    ,[UserLogin]
    ,[Occured]
    ,[EventType]
    ,[EventName]
    ,[EventTitle]
    ,[EventContent]
    ,[WBVersion]
    ,[AssociationReferenceId]
    ,[HideInHistory])
    SELECT [WorkflowInstanceId]
    ,[AssociationId]
    ,[TemplateId]
    ,[AppId]
    ,[SiteId]
    ,[WebId]
    ,[ListId]
    ,[ItemId]
    ,[UserId]
    ,[UserLogin]
    ,[Occured]
    ,[EventType]
    ,[EventName]
    ,[EventTitle]
    ,[EventContent]
    ,[WBVersion]
    ,[AssociationReferenceId]
    ,[HideInHistory] FROM <temporary_database_name>.[dbo].[History] WHERE [AppId] = @appId
      
    INSERT INTO <DP_DB_guid_of_your_2013_SPFarm>.[dbo].[WBXml]
    ([AppId]
    ,[SiteId]
    ,[WebId]
    ,[ListId]
    ,[BaseId]
    ,[ItemId]
    ,[WorkflowInstanceId]
    ,[AssociationId]
    ,[StateTitle]
    ,[ShowActions]
    ,[WBXmlContent]
    ,[WBVersion]
    ,[AssignedTo]
    ,[Status]
    ,[StatusDetails]
    ,[StatusLog]
    ,[DateOfLastUpdate])
    SELECT [AppId]
    ,[SiteId]
    ,[WebId]
    ,[ListId]
    ,[BaseId]
    ,[ItemId]
    ,[WorkflowInstanceId]
    ,[AssociationId]
    ,[StateTitle]
    ,[ShowActions]
    ,[WBXmlContent]
    ,[WBVersion]
    ,[AssignedTo]
    ,N'Active'
    ,N'Normal'
    ,N'Migration'
    ,@now FROM <temporary_database_name>.[dbo].[WBXml] WHERE [AppId] = @appId
      
    INSERT INTO <DP_DB_guid_of_your_2013_SPFarm>.[dbo].[Tasks]
    ([TaskType]
    ,[CreatedBy]
    ,[Created]
    ,[Started]
    ,[Finished]
    ,[TaskState]
    ,[Progress]
    ,[AppId]
    ,[SiteId]
    ,[WebId]
    ,[ListId]
    ,[ItemId]
    ,[ItemIds]
    ,[WorkflowId]
    ,[WorkflowIds]
    ,[TaskContent]
    ,[Result]
    ,[StartDate]
    ,[WorkflowInstanceId]
    ,[ActionName]
    ,[StateInstanceId]
    ,[Errors]
    ,[LockedBy]
    ,[LockedDate]
    ,[Priority]
    ,[RemovedDate]
    ,[LockId]
    ,[TriesLeft]
    ,[RetryInterval])
    SELECT[TaskType]
    ,[CreatedBy]
    ,[Created]
    ,[Started]
    ,[Finished]
    ,[TaskState]
    ,[Progress]
    ,[AppId]
    ,[SiteId]
    ,[WebId]
    ,[ListId]
    ,[ItemId]
    ,[ItemIds]
    ,[WorkflowId]
    ,[WorkflowIds]
    ,[TaskContent]
    ,[Result]
    ,[StartDate]
    ,[WorkflowInstanceId]
    ,[ActionName]
    ,[StateInstanceId]
    ,[Errors]
    ,[LockedBy]
    ,[LockedDate]
    ,[Priority]
    ,[RemovedDate]
    ,[LockId]
    ,[TriesLeft]
    ,[RetryInterval] FROM <temporary_database_name>.[dbo].[Tasks] WHERE [AppId] = @appId
      
    COMMIT TRANSACTION @TranName;
    SET STATISTICS TIME OFF
  6. After all you can remove the <temporary_database_name>