This is my DBA database that contains my utility scripts that I use to help manage my servers.
Some of this code was never intended to be used by anyone else--it's primarily here for myself, but if you want to use it, make sure you know exactly what it's doing before using any of this code.
Some of this code (including the installer!) assumes that the First Responder Kit (firstresponderkit.org) and Ola Hallengren's SQL Server Maintenance Solution (ola.hallengren.com) are installed in the same database as well. PowerShell script provided to pull that stuff from it's respective download location. Redistributing other people's code isn't my thing.
- SQL Server 2016 SP1 or later is the technical baseline for
CREATE OR ALTER; individual objects may require newer features or third-party projects. For supported deployments, use a SQL Server release that Microsoft currently supports (SQL Server 2017 and later as of November 2026). - PowerShell with the
SqlServermodule (the installer leans onInvoke-SqlcmdandWrite-SqlTableData). - Permission to create a database on the target instance (or a database that already exists for you to install into).
- The goal is to support SQL Server versions still supported by Microsoft. Each script can have additional version or feature requirements; check its header and test it against the target version.
- The DBA database itself must use compatibility level 130 or later for first-party code that uses
STRING_SPLIT. The distributeddbo.fn_splithelper remains available for lower-compatibility databases and is retained inSet_AGReadOnlyRoutingto preserve the caller's routing-list order. - Many legacy scripts may run on older versions, including SQL Server 2005, but those versions are unsupported and new changes are not tested against them.
By default, the installer will create a database named DBA (if it doesn't already exist), and install all objects in that DBA database. You can deploy to a database named something other than DBA by using the -DatabaseName parameter on the install script. This install script assumes that you have permission to create the database, or that it already exists.
The installer creates and alters database objects, and installs some third-party tools into the target database or master. Review the scripts and use a development or otherwise isolated instance when evaluating the project; do not point the installer at production as a test.
- Clone this repo.
- Open a PowerShell prompt & navigate (ie
Set-Location) to thedba-databasefolder you just cloned. - Run
Get-OpenSourceScripts.ps1to grab the latest versions of the open source/third-party projects. - Also from dba-database folder, run
Install-LatestDbaDatabase.ps1 -InstanceName "MyInstance"- By default, the installer will use
DBAas the database name. To use a different database name, specify that using the-DatabaseNameparameter. - The
-InstanceNameparameter will accept an array of server names, if you want to deploy to many servers.
- By default, the installer will use
If you experience issues with the install experience, please create an issue in GitHub.
This is mostly my own toolbox, but if you want to fix something or add to it, I'm glad for the help. Start with CONTRIBUTING.md — it covers the coding conventions I follow and how to get a change in (short version: open an issue first, then send a PR). Be decent to each other while you're at it; the Code of Conduct applies.
This code is licensed under the BSD 2-Clause License. Use it, fork it, ship it — just keep the copyright notice around.
The bundled third-party scripts are not mine and keep their own licenses:
- The First Responders Kit is distributed under the MIT License.
- Ola Hallengren's SQL Server Maintenance Solution is distributed under the MIT License.
- sp_WhoIsActive is distributed under the GNU GPL v3.
- The Darling Data SQL Server Troubleshooting Scripts are distributed under the MIT License.