As a DBA it is important to have a toolbox that supports the work you do. You need to have a toolbox that allows you to work smarter instead of harder. DBA’s who have a well-stocked toolbox will be able to respond to support and maintenance request quickly, efficiently and accurately. One set of tools you should consider putting in your toolbox is the tool kit named “DBATools”.
DBATools is a free set of open source PowerShell Module that can be downloaded from here:
What is “DBATools”? It is a PowerShell tool kit that has more than 500 SQL Server administrative, best practice and migration commands to manage your SQL Server database environment. Those 500 PowerShell commands are organized into different categories of SQL Server support. Here is a list of the currently available categories:
As you can see the DBAtools PowerShell module has a lot of different SQL Server maintenance/management categories it supports. To demonstrate some of the things you can do using this new tool kit, let me go through a couple of examples of how I use it.
As DBAs, we know it is important to monitor growth events of your database. By using DBATools it is easy to find all the latest growth events on your instance by using the Find-DbaDbGrowthEvent module. Here is an example of what this module shows on my instance of SQL Server:
As you can see, I have one growth event that occurred on 10/11/2019 at 2:49:56 PM which took 23 milliseconds to autogrow my database.
Another useful thing that the DBATools can do is generate a list of all the backups for a particular database. To display those backups for a database all you need is to use the Get-DbaDbBackupHistory modules, as I have done below for the AdventureWorks2016CTP3 database.
Next time you need to perform some maintenance to your database, and you don’t have a simple way to perform that maintenance, consider looking to see if there is a DBAtools module that will allow you to quickly accomplish your maintenance. By using tools to automate maintenance you can free up your time for more important DBA tasks.