Orchestrator upgrade from 2020.10.4 to 2021.10.4, throws error " Cannot drop the index because it does not exist or you do not have permission."
An issue can occur during upgrade paths that may cause indexes to be removed. (Assumption based off similar issues in past. Cause is still unknown) .
- First validate that the Index truly does not exist,
- Open SSMC, and go to Orchestrator DB>Views>dbo.vwQueueReferences>Indexes
- If it does exist, check permissions. If it does not continue with following.
- In order to solve this particular index is missing we need to recreate index before upgrade.
- The query to create the missing index is as follows,
CREATE VIEW [dbo].[vwQueueReferences] WITH SCHEMABINDING AS
SELECT qd.Id as QueueDefinitionId, qi.Reference as Reference
FROM dbo.QueueDefinitions qd
INNER JOIN dbo.QueueItems qi ON qd.Id = qi.QueueDefinitionId
WHERE qd.IsDeleted = 0
AND qd.EnforceUniqueReference = 1
AND qi.Reference IS NOT NULL
AND qi.RetryNumber = 0
and qi.Status != 6 -- Check for deleted items
GO
CREATE UNIQUE CLUSTERED INDEX [IX_vwQueueReferences] ON [dbo].[vwQueueReferences](QueueDefinitionId, Reference)
GO