A blog about SQL Server, SSIS, C# and whatever else I happen to be dealing with in my professional life.

Find ramblings

Wednesday, March 5, 2014

Biml - History Cleanup Task

Biml - History Cleanup Task

The History Cleanup Task is another of those Database Maintenance tasks that I never use. It requires an ADO connection manager and allows you to cleanup any combination of backup and restore history, SQL Server Agent history and Maintenance plan history.

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Connections>
        <AdoNetConnection Name="CM_ADO_DB" ConnectionString="Data Source=localhost\dev2012;Integrated Security=SSPI;Connect Timeout=30;Database=msdb;" Provider="SQL"  />
    </Connections>

    <Packages>
        <Package ConstraintMode="Linear" Name="Task_HistoryCleanup">
            <Tasks>
                <!-- Look busy without doing anything -->
                <HistoryCleanup 
                    ConnectionName="CM_ADO_DB" 
                    Name="HC Clean as my children do"
                    OlderThanTimeUnits="4"
                    OlderThanTimeUnitType="Weeks"
                    RemoveBackupRestoreHistory="false"
                    RemoveDBMaintenanceHistory="false"
                    RemoveSqlAgentHistory="false"
                />
            </Tasks>
        </Package>
    </Packages>
</Biml>

Result

A package is created with our ADO.NET connection manager and a single Cleanup History task.

HC Clean as my children doa

I've configured the History Cleanup task to do nothing.

I love that it actually warns you of this as you click the View T-SQL button

No comments: