All of us who struggle with uncooperative DataMarts know the problems they can sometimes have. One of the tougher issues to encounter include mistakenly deleting the ManagementReporterDM from SQL before removing the Integration. I have also seen where a client or user deletes the MR Services before removing the Integration.
In these cases, when it appears there is no integration because a user has accidentally not followed the correct steps, which are to:
- Open the MR Configuration Console
- Disable the Integration
- Remove the Integration
- Stop the MR Services
- Delete the DataMart Database in SSMS
- Go back into the Configuration Console
- Start the MR Services back up
- Choose configure
- Configure a new integration by rebuilding the DataMart
**Since there are Dozens of blogs on how to re-build the DataMart, I won't go too much further into the correct steps.
or in some cases followed the correct steps, but the Configuration Console freezes or locks during the removal of the integration, you know that you cannot build another integration while the first one exists. You also know that you can't see the integration any longer to remove it. You can, with plenty of time, occasionally, get the integration to show back up. However, there is another solution to the issue. Removing the DataMart Integration from the ManagementReporter database.
This is NOT recommended to do without having tried to resolve the issue from the MR Configuration Console first. Be convinced that it cannot be done from the console.
As always, make sure you get a good backup of the ManagementReporter database before following these steps.
Run the following SQL Statements One At A Timeagainst the ManagementReporter database
--1
Alter table [Connector].[Integration] DISABLE trigger ALL
Alter table [Connector].[Map] DISABLE trigger ALL
Alter table [Scheduling].[TaskCategory] DISABLE trigger ALL
Alter table [Scheduling].[Task] DISABLE trigger ALL
Alter table [Scheduling].[Trigger] DISABLE trigger ALL
--2
DELETE FROM [Connector].[IntegrationGroup]
DELETE FROM [Connector].[Map] WHERE [MapId] IN (SELECT [Id] FROM [Scheduling].[Task] WHERE [CategoryId] IN (SELECT [Id] FROM [Scheduling].[TaskCategory] WHERE [ParentId] IN (SELECT [Id] FROM [Scheduling].[TaskCategory] where ParentID is null)));
DELETE FROM [Connector].[MapDefinition] WHERE [DefinitionId] NOT IN (SELECT DISTINCT DefinitionId FROM Connector.Map)
--3
DELETE FROM [Scheduling].[Task] WHERE [CategoryId] not IN (SELECT [Id] FROM [Scheduling].[TaskCategory] where ParentID is null)
DELETE FROM [Scheduling].[Trigger] where Id NOT IN (SELECT distinct TriggerId from [Scheduling].[Task])
DELETE FROM [Connector].[MapCategoryAdapterSettings] WHERE [TaskCategoryId] IN (SELECT [Id] FROM [Scheduling].[TaskCategory] WHERE not [ParentId] is null);
--4
Alter table [Connector].[Integration] ENABLE trigger ALL
Alter table [Connector].[Map] ENABLE trigger ALL
Alter table [Scheduling].[TaskCategory] ENABLE trigger ALL
Alter table [Scheduling].[Task] ENABLE trigger ALL
Alter table [Scheduling].[Trigger] ENABLE trigger ALL
--5
DELETE FROM [Connector].[Integration] where type=2
--6
DELETE FROM [Scheduling].[TaskCategory] WHERE [ParentId] IN (SELECT [Id] FROM [Scheduling].[TaskCategory] where ParentID is null);
Once again, MAKE SURE YOU HAVE A BACKUP BEFORE RUNNING.
Once you have run the sequence once, Run It Again, in order to make sure you get no return on the statements.
After you run this sequence in SSMS, you can open the MR Configuration Console and build your integration for the DataMart.
If you need any assistance, please contact ACE Microtechnology at ACE_GPSupport@AceMicrotech.com
By Jo Ann deRuiter, MCP, Ace Microtechnology