Quantcast
Channel: SharePoint 2010 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 13778

Problem with "User Profile sync" / big Sync_DB and RemoveWorkflowDefinitionsAndInstances.sql in SP 2010 after CU August 2012 (KB 2687353), is it a bug ?

$
0
0

Hi,
I have standalone Windows Server 2008 R2 Standard as domain member, with SQL 2008 R2 Standard, with SharePoint 2010 Enterprise.
Everything is updated to latest stable updates (SP1 and so on...) and installed only English language.

After some short time, we have very big SQL database for User Profile Sync Service (Sync_DB). Everything works, however database is very big (about 22GB, for 300 users it growed in 4 months).

There was issue solved about big Sync_DB in cumulative updates for SharePoint, so I have placed latest this cumulative update (August 28, 2012): http://support.microsoft.com/kb/2687353 for my SharePoint Server 2010 SP1.

Installation was fine with no errors, however after server restart, FIM service stopped working. I have tried to provision again "User Profile Service" with my sp-farm account (which is set as member of local Administrators group) and it could not start.

Here is warning in Application log for ILM Web Service Configuration:

ILM Database could not be created: Error sent to Windows Event Log running : -- Remove existing Workflow Instances from the Database
DECLARE @fimServiceAccountId               UNIQUEIDENTIFIER,
@workflowInstanceIdentifier        UNIQUEIDENTIFIER,
@workflowDefinitionIdentifier      UNIQUEIDENTIFIER,
@requestId                         UNIQUEIDENTIFIER,
@terminatedWorkflowStatusName      NVARCHAR(32),
@terminatedWorkflowStatusKey       TINYINT,
@currentTime                       DATETIME,
@workflowInstanceObjectTypeKey     SMALLINT,
@workflowStatusAttributeKey        SMALLINT,
@updateException                   NVARCHAR(448),
@didFailureOccur                   BIT;

SELECT @terminatedWorkflowStatusName   = [dbo].[WorkflowStatusTerminated]();

SELECT @fimServiceAccountId            = [dbo].[GetServiceAccountIdentifier](),
@terminatedWorkflowStatusKey    = [dbo].[GetWorkflowStatusKey](@terminatedWorkflowStatusName),
@workflowInstanceObjectTypeKey  = [dbo].[ObjectTypeKeyFromName](N'WorkflowInstance'),
@workflowStatusAttributeKey     = [dbo].[AttributeKeyFromName](N'WorkflowStatus'),
@currentTime                    = GETUTCDATE(),
@didFailureOccur                = 0;

-- Diagnostics table
DECLARE @failureLogTable TABLE
(
[ObjectIdentifier] UNIQUEIDENTIFIER,
[ErrorMsg]         NVARCHAR(2000)
);

-- Mark Each Workflow Instance as canceled.
DECLARE workflowInstanceCursor CURSOR FORWARD_ONLY FOR
SELECT  [Identifier],
[RequestIdentifier]
FROM [dbo].[WorkflowInstance];

OPEN workflowInstanceCursor
FETCH NEXT FROM workflowInstanceCursor INTO
@workflowInstanceIdentifier,
@requestId;

WHILE @@FETCH_STATUS = 0
BEGIN
BEGIN TRANSACTION
BEGIN TRY
-- set workflow instance state to Canceled.
EXECUTE [dbo].[UpdateWorkflowInstanceStatusFinal]
@identifier           = @workflowInstanceIdentifier,
@status               = @terminatedWorkflowStatusKey,
@cause                = @fimServiceAccountId,
@workflowTypeName     = NULL,
@exception            = N'Workflow execution is not supported for FIM MOSS',
@requestIdentifier    = @requestId,
@requestStatusMessage = NULL;

-- update workflow instance table
UPDATE [dbo].[ObjectsInternal]
SET [ValueString] = @terminatedWorkflowStatusName
WHERE
[ObjectId]      = @workflowInstanceIdentifier
AND [ObjectTypeKey] = @workflowInstanceObjectTypeKey
AND [AttributeKey]  = @workflowStatusAttributeKey;

-- clean up the InstanceState table
IF EXISTS
(
SELECT
[uidInstanceID]
FROM [dbo].[InstanceState]
WHERE [uidInstanceID] = @workflowInstanceIdentifier
)
BEGIN
DELETE [dbo].[InstanceState]
WHERE  [uidInstanceID] = @workflowInstanceIdentifier;
END

-- clean up completed workflow instances.
EXECUTE dbo.UpdateRequest
@identifier = @requestId,
@status     = N'Denied',
@cause      = @fimServiceAccountId,
@exception  = @updateException OUTPUT;

EXECUTE dbo.ExpireSystemObject
@identifier = @requestId,
@cause      = @fimServiceAccountId,
@time       = @currentTime;

EXECUTE dbo.DeleteCachedRequest @requestIdentifier = @requestId;

IF(XACT_STATE() = 1)
BEGIN
COMMIT TRANSACTION;
END
END TRY
BEGIN CATCH
-- record the failure
SELECT @didFailureOccur = 1;
INSERT @failureLogTable
(
[ObjectIdentifier],
[ErrorMsg]
)
SELECT @workflowInstanceIdentifier, ERROR_MESSAGE();

IF (XACT_STATE() != 0)
BEGIN
ROLLBACK TRANSACTION;
END
END CATCH

-- re-initialize fetch variables to avoid stale data.
SELECT @workflowInstanceIdentifier = NULL,
@requestId                  = NULL;

-- fetch the next row.
FETCH NEXT FROM workflowInstanceCursor INTO
@workflowInstanceIdentifier,
@requestId;
END

CLOSE workflowInstanceCursor;
DEALLOCATE workflowInstanceCursor;

--If we had any failures that we skipped over, print them out and throw an error
IF(@didFailureOccur = 1)
BEGIN
SELECT
[ObjectIdentifier],
[ErrorMsg]
FROM @failureLogTable;

DECLARE @errorString NVARCHAR(MAX);
SET @errorString =
(
CAST((SELECT [ObjectIdentifier], [ErrorMsg] FROM @failureLogTable FOR XML AUTO) AS NVARCHAR(MAX))
);
RAISERROR(@errorString, 16, 1);
END

DELETE FROM [dbo].[ActiveHostedWorkflowDefinitionWithEndpoints]
: <_x0040_failureLogTable ObjectIdentifier="0A4BAADF-68CD-4ABB-99A0-82588C778BC2" ErrorMsg="Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 2."/>

and next one:

ILM SQL Configuration file could not be read: Error Parcing the SQL File: C:\Program Files\Microsoft Office Servers\14.0\Sql\RemoveWorkflowDefinitionsAndInstances.sql  Exception: <_x0040_failureLogTable ObjectIdentifier="0A4BAADF-68CD-4ABB-99A0-82588C778BC2" ErrorMsg="Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 2."/>

FIM service tries few times do the same, but with same errors. Finally it stops itself.

My question is, is it a bug in latest cumulative update with SQL script file RemoveWorkflowDefinitionsAndInstances.sql ? How can I solve this ?

You can check content of file above in error message. Also my SQL table in [Sync_DB].[db].[ActiveHostedWorkflowDefinitionWithEndpoints] is empty.

Please help,
Thank you


-- Hrvoje Kusulja



Viewing all articles
Browse latest Browse all 13778

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>