orchestrator
2022.10
false
重要 :
请注意此内容已使用机器翻译进行了部分本地化。
Orchestrator 用户指南
Last updated 2024年10月9日
升级问题
在将已定义多个组织单元的现有 Orchestrator 升级到 v2019.10 时,某些条件可能会导致现有 OU 无法正确迁移到文件夹范例。具体来说,当删除具有一个或多个分配用户的 OU 并导致这些用户无法使用 Orchestrator 时,会发生这种情况。
如果 Orchestrator 升级中出现此问题,请使用两个脚本来修复此问题:
结合使用,这将删除已删除的 OU 的所有受影响的用户到组织单元的分配:
- 从上面的链接下载两个脚本。
- 运行 SelectUndeletedUserOrganizationEntires.sql 并保存结果数据。
- 运行 DeleteAffectedUserOrganizationUnitsEntries.sql。
从 v2019.10 之前的 Orchestrator 版本升级的用户会受到由于并发文件夹创建请求而发生的问题的影响。该问题导致某些用户角色显示不正确,同时也影响了删除或重新分配用户的流程。
如果您遇到此问题,请运行以下脚本:
DECLARE @duplicates TABLE([Id] BIGINT, [Code] NVARCHAR(95), [TenantId] INT)
INSERT INTO @duplicates
SELECT ou.[Id], ou.[Code], ou.[TenantId]
FROM [dbo].[OrganizationUnits] ou
INNER JOIN
(SELECT duplicates.[Code]
FROM [dbo].[OrganizationUnits] duplicates
WHERE duplicates.[IsDeleted] = 0 AND duplicates.[ProvisionType] = 0
GROUP BY duplicates.[Code]
HAVING COUNT(duplicates.[Code]) > 1) a ON a.[Code] = ou.[Code]
WHERE ou.[IsDeleted] = 0 AND ou.[ProvisionType] = 0
DECLARE @id BIGINT
DECLARE @code NVARCHAR(95)
DECLARE @tenantId INT
DECLARE @rootCode NVARCHAR(95) = (SELECT TOP 1 [Code] FROM [dbo].[OrganizationUnits])
DECLARE @rootCodeLength INT = LEN(IIF(CHARINDEX('.', @rootCode) > 0, SUBSTRING(@rootCode, 0, CHARINDEX('.', @rootCode)), @rootCode))
DECLARE duplicates_Cursor CURSOR FOR
SELECT * FROM @duplicates
OPEN duplicates_Cursor
FETCH NEXT FROM duplicates_Cursor INTO @id, @code, @tenantId
WHILE @@FETCH_STATUS = 0
BEGIN
BEGIN TRAN
DECLARE @result int;
DECLARE @resource NVARCHAR(30) = 'Tenant#' + CAST(@tenantId AS NVARCHAR(10)) + '.RootFolder#0'
EXEC @result = sp_getapplock @resource, 'Exclusive', 'Transaction', 10000;
DECLARE @lastCode NVARCHAR(95) = (SELECT MAX([Code]) FROM [dbo].[OrganizationUnits] WHERE [IsDeleted] = 0)
DECLARE @nextCode NVARCHAR(95) = CAST(CAST(@lastCode AS BIGINT) + 1 AS NVARCHAR(95))
UPDATE [dbo].[OrganizationUnits]
SET [Code] = REPLICATE('0', @rootCodeLength - LEN(@nextCode)) + @nextCode
WHERE [Id] = @id
FETCH NEXT FROM duplicates_Cursor INTO @id, @code, @tenantId
COMMIT TRAN;
END
CLOSE duplicates_Cursor
DEALLOCATE duplicates_Cursor
DECLARE @duplicates TABLE([Id] BIGINT, [Code] NVARCHAR(95), [TenantId] INT)
INSERT INTO @duplicates
SELECT ou.[Id], ou.[Code], ou.[TenantId]
FROM [dbo].[OrganizationUnits] ou
INNER JOIN
(SELECT duplicates.[Code]
FROM [dbo].[OrganizationUnits] duplicates
WHERE duplicates.[IsDeleted] = 0 AND duplicates.[ProvisionType] = 0
GROUP BY duplicates.[Code]
HAVING COUNT(duplicates.[Code]) > 1) a ON a.[Code] = ou.[Code]
WHERE ou.[IsDeleted] = 0 AND ou.[ProvisionType] = 0
DECLARE @id BIGINT
DECLARE @code NVARCHAR(95)
DECLARE @tenantId INT
DECLARE @rootCode NVARCHAR(95) = (SELECT TOP 1 [Code] FROM [dbo].[OrganizationUnits])
DECLARE @rootCodeLength INT = LEN(IIF(CHARINDEX('.', @rootCode) > 0, SUBSTRING(@rootCode, 0, CHARINDEX('.', @rootCode)), @rootCode))
DECLARE duplicates_Cursor CURSOR FOR
SELECT * FROM @duplicates
OPEN duplicates_Cursor
FETCH NEXT FROM duplicates_Cursor INTO @id, @code, @tenantId
WHILE @@FETCH_STATUS = 0
BEGIN
BEGIN TRAN
DECLARE @result int;
DECLARE @resource NVARCHAR(30) = 'Tenant#' + CAST(@tenantId AS NVARCHAR(10)) + '.RootFolder#0'
EXEC @result = sp_getapplock @resource, 'Exclusive', 'Transaction', 10000;
DECLARE @lastCode NVARCHAR(95) = (SELECT MAX([Code]) FROM [dbo].[OrganizationUnits] WHERE [IsDeleted] = 0)
DECLARE @nextCode NVARCHAR(95) = CAST(CAST(@lastCode AS BIGINT) + 1 AS NVARCHAR(95))
UPDATE [dbo].[OrganizationUnits]
SET [Code] = REPLICATE('0', @rootCodeLength - LEN(@nextCode)) + @nextCode
WHERE [Id] = @id
FETCH NEXT FROM duplicates_Cursor INTO @id, @code, @tenantId
COMMIT TRAN;
END
CLOSE duplicates_Cursor
DEALLOCATE duplicates_Cursor