Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Database Log Clean Up ...
Finance forum
Answered

Database Log Clean Up Batch Job

Posted on by 93
Hello everyone. 
 
My organisation's database log has become incredibly large and I'm trying to tackle it. With help from Microsoft we've deleted a lot of the data directly using SQL. However, I now want to keep on top of the maintenance. I've tried to run the database log clean up job with (DateRange(-30,-0)) to delete anything older than 30 days but it doesn't appear to work, I've only had success when explicitly specifying a date, which I don't want to do if I'm scheduling a recurring batch job.
 
Any tips on setting up a recurring clean up job please?
 
Thanks,
Michael 
  • Verified answer
    Brian Sanderson Profile Picture
    Brian Sanderson 321 on at
    Database Log Clean Up Batch Job
    Yes, it should have been (LessThanDate(-365)). The query you ran was in essence saying anything older than 365 days from today, aka go a year from today and delete everything older than that.
     
  • MBates237 Profile Picture
    MBates237 93 on at
    Database Log Clean Up Batch Job
    Just an update on this one, I've run the cleanup job to delete everything older than a year
     
     
    But it seems to have just deleted everything as there are now only records from today in the DB log (this is the view sorted by oldest to newest) Should it have been (LessThanDate(-365)) i.e. anything older than 1 year ago?
     
     
     
  • Hana Xue Profile Picture
    Hana Xue Microsoft Employee on at
    Database Log Clean Up Batch Job
    Hi,
    If the answer is helpful ,please mark it as verified to help more people in the forum.
    Best Regards,
    Hana
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,572 Moderator on at
    Database Log Clean Up Batch Job
    Seems you are using wrong syntax to fetch dates older than 30 days. You should use this
     
    • Less than thirty days from now â€“ Enter (LessThanDate(30)).
  • Verified answer
    Hana Xue Profile Picture
    Hana Xue Microsoft Employee on at
    Database Log Clean Up Batch Job
    Hi,
    Please check your date range settings, you want to delete data that is more than 30 days in the past, please use the lessthan method.

    Best Regards,
    Hana
     
  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,524 Super User 2024 Season 2 on at
    Database Log Clean Up Batch Job
    Hi Michael,
     
    Can you explain the behavior when you mention "it doesn't appear to work"? Note that the date range is now set to the last 30 days, not older than 30 days. For older than 30 days, you can use the query syntax (LessThanDate(-30)).

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans