Disable-SqlAlwaysOn

Disables the AlwaysOn availability groups feature for a server.

语法

ByPath (默认值)

Disable-SqlAlwaysOn
    [[-Path] <String>]
    [-NoServiceRestart]
    [-Force]
    [-Credential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByObject

Disable-SqlAlwaysOn
    [-InputObject] <Server>
    [-NoServiceRestart]
    [-Force]
    [-Credential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByName

Disable-SqlAlwaysOn
    -ServerInstance <String>
    [-NoServiceRestart]
    [-Force]
    [-Credential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

说明

The Disable-SqlAlwaysOn cmdlet disables the AlwaysOn vailability groups feature on a SQL Server instance. If the AlwaysOn availability groups feature is disabled while the SQL Server service is running, the database engine service must be restarted for the changes to complete. Unless you specify the Force parameter, the cmdlet prompts you to restart the service.

If the AlwaysOn availability groups feature is already disabled, this cmdlet makes no changes.

This cmdlet can run against a remote service.

You must have Administrator permissions to execute this cmdlet.

示例

Example 1: Disable AlwaysOn availability groups at the specified path

PS C:\> Disable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance"

This command disables AlwaysOn availability groups on the instance of SQL Server located at the specified path. This command requires restarting the server instance, and you will be prompted to confirm this restart.

Example 2: Disable AlwaysOn availability groups at the specified path and restart the server without confirmation

PS C:\> Disable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance" -Force

This command disables AlwaysOn availability groups on the instance of SQL Server located at the specified path. The Force option causes the server instance to be restarted without prompting you for confirmation.

Example 3: Disable AlwaysOn availability groups for the specified server instance

PS C:\> Disable-SqlAlwaysOn -ServerInstance "Computer\Instance"

This command disables AlwaysOn availability groups on the instance of SQL Server named Computer\Instance. This command requires restarting the instance and you will be prompted to confirm this restart.

Example 4: Disable AlwaysOn availability groups for the specified server instance using Windows authentication

PS C:\> Disable-SqlAlwaysOn -ServerInstance "Computer\Instance" -Credential (Get-Credential "DOMAIN\Username")

This command disables AlwaysOn availability groups on the instance of SQL Server named Computer\Instance using Windows authentication. You will be prompted to enter the password for the specified account, DOMAIN\Username. This change requires restarting the instance and you will also be prompted to confirm this restart.

Example 5: Disable AlwaysOn availability groups at the specified path without restarting the server

PS C:\> Disable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance" -NoServiceRestart

This command disables AlwaysOn availability groups on the instance of SQL Server located at the specified path, but the command does not restart the instance. The change will not take effect until you manually restart this server instance.

参数

-Confirm

Prompts you for confirmation before running the cmdlet.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Credential

Specifies a windows credential that has permission to alter the AlwaysOn setting on the SQL Server instance.

参数属性

类型:PSCredential
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Force

Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-InputObject

Specifies the server object of the instance of SQL Server where the AlwaysOn availability groups setting is disabled.

参数属性

类型:Server
默认值:None
支持通配符:False
不显示:False

参数集

ByObject
Position:2
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-NoServiceRestart

Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Path

Specifies the path to the instance of the SQL Server. This is an optional parameter. If not specified, the value of the current working location is used.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByPath
Position:2
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ServerInstance

Specifies the name of the instance of the SQL Server where AlwaysOn is disabled. The format should be MACHINENAME\INSTANCE. Use the Credential parameter to change the AlwaysOn setting on a remote server.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByName
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:wi

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

输入

SMO.Server