Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Delete dbo.workflowlogbase and dbo.processSessionBase Status reason Failed records

Posted on by Microsoft Employee

Hello.

For some reason the CRM database has grown to 60GB due to dbo.workflowlogbase -  have notice Process sessions - with Status Reason = Failed to be over  5000+  all seem to be failed real-time workflows.  

When am running a total Record count for the WorkflowlogBase SQL Script, receiving 3072577 Failed Records and 50736 succeeded Records which I like to delete.

However when run Advanced find -  System Jobs with Status Reason =  Failed it's only showing up 420 records and not 3072577 records.

What is the best and way to delete the total count failed records of 3072577 from the crm 2016 sp1 on premise?

The disk usage by top tables are dbo.workflowlogbase  at 28GB and dbo.processSessionBase 16GB   -  dbo.attachment 14GB. 

Ideally I like to delete all failed and completed recodes for both dbo.workflowlogbase and dbo.processsessionbase  and all 2 years older dbo.attachment email attchments.

 

Am I able to do this within CRM?  if not please provide the SQL script.

Many thanks,

PJ

*This post is locked for comments

  • skhan Profile Picture
    skhan 120 on at
    RE: Delete dbo.workflowlogbase and dbo.processSessionBase Status reason Failed records

    Hi Mokarram,

    We are having the same issue, and bulk delete is too slow. Can you please provide the solution that worked for you. It would be very grateful.

    Thank you.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Delete dbo.workflowlogbase and dbo.processSessionBase Status reason Failed records

    how am I able to delete all the old synchronous real-time workflow jobs which have encounter errors logs from crm 16?

    unable to delete the records using the three method below.  any other suggestions?

    tried to clear the keep logs for workflow job that encounter errors check box on the faulty real-time workflow.

    tried to delete the faulty real-time workflow it did not remove the faulty records.

    tried to use advances search and delete the process sessions  with status reason equals failed.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Delete dbo.workflowlogbase and dbo.processSessionBase Status reason Failed records

    Is it safe to delete ProcessSessionBase table  recodes with  Status Reason = Completed; Canceled; Failed?

    if so please provide a SQL script as the bulk deletion takes too long.

    should I also run sql scrip     UPDATE STATISTICS [dbo].[ProcessSessionBase] WITH FULLSCAN  ?

    Thanks,

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Delete dbo.workflowlogbase and dbo.processSessionBase Status reason Failed records

    I have tried that kb968520 Performance is slow if the AsyncOperationBase table too large knowledgebase, tried shrinking the database and ran the system log  bulk delete option.  

    however it did not delete any of the WorkflowlogBase 3,072,577 Failed Records and 50736 succeeded Records.   

    dbo.workflowLgobase  did not change much dbo.ProcessSessionBase.

    any other suggestions that can shrink the database?

    Thanks   

  • Suggested answer
    NKC Profile Picture
    NKC 4,440 on at
    RE: Delete dbo.workflowlogbase and dbo.processSessionBase Status reason Failed records

    Hi 

    You need to include failed, canceling, pausing, waiting, waiting for resources and canceled. But consider to include waiting because if any wait condition in workflows or SLA's. You can also include created on or before to filter jobs. I would suggest first creating  bulk record deletion jobs instead of executing query on database.  if you are using crm 2016 try to delete jobs from advanced find you will get error so use bulk record deletion job. 

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Delete dbo.workflowlogbase and dbo.processSessionBase Status reason Failed records

    The script at here will clear data from workflowlogbase, though I'm not sure if it also clears processessionbase.

    You should be able to use a bulk delete job to delete the email attachments within CRM.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans