Home
%3CLINGO-SUB%20id%3D%22lingo-sub-388205%22%20slang%3D%22en-US%22%3EHow%20to%20cleanup%20transaction%20logs%2C%20Validation%20issues%20and%20Staging%20tables%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-388205%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Apr%2014%2C%202015%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EMaster%20Data%20Services%20till%20recently%20didn%E2%80%99t%20have%20a%20supported%20way%20to%20clean%20the%20transaction%20logs%2C%20validation%20issues%20history%20and%20Staging%20tables.%20For%20a%20MDS%20system%20with%20lot%20of%20data%20changes%20and%20ETL%20processes%20over%20the%20period%20these%20tables%20can%20grow%20exponentially%20and%20lead%20to%20performance%20degradation%20and%20storage%20space%20issues.%3C%2FP%3E%0A%20%20%3CP%3ETo%20overcome%20this%20problem%20in%20%E2%80%9C%20%3CI%3E%20%3CSTRONG%3E%20Cumulative%20update%2015%20for%20SQL%20Server%202012%20SP1%20%3C%2FSTRONG%3E%20%E2%80%9D%20%3C%2FI%3E%20we%20are%20providing%20some%20helper%20Stored%20Procedures%20which%20users%20can%20call%20to%20clean%20the%20tables.%3C%2FP%3E%0A%20%20%3CP%3E%3CB%3E%20What%20is%20cleaned%3F%20%3C%2FB%3E%3C%2FP%3E%0A%20%20%3CP%3EAll%20the%20transaction%20history%20older%20than%20specified%20date%2C%20all%20the%20validation%20issues%20history%20older%20than%20specified%20date%20and%20all%20the%20staging%20batches%20which%20ran%20before%20specified%20date.%3C%2FP%3E%0A%20%20%3CP%3E%3CB%3E%20How%3A%20%3C%2FB%3E%3C%2FP%3E%0A%20%20%3CDIV%3E%0A%20%20%20%3CP%3EYou%20can%20call%20the%20Stored%20Procedures%20manually%20which%20will%20clean%20up%20the%20tables.%20To%20clean%20Transaction%20tables%20use%20mdm.udpTransactionsCleanup%2C%20to%20clean%20Validation%20History%20use%20mdm.udpValidationsCleanup%20and%20to%20clean%20staging%20table%20use%20mdm.udpEntityStagingBatchTableCleanup.%3C%2FP%3E%0A%20%20%3C%2FDIV%3E%0A%20%20%3CP%3E%3CI%3E%20Sample%3A%20%3C%2FI%3E%3C%2FP%3E%0A%20%20%3CP%3E--%40ModelID%20is%20the%20model%20ID%20that%20you%20clean%20up%20the%20log%20for.%3C%2FP%3E%0A%20%20%3CP%3E--%40CLeanupOlderThanDate%20is%20the%20date%20before%20that%20the%20logs%20or%20records%20are%20deleted.%3C%2FP%3E%0A%20%20%3CP%3EDECLARE%20%40CleanupOlderThanDate%20date%20%3D%20'2015-01-01'%2C%3C%2FP%3E%0A%20%20%3CP%3E%40ModelID%20INT%20%3D%207%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B--You%20can%20get%20this%20fromtable%20mdm.tblModel%3C%2FP%3E%0A%20%20%3CP%3E--Cleanup%20Transaction%20Logs%3C%2FP%3E%0A%20%20%3CP%3EEXEC%20mdm.udpTransactionsCleanup%20%40ModelID%2C%20%40CleanupOlderThanDate%3B%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E--Cleanup%20Validation%20History%3C%2FP%3E%0A%20%20%3CP%3EEXEC%20mdm.udpValidationsCleanup%20%40ModelID%2C%20%40CleanupOlderThanDate%3B%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E--Claenup%20EBS%20tables%3C%2FP%3E%0A%20%20%3CP%3EEXEC%20mdm.udpEntityStagingBatchTableCleanup%20%40ModelID%2C%20%40CleanupOlderThanDate%3B%3C%2FP%3E%0A%20%20%3CP%3E----------------------%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EYou%20can%20also%20run%20the%20cleanup%20on%20predetermined%20schedule%20by%20setting%20up%20a%20SQL%20Agent%20Job%20which%20triggers%20in%20regular%20intervals%20to%20call%20the%20stored%20procedures%20to%20clean%20up%20the%20data.%20%26nbsp%3BYou%20can%20use%20SQL%20Server%20Management%20Studio%20to%20make%20any%20changes%20to%20this%20scheduled%20job.%3C%2FP%3E%0A%20%20%3CP%3E%3CB%3E%20Upcoming%20Releases%3A%20%3C%2FB%3E%3C%2FP%3E%0A%20%20%3CP%3EThese%20stored%20procedures%20will%20also%20be%20release%20as%20part%20of%20the%20upcoming%20cumulative%20update%20for%20SQL%20Server%202014.%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-388205%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Apr%2014%2C%202015%20Master%20Data%20Services%20till%20recently%20didn%E2%80%99t%20have%20a%20supported%20way%20to%20clean%20the%20transaction%20logs%2C%20validation%20issues%20history%20and%20Staging%20tables.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-388205%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Econfiguration%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emaster%20data%20services%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emds%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Not applicable
First published on MSDN on Apr 14, 2015

Master Data Services till recently didn’t have a supported way to clean the transaction logs, validation issues history and Staging tables. For a MDS system with lot of data changes and ETL processes over the period these tables can grow exponentially and lead to performance degradation and storage space issues.

To overcome this problem in “ Cumulative update 15 for SQL Server 2012 SP1 we are providing some helper Stored Procedures which users can call to clean the tables.

What is cleaned?

All the transaction history older than specified date, all the validation issues history older than specified date and all the staging batches which ran before specified date.

How:

You can call the Stored Procedures manually which will clean up the tables. To clean Transaction tables use mdm.udpTransactionsCleanup, to clean Validation History use mdm.udpValidationsCleanup and to clean staging table use mdm.udpEntityStagingBatchTableCleanup.

Sample:

--@ModelID is the model ID that you clean up the log for.

--@CLeanupOlderThanDate is the date before that the logs or records are deleted.

DECLARE @CleanupOlderThanDate date = '2015-01-01',

@ModelID INT = 7     --You can get this fromtable mdm.tblModel

--Cleanup Transaction Logs

EXEC mdm.udpTransactionsCleanup @ModelID, @CleanupOlderThanDate;

--Cleanup Validation History

EXEC mdm.udpValidationsCleanup @ModelID, @CleanupOlderThanDate;

--Claenup EBS tables

EXEC mdm.udpEntityStagingBatchTableCleanup @ModelID, @CleanupOlderThanDate;

----------------------

You can also run the cleanup on predetermined schedule by setting up a SQL Agent Job which triggers in regular intervals to call the stored procedures to clean up the data.  You can use SQL Server Management Studio to make any changes to this scheduled job.

Upcoming Releases:

These stored procedures will also be release as part of the upcoming cumulative update for SQL Server 2014.