-
Notifications
You must be signed in to change notification settings - Fork 225
SqlAlwaysOnService
dscbot edited this page Oct 26, 2024
·
11 revisions
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
InstanceName | Key | String | The name of the SQL Server instance to be configured. | |
Ensure | Required | String | An enumerated value that describes if the SQL Server should have Always On High Availability and Disaster Recovery (HADR) property enabled ('Present' ) or disabled ('Absent' ). |
Present , Absent
|
ServerName | Write | String | The hostname of the SQL Server to be configured. Default value is the current computer name. | |
RestartTimeout | Write | UInt32 | The length of time, in seconds, to wait for the service to restart. Default value is 120 seconds. |
The SqlAlwaysOnService
DSC resource enables or disables SQL Server Always
On high availability and disaster recovery (Always On HADR) for a SQL
Server instance.
- Target machine must be running Windows Server 2012 or later.
- Target machine must be running SQL Server Database Engine 2012 or later.
- Target machine must be a member of a Windows Server Failover Cluster.
All issues are not listed here, see here for all open issues.
This example shows how to enable SQL Server Always On high availability and disaster recovery (HADR).
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlAlwaysOnService 'EnableAlwaysOn'
{
Ensure = 'Present'
ServerName = 'SP23-VM-SQL1'
InstanceName = 'MSSQLSERVER'
RestartTimeout = 120
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
This example shows how to disable SQL Server Always On high availability and disaster recovery (HADR).
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlAlwaysOnService 'DisableAlwaysOn'
{
Ensure = 'Absent'
ServerName = 'SP23-VM-SQL1'
InstanceName = 'MSSQLSERVER'
RestartTimeout = 120
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
- Add-SqlDscNode
- Add-SqlDscTraceFlag
- Complete-SqlDscFailoverCluster
- Complete-SqlDscImage
- Connect-SqlDscDatabaseEngine
- ConvertFrom-SqlDscDatabasePermission
- ConvertFrom-SqlDscServerPermission
- ConvertTo-SqlDscDatabasePermission
- ConvertTo-SqlDscServerPermission
- Disable-SqlDscAudit
- Disconnect-SqlDscDatabaseEngine
- Enable-SqlDscAudit
- Get-SqlDscAudit
- Get-SqlDscConfigurationOption
- Get-SqlDscDatabasePermission
- Get-SqlDscManagedComputer
- Get-SqlDscManagedComputerService
- Get-SqlDscPreferredModule
- Get-SqlDscServerPermission
- Get-SqlDscStartupParameter
- Get-SqlDscTraceFlag
- Import-SqlDscPreferredModule
- Initialize-SqlDscRebuildDatabase
- Install-SqlDscServer
- Invoke-SqlDscQuery
- New-SqlDscAudit
- Remove-SqlDscAudit
- Remove-SqlDscNode
- Remove-SqlDscTraceFlag
- Repair-SqlDscServer
- Save-SqlDscSqlServerMediaFile
- Set-SqlDscAudit
- Set-SqlDscDatabasePermission
- Set-SqlDscServerPermission
- Set-SqlDscStartupParameter
- Set-SqlDscTraceFlag
- Test-SqlDscIsDatabasePrincipal
- Test-SqlDscIsLogin
- Test-SqlDscIsSupportedFeature
- Uninstall-SqlDscServer
- SqlAG
- SqlAGDatabase
- SqlAgentAlert
- SqlAgentFailsafe
- SqlAgentOperator
- SqlAGListener
- SqlAGReplica
- SqlAlias
- SqlAlwaysOnService
- SqlAudit
- SqlConfiguration
- SqlDatabase
- SqlDatabaseDefaultLocation
- SqlDatabaseMail
- SqlDatabaseObjectPermission
- SqlDatabasePermission
- SqlDatabaseRole
- SqlDatabaseUser
- SqlEndpoint
- SqlEndpointPermission
- SqlLogin
- SqlMaxDop
- SqlMemory
- SqlPermission
- SqlProtocol
- SqlProtocolTcpIp
- SqlReplication
- SqlRole
- SqlRS
- SqlRSSetup
- SqlScript
- SqlScriptQuery
- SqlSecureConnection
- SqlServiceAccount
- SqlSetup
- SqlTraceFlag
- SqlWaitForAG
- SqlWindowsFirewall