July 2020

dbatools = command-line SSMS dbatools = command-line SSMS

dbatools commands used in this post: Rename-DbaDatabase Set-DbaDbOwner Set-DbaDbCompatibility Set-DbaDbRecoveryModel Set-DbaDbQueryStoreOption Set-DbaTempDbConfig Rename-DbaLogin Set-DbaLogin Set-DbaAgentJob Set-DbaAgentJobStep Set-DbaAgentJobOutputFile Set-DbaAgentJobOwner Invoke-DbaCycleErrorLog Set-DbaErrorLogConfig Change database The reasons to alter the database might be as many as different users. Some want to rename the old database, or maybe change the owner or recovery model after restoring the database. Enabling…

Read More dbatools.io = command-line SQL Server Management Studio: Request for change

dbatools = command-line SSMS dbatools = command-line SSMS

dbatools commands used in this post: Remove-DbaDatabase Remove-DbaLogin Remove-DbaDbUser Remove-DbaDbRoleMember Remove-DbaDbRole Remove-DbaServerRole Remove-DbaAgentJobStep Remove-DbaAgentJob One note before we start dropping objects on the SQL Server. The dbatools commands support a -WhatIf switch (more about that here). I would encourage you to test it out, especially with commands that are removing things. Drop database Who does…

Read More dbatools.io = command-line SQL Server Management Studio: Drop it

dbatools = command-line SSMS dbatools = command-line SSMS

dbatools commands used in this post: New-DbaDatabase New-DbaLogin New-DbaDbRole New-DbaDbUser New-DbaAgentJob New-DbaAgentJobStep New-DbaAgentSchedule New-DbaDbMailAccount New-DbaDbMailProfile New database Request for a new database is a pretty standard and repeatable task. It can be either a simple database based on the model database or more complex with multiple data files and filegroups. SSMS dbatools: New-DbaDatabase New login/user/role…

Read More dbatools.io = command-line SQL Server Management Studio: Something new

dbatools = command-line SSMS dbatools = command-line SSMS

dbatools commands used: Get-DbaDatabase Get-DbaDbFile Get-DbaDbSpace Get-DbaDbState Get-DbaAgentJob Get-DbaAgentJobStep Get-DbaLogin Get-DbaDbUser Get-DbaServerRole Get-DbaServerRoleMember Get-DbaDbRole Get-DbaDbRoleMember See the databases When I want to quickly check the databases in the SSMS I would use this: SSMS With dbatools I can run the following command: dbatools: Get-DbaDatabase In a comparable way we can see details of a single…

Read More dbatools.io = command-line SQL Server Management Studio: Let me see

dbatools = command-line SSMS dbatools = command-line SSMS

dbatools commands used in this post: Connect-DbaInstance Invoke-DbaQuery Write-DbaDbTableData Connect to the Database Engine It is possible in dbatools to create a server object and reuse it without providing the credentials and connecting to the instance again and again. SSMS dbatools: Connect-DbaInstance Execute a simple query Once the connection is established you can run the…

Read More dbatools.io = command-line SQL Server Management Studio: Connect, Query and Save