Database Maintenance Tasks in SSIS

Tools for keeping your SQL indexes in check.

Do you have a large data import that leaves your indexes less than perfect? Do you want to backup your current database before you run a purge package? You are in luck; SSIS contains a handful of database maintenance tasks for these and other special occasions. If you have worked with database maintenance plans in SQL Server 2005 or SQL Server 2008, then you are already familiar with what can be done in SSIS. You may or may not know that maintenance plans are just SSIS packages that you built with a different tool. So why is this all important? Well, as I stated earlier, when you do things to your data, you will change the state of index fragmentation and if you are deleting or updating data, you could potentially lose information. By using the maintenance plans tasks in SSIS you can build in backup, reindexing, and other maintenance processes to your package. The best thing about this is that they will run in the bounds of your control flow so you won't have to do try and guess at scheduling as you would if you were trying to coordinate SQL Agent Jobs. Most of the tasks are very self explanatory but here is a complete list anyway.

  • Back Up Database - Performs database backups
  • Execute SQL Server Agent Job – Starts a SQL Server Agent job
  • Check Database Integrity – Runs DBCC CHECKDB to verify database integrity
  • Execute T-SQL Statement – Run provided T-SQL against a SQL Server.
  • History Cleanup -  Cleans up history in MSDB including backup history, maintenance plan history and job history
  • Maintenance Cleanup – Cleans up backup files or maintenance plans text reports
  • Notify Operator – Sends a notification to a SQL Operator
  • Rebuild Index – Rebuilds one or more indexes
  • Reorganize Index – Reorganizes one or more indexes
  • Shrink Database – Use to shrink a file or files in a database
  • Update Statistics – Updates database statistics

About the Author

Eric Johnson, SQL Server MVP, is the owner of Consortio Services in Colorado Springs providing IT systems management and technology consulting. He is also the President of the Colorado Springs SQL Server User Group. He can be contacted at


  • Microsoft Talks Teams and SharePoint at Modern Workplace Event

    It's a hybrid world, but remote work is here to stay, according to Microsoft's Teams and SharePoint head Jeff Teper.

  • Malwarebytes Affirms Other APT Attack Methods Used Besides 'Solorigate'

    Security solutions company Malwarebytes affirmed on Monday that alternative methods besides tainted SolarWinds Orion software were used in the recent "Solorigate" advanced persistent threat (APT) attacks.

  • How To Fix the Hyper-V Read Only Disk Problem

    DOS might seem like a relic now, but sometimes it's the only way to fix a problem that Windows seems ill-equipped to deal with -- like this one.

  • Microsoft Warns IT Pros on Windows Netlogon Fix Coming Next Month

    Microsoft on Thursday issued a reminder to organizations to ensure that their systems are properly patched for a "Critical"-rated Windows Netlogon vulnerability before next month's "update Tuesday" patch distribution arrives.

comments powered by Disqus