Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

Move Repository

  • Last UpdatedJun 10, 2024
  • 5 minute read

We recommend to have the same domain and galaxy name on both the engineering and production environment.

The following steps also take care of domain and galaxy name change in the production environment.

Complete the following steps to import Repository Database from engineering environment to production environment:

  1. Take a backup of the required Repository database present in engineering environment’s Server.

  2. Copy the database backup file in the production environment.

  3. Restore the database in the production environment of the Workflow server.

    1. Open SQL Server Management Studio and connect to Database Engine.

    2. In the Object Explorer, go to the Database.

    3. Right-click the Database and select Restore Database from the context menu to restore "XXX" database.

  4. Execute the SQL script given below on the restored Repository database in production environment.

    Before executing the script the following changes needs to be done:

    • Set or change the value of @OldRepositoryName with Workflow Repository name as in the engineering environment.

    • Set the value of @UniqueEnvironmentName with Unique Environment Name used in the engineering environment while provisioning the Repository from ArchestrA.

      -- Declaring variables

      DECLARE @OldRepositoryName AS NVARCHAR(150)

      DECLARE @OldUniqueEnvironmentName AS NVARCHAR(150)

      -- Set the Old Workflow repository name

      SET @OldRepositoryName = '<Old Repository Name>'

      -- Set the Unique Environment name - The Unique Environment Name used to initially while provisioning the workflow repository in engineering environment

      SET @OldUniqueEnvironmentName = '<UniqueEnvironmentName>'

      -- Deleting all ArchestrA external connections details entries from SKExternalConnectionDetails table

      DELETE FROM SKExternalConnectionDetails WHERE RecordParentItemId IN (SELECT Id FROM SKExternalConnections WHERE SourceType='ArchestrA' AND Application=@OldRepositoryName AND Title=@OldUniqueEnvironmentName)

      AND Application=@OldRepositoryName

      -- Deleting all ArchestrA external connections information from SKExternalConnections table

      DELETE FROM SKExternalConnections WHERE SourceType='ArchestrA' AND Application =@OldRepositoryName AND Title=@OldUniqueEnvironmentName

      -- Deleting Galaxy User resource mapping from SKESGResource Mapping table

      DELETE FROM SKESGResourceMapping WHERE UserId In(SELECT Id FROM SKVirtualActor WHERE Provider = @OldUniqueEnvironmentName AND ResourceHandler=@OldRepositoryName)

      AND Application=@OldRepositoryName

      -- Deleting galaxyuserprovider and galaxyrole provider entries from SKEntityDataSourceProvider table

      DELETE FROM SKEntityDataSourceProvider WHERE Provider='galaxyuserprovider' OR Provider='galaxyroleprovider' AND Application=@OldRepositoryName AND InstanceName=@OldUniqueEnvironmentName

      -- Deleting 'galaxyaduserprovider' and 'galaxyadroleprovider' entries from SKEntityDataSourceProvider table

      DELETE FROM SKEntityDataSourceProvider WHERE Provider='galaxyaduserprovider' OR Provider='galaxyadroleprovider' AND Application=@OldRepositoryName AND InstanceName=@OldUniqueEnvironmentName

      -- Updating SKEEventAssociations table and Setting EventBindingXML with rootnodes where ever EventBindingXML is empty

      -- This step is required to avoid the 'Root Element is missing' message while attaching the datasource and creating a repository

      UPDATE SKEEventAssociations SET EventBindingXML = '<EventBind></EventBind>' WHERE RTRIM(EventBindingXML) = '' AND Application =@OldRepositoryName AND EventProviderName='ArchestraEvents'

      -- Truncating Galaxy Role User Mappings table

      DELETE FROM GalaxyRoleUserMappings WHERE UserId IN (SELECT Id FROM GalaxyUsers where UniqueGalaxyName=@OldUniqueEnvironmentName)

      -- Deleting Galaxy Role Security Group Mappings table

      DELETE FROM GalaxyRoleSecurityGroupMappings WHERE Id IN ( SELECT Id FROM GalaxyRoles WHERE GalaxyName = @OldUniqueEnvironmentName)

      -- Deleting Galaxy Roles from Galaxy Roles table

      DELETE FROM GalaxyRoles WHERE GalaxyName = @OldUniqueEnvironmentName

      -- Deleting Galaxy Users from Galaxy Users table

      DELETE FROM GalaxyUsers WHERE UniqueGalaxyName = @OldUniqueEnvironmentName

  5. If the Repository in the engineering environment is also provisioned from MES, then the SQL script (given below) needs to be executed on the restored Repository Database in the production environment.

    Before executing the script the following changes needs to be done:

    • Set or change the value of @OldRepositoryName with Workflow Repository name as in the engineering environment.

    • Set the value of @UniqueEnvironmentName with Unique Environment Name used in the engineering environment while provisioning the Repository from MES.

      -- Declaring variables

      DECLARE @OldRepositoryName AS NVARCHAR(150)

      DECLARE @OldUniqueEnvironmentName AS NVARCHAR(150)

      -- Set the Old Workflow repository name

      SET @OldRepositoryName = '<Old Repository Name>'

      -- Set the Unique Environment name - The Unique Environment Name used to initially while provisioning the workflow repository from MES in engineering environment

      SET @OldUniqueEnvironmentName = '<UniqueEnvironmentName>'

      -- Deleting all MES Connection details entries from MESConnectionDetails table

      DELETE FROM MESConnectionDetails WHERE RecordParentItemId IN

      (

      SELECT Id FROM SKExternalConnectionDetails where RecordParentItemId IN

      (

      SELECT Id FROM SKExternalConnections WHERE SourceType='MES' AND Application=@OldRepositoryName AND Title=@OldUniqueEnvironmentName

      )

      AND Application =@OldRepositoryName

      )

      -- Deleting all MES external connections details entries from SKExternalConnectionDetails table

      DELETE FROM SKExternalConnectionDetails WHERE RecordParentItemId IN (SELECT Id FROM SKExternalConnections WHERE SourceType='MES' AND Application=@OldRepositoryName AND Title=@OldUniqueEnvironmentName)

      AND Application=@OldRepositoryName

      -- Deleting all MES external connections information from SKExternalConnections table

      DELETE FROM SKExternalConnections WHERE SourceType='MES' AND Application =@OldRepositoryName AND Title=@OldUniqueEnvironmentName

      -- Deleting MES User resource mapping from SKESGResourceMapping table

      DELETE FROM SKESGResourceMapping WHERE UserId In(SELECT Id FROM SKVirtualActor WHERE Provider = @OldUniqueEnvironmentName AND ResourceHandler=@OldRepositoryName)

      AND Application=@OldRepositoryName

      -- Deleting mesuserprovider and mesroleprovider entries from SKEntityDataSourceProvider table

      DELETE FROM SKEntityDataSourceProvider WHERE Provider='mesuserprovider' OR Provider='mesroleprovider' AND Application=@OldRepositoryName AND InstanceName=@OldUniqueEnvironmentName

      -- Updating SKEEventAssociations table and Setting EventBindingXML with rootnodes where ever EventBindingXML is empty

      -- This step is required to avoid the 'Root Element is missing' message while attaching the datasource & creating a repository

      UPDATE SKEEventAssociations SET EventBindingXML = EventBindingXML + '</EventBind>' WHERE SUBSTRING(EventBindingXML,LEN(EventBindingXML)-11,12) != '</EventBind>' AND Application = @OldRepositoryName AND EventProviderName='MESEvents'

  6. Repository Data Cleaning: If you do not wish to retain the workflows runtime data, then execute the following script on restored Repository Database in the Production environment.

    -- Script for removing workflows runtime data

    TRUNCATE TABLE SKWorkItem

    TRUNCATE TABLE SKHWSActivity

    TRUNCATE TABLE SKWorkItemTransaction

    TRUNCATE TABLE SWTaskList

    TRUNCATE TABLE SKMultipleTimeoutWarning

    TRUNCATE TABLE SWActionEventLog

    TRUNCATE TABLE SWActionEventLong

    TRUNCATE TABLE SKWorkItemCounter

    TRUNCATE TABLE SKChannelWorkItem

    TRUNCATE TABLE SKWorkItemData

    TRUNCATE TABLE SKWorkItemFields

    TRUNCATE TABLE SWExecutionDetails

    TRUNCATE TABLE SWExecute

    TRUNCATE TABLE SWVariables

    TRUNCATE TABLE SKWorkflowEvents

    TRUNCATE TABLE SKChildWorkflows

    TRUNCATE TABLE SWCustomTimerDetails

  7. In the production environment, navigate to Central Configuration to access the workflow server.

  8. Click the Datasource Settings link.

    The Datasource List window is displayed.

  9. Click the Create Datasource link.

    The Manage Datasource window is displayed.

  10. Enter all the required values. Ensure that the restored database is selected for the Database value.

  11. Click Test Connection. After the Test Connection is successful, a message is displayed.

  12. Click Ok.

  13. Navigate to Central Configuration > Repository Settings to view the Repository List.

  14. Click Add.

    The Manage Repository page appears.

  15. Select the appropriate data source (DevDS1) and check the Attach Datasource check box.

  16. Enter the repository name, repository description, server name, and select the required Resource Provider from the drop-down list in the Manage Repository window.

  17. Click OK to create the Repository.

    The Config Administrator window is displayed.

  18. Select "admin [AVEVA Work Tasks List]" in the User Lookup field and click OK.

    In this page, configure the administrator for the Repository.

    • In case the provider is "WorkflowManagementList", select the default user admin as administrator.

    • In case of other providers, use the user lookup and select the required user to configuring as an administrator.

  19. Navigate to the Repository List and click the Site Path (url) to open the Enterprise Console Page.

  20. Login to the Enterprise Console site and check whether all the workflows are displayed in the Workflow list.

TitleResults for “How to create a CRG?”Also Available in