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. -
Test-DbaDiskAlignment
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-DbaDiskAllocation
This command helps DBAs check all disks on a computer to see if they are formatted to 64k. It also reports if a disk has SQL Server data on it or not. -
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. -
Test-DbaPowerPlan and Set-DbaPowerPlan
These commands Test and Set the SQL Server OS’s Power Plan. It defaults to High Performance which is Best Practice. -
Measure-DbaDbVirtualLogFile
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
- Get-DbaClusterActiveNode
Returns the active node(s) of a SQL Cluster -
Get-DbaDbSpace
These commands, created by Mike Fal, get information about space available inside the database. -
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!
- Copy-SqlMaintenancePlan
Maintenance plan support isn’t provided by dbatools at this time, but that’s soon going to change once this command is complete. -
Disable-DbaLogonTrigger
Like Reset-DbaAdmin, this is a command that won’t be used often, but when it is, its a lifesaver. -
Find-DbaSqlInstance
This one’s gonna be fun. Scan your subnet, AD or specific servers for SQL Server instances. -
Move-DbaDatabaseFile
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. -
Restore-DbaBackupFromDirectory
Routine to restore databases from directories (think the way that Ola Hallengren’s outputs his by default) -
Remove-DbaBackupFromDisk
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. -
Test-DbaBackup
Routine to test your backups -
Write-SqlSpWhoIsActive
Write the results of Show-SqlSpWhoIsActive to table!
Join us!
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.
Fantastic work people!
Fantastic Set of Powerful scripts, i love each and every one of them. if you don’t fell like i am asking for more.Could you please introduce power-shell to balance cluster and fail-over resources during patching maintenance window. i have dealt with many scripts but none of them satisfying me.
some inputs/features
1. Fail over selected resources ( Balancing)
2. Fail over and fail back all or few resources per node.
3. Logging the error would be nice to have.
Thanks in advance !!!