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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

When to Rebuild the Data Mart

(0) ShareShare
ReportReport
Posted on by

Hello:

Does anyone have a bullet point list showing when the Data Mart in Management Reporter needs to be rebuilt?

Thanks!

John

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Lyn Barr Profile Picture
    1 on at

    When does it need to be rebuilt? Every other day. At least, it feels that way.  :-(

    Obviously, any time the numbers do not tie out to trial balances from GP, and also when you restore a database, just to name a couple of circumstances.

    Does anyone out there have a list for John?

  • TSMurphy Profile Picture
    372 on at

    Basically what Lyn Barr has already stated.  We are looking at seeing if better off going with the Legacy connection instead of the DataMart connection until it's no longer supported.

  • Richard Wheeler Profile Picture
    75,852 Moderator on at

    I have never been able to put my finger on why this is needed. We have clients where I have never rebuilt the data mart and the reports are always correct and then there are others where we rebuild it once a month. My biggest complaint against MR is the ridiculously large databases that it creates. Why does it have to keep every version of every report that was ever generated? We have seen databases in excess of 200gb full of useless junk that will never be viewed again. I think a little design change is required here. A little auto purge/shrink would go a long way.

  • Lyn Barr Profile Picture
    1 on at

    Richard, I have a script I will post tomorrow, which purges the older reports. It has parameters you can specify, to keep either the last x number of reports, or the last Y numbers of days' worth.

    I got it from Ryan Sandness, in MBS support. I have it running on a schedule, in SQL.

    However, I thought it was no longer needed in the newer CU versions. I'll have to double-check that.

    In any case, I'll post it for you tomorrow.

    By the way, I agree with you about how it doesn't get rebuilt at some places, but it does at others. I think it has to do with the complexity of the environment, number of simultaneous users and reports generated, whether they use multicurrency, budgets, AA, etc.

  • Lyn Barr Profile Picture
    1 on at

    Richard, here is the script. Reviewing it again, there is really just a single parameter, which is the number of versions you wish to keep. The second parameter is simply a designation to either print a list of what will be deleted or to actually execute the delete statement. These are on lines 14 & 15. These two lines are the only ones (aside from the db designation) where you would need to edit anything prior to running.

    use [TWO]

    declare @iCursorError int,

               @VID varchar(255),

               @ID varchar(255),

               @RCount int,

               @VKeep int,

               @Delete bit

    select  @iCursorError = 0,

               @VID = '',

               @ID = '',

               @RCount = 0,

               @VKeep = 10, -- Number of versions to keep

               @Delete = 0  -- Set to 1 to delete versions or 0 to just print versions that will delete

    declare version_id cursor for

     select distinct VersionID

         from Repository (nolock)

         where type=10

    open version_id

    fetch next from version_id into @VID

    while (@@FETCH_STATUS = 0)

         begin

               declare delete_report cursor for

    select ID from Repository where VersionID=@VID

    and ID not in (select top (@VKeep) ID from Repository where VersionID=@VID order by CreateDate Desc)

    open delete_report

    fetch next from delete_report into @ID

    while (@@FETCH_STATUS = 0)

    begin

    select * from Repository where ID=@ID

    set @RCount = @RCount + 1

    If (@Delete=1)

    begin

    delete Report where RepositoryID =@ID

    delete Repository where ID =@ID

    end

    fetch next from delete_report into @ID

    end

    close delete_report

    deallocate delete_report

               fetch next from version_id into @VID

         end

    close version_id

    deallocate version_id

    select @RCount as 'Total Records Processed'

    select  @VID = ''

  • Richard Wheeler Profile Picture
    75,852 Moderator on at

    Thanks Lyn, I will add this script to my bag of goodies!

  • Kristie McNulty Profile Picture
    1,008 on at

    Hi Lyn, I'm trying to use your query in our GP2015 environment but it's failing for the Version ID parameter (error: Invalid column name 'VERSIONID').  Is it possible the column names have changed slightly from the GP2013 version?

  • Kristie McNulty Profile Picture
    1,008 on at

    John - we found we had to rebuild our Data Mart after closing the previous financial year.  We also choose to rebuild after adding new company databases.  Other than that, we are not having to rebuild the DM in our GP2015 environment.

  • Lyn Barr Profile Picture
    1 on at

    Hi, Kristie,

    It is entirely possible that we would need an updated version of this script for newer versions. Ryan originally gave it to me back in July, 2013.

    Sorry, I don't have a newer one. We would have to reach out to him, to see if there is an update.

  • Suggested answer
    Beat Bucher  GP Geek  GPUG All Star Profile Picture
    28,058 Moderator on at

    Richard,

    There is a feature 'suggestion' that I posted on MS Connect a while back to vote for the 'clean-up/purge' function in MR 2012...

    connect.microsoft.com/.../clean-up-report-history-option-in-mr-2012

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans