Author | Sander Stad (@sqlstad), sqlstad.nl |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Remove-DbaDbLogShipping on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaDbLogShipping.
Remove-DbaDbLogShipping will remove one or more databases from log shipping
The command Remove-DbaDbLogShipping will remove one or more databases from log shipping
After running the command it will remove all the jobs, configurations set up for log shipping
By default the secondary database will NOT be removed.
Use -RemoveSecondaryDatabase to make the command the secondary database
Remove-DbaDbLogShipping
[-PrimarySqlInstance] <DbaInstanceParameter>
[[-SecondarySqlInstance] <DbaInstanceParameter>]
[[-PrimarySqlCredential] <PSCredential>]
[[-SecondarySqlCredential] <PSCredential>]
[-Database] <Object[]>
[-RemoveSecondaryDatabase]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Remove-DbaDbLogShipping -PrimarySqlInstance sql1 -SecondarySqlInstance sql2 -Database DB1
Remove the log shipping for database DB1
PS C:\> Remove-DbaDbLogShipping -PrimarySqlInstance sql1 -Database DB1
Remove the log shipping for database DB1 and let the command figure out the secondary instance
PS C:\> Remove-DbaDbLogShipping -PrimarySqlInstance localhost -SecondarySqlInstance sql2 -Database DB1, DB2
Remove the log shipping for multiple database
PS C:\> Remove-DbaDbLogShipping -PrimarySqlInstance localhost -SecondarySqlInstance localhost -Database DB2 -RemoveSecondaryDatabase
Remove the log shipping for database DB2 and remove the database from the secondary instance
Primary SQL Server instance which contains the primary database(s).
You must have sysadmin access and server version must be SQL Server version 2000 or greater.
Alias | |
Required | True |
Pipeline | false |
Default Value |
Database to remove from log shipping.
This is the name of the database located on the primary instance
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Secondary SQL Server instance which contains the secondary database(s)
You must have sysadmin access and server version must be SQL Server version 2000 or greater.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default the command will not remove the database from the secondary instance.
Use this parameter to make the command remove that database
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the command were to run. No actions are actually performed.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before executing any changing operations within the command.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |