dbatools is not only intended to be a great migration tool, but also a toolset to help DBAs follow best practices. Check out all the new commands in this batch, courtesy of Mike Fal, Constantine Kokkinos and Chrissy LeMaire.
Best Practices Commands
Ever read a really great article about how to do something properly but then kinda forgot and you have to revisit each time? Well, we’ve codified some of those practices for you, making them easy to both follow and remember.
- Test-DbaDbOwner and Set-DbaDbOwner
Database ownership is complicated, but many SQL Server experts suggest using one specific account, be it sa or an alternative account that your organization has decided on. These commands, created by Mike Fal, validate or set ownership on all databases on an instance to a SQL login you specify, or the default of sa.
This command, created by Constantine Kokkinos, evaluates a servers disk setup to see if it aligns with the Disk Partition Alignment Best Practices recommended by Microsoft. Disk Alignment is a very complicated subject, but we did our best to make it easy to evaluate your environment.
Test-DbaAgentJobOwner and Set-DbaAgentJobOwner
These commands, created by Mike Fal, will check and set all SQL Agent Job on an instance against a SQL login to validate if that login owns those SQL Agent Jobs or not. By default, the function will check against ‘sa’ for ownership, but the user can pass a specific login if they use something else. For the Test command, only jobs that fail the test will be returned.
This command returns database virtual log file information for database files on a SQL instance. As you may already know, having a TLog file with too many VLFs can hurt database performance. This command helps you easily see the VLF counts for all your databases, or just specific ones.
Commands that make your life easier
Returns the active node(s) of a SQL Cluster
Install-SqlSpWhoIsActive and Update-SqlSpWhoIsActive
Install and update Adam Machanic’s sp_whoisactive with ease using these commands. The latest version of sp_whoisactive is automatically downloaded from Adam’s site and installed. Update-SqlSpWhoIsActive is actually an alias for Install-SqlSpWhoIsActive since Adam’s install routine handles updates.
Commands that are coming soon
And we’ve got more planned!
Maintenance plan support isn’t provided by dbatools at this time, but that’s soon going to change once this command is complete.
Like Reset-DbaAdmin, this is a command that won’t be used often, but when it is, its a lifesaver.
This one’s gonna be fun. Scan your subnet, AD or specific servers for SQL Server instances.
We wanted to ensure this command is as fail-proof and useful as possible. It’s been tough getting progress bars to work, but we’re getting there! This command should be available in our next batch.
Routine to restore databases from directories (think the way that Ola Hallengren’s outputs his by default)
Routine to remove SQL backups from disk. If you copy your backups to tape or use a third-party solution, this command will ensure that no backups are deleted until they’ve been marked as archived.
Routine to test your backups
Write the results of Show-SqlSpWhoIsActive to table!
Some of these commands are in their infancy. Want to help make them better? Come join the coding party! We’re all hanging out on the SQL Server Community Slack in the #dbatools channel.