web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Tracing File/LDF file/SQL Log File - Too Big

(0) ShareShare
ReportReport
Posted on by 65

The disk space on my server is limited and the system is running slow, I've discovered that there is a Tracing File which currently stands at 50gb, additionally there's a SQL log file at 12gb and a Reports File [LDF] at 13gb.
I only have 6gb of available disk space remaining.

Are these large files the cause of my problem and how can i clear them down?

 

thanks

*This post is locked for comments

I have the same question (0)
  • Baris KANLICA Profile Picture
    User Group Leader on at

    You can take your log settings to simple mode.

    After this process you can run this script in crm database. This script reduce your crm database and log file. And you don't trace the system all time. This is not recommended.

    --1st step // run this after backup database

    CREATE NONCLUSTERED INDEX CRM_AsyncOperation_CleanupCompleted

    ON [dbo].[AsyncOperationBase] ([StatusCode],[StateCode],[OperationType])

    GO

    CREATE NONCLUSTERED INDEX CRM_WorkflowLog_AsyncOperationID ON [dbo].[WorkflowLogBase] ([AsyncOperationID])

    GO

    CREATE NONCLUSTERED INDEX CRM_DuplicateRecord_AsyncOperationID ON [dbo].[DuplicateRecordBase] ([AsyncOperationID])

    GO

    CREATE NONCLUSTERED INDEX CRM_BulkDeleteOperation_AsyncOperationID ON [dbo].[BulkDeleteOperationBase]

    (AsyncOperationID)

    GO

    --2nd step // run after stop Crm async

    -- Rebuild Indexes & Update Statistics on AsyncOperationBase Table

    ALTER INDEX ALL ON AsyncOperationBase REBUILD WITH (FILLFACTOR = 80, ONLINE = OFF,SORT_IN_TEMPDB = ON, STATISTICS_NORECOMPUTE = OFF)

    GO

    -- Rebuild Indexes & Update Statistics on WorkflowLogBase Table

    ALTER INDEX ALL ON WorkflowLogBase REBUILD WITH (FILLFACTOR = 80, ONLINE = OFF,SORT_IN_TEMPDB = ON, STATISTICS_NORECOMPUTE = OFF)

    GO

    declare @DeleteRowCount int

    Select @DeleteRowCount = 1000

    declare @DeletedAsyncRowsTable table (AsyncOperationId uniqueidentifier not null)

    declare @continue int, @rowCount int

    select @continue = 1

    while (@continue = 1)

    begin

         begin tran

         insert into @DeletedAsyncRowsTable(AsyncOperationId)

         Select top (@DeleteRowCount) AsyncOperationId

         from AsyncOperationBase

         where OperationType in (1, 9, 12, 25, 27, 10) AND StateCode = 3 AND StatusCode in (30, 32)

         Select @rowCount = 0

         Select @rowCount = count(*) from @DeletedAsyncRowsTable

         select @continue = case when @rowCount <= 0 then 0 else 1 end

           if (@continue = 1)

           begin

               delete WorkflowLogBase from WorkflowLogBase W, @DeletedAsyncRowsTable d

               where W.AsyncOperationId = d.AsyncOperationId

    delete BulkDeleteFailureBase From BulkDeleteFailureBase B, @DeletedAsyncRowsTable d

               where B.AsyncOperationId = d.AsyncOperationId

               delete AsyncOperationBase From AsyncOperationBase A, @DeletedAsyncRowsTable d

               where A.AsyncOperationId = d.AsyncOperationId

               delete @DeletedAsyncRowsTable

         end

         commit

    end

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans