The New-SqlAvailabilityGroup cmdlet creates an availability group in AlwaysOn Availability Groups.
The InputObject or Path parameter specifies the server that hosts the initial primary replica.
The first command gets an instance of SQL Server on the primary server, and then stores it in the $PrimaryServer variable.
The second command gets an instance of SQL Server on the secondary server, and then stores it in the $SecondaryServer variable.
The third command creates a replica that includes the primary server instance by using the New-SqlAvailabilityReplica cmdlet, and then stores it in the $PrimaryReplica variable.
The command specifies the version of the server instance by using the Version property of $PrimaryServer.
The fourth command creates a replica that includes the secondary server instance by using New-SqlAvailabilityReplica, and then stores it in the $SecondaryReplica variable.
The command specifies the version of the server instance by using the Version property of $SecondaryServer.
The final command creates the availability group.
It specifies the name, the primary server, the replicas, and other information.
Параметры
-AutomatedBackupPreference
Specifies the automated backup preference for the availability group.
The acceptable values for this parameter are:
Primary.
Specifies that the backups always occur on the primary replica.
This option supports the use of features not available when backup runs on a secondary replica, such as differential backups.
SecondaryOnly.
Specifies that backups are never performed on primary replicas.
If the primary replica is the only replica online, the backup does not occur.
Secondary.
Specifies that backups occur on secondary replicas, unless the primary replica is the only replica online.
Then the backup occurs on the primary replica.
None.
Specifies that the primary or secondary status is not taken into account when deciding which replica performs backups.
Instead, backup priority and online status determine which replica performs backups.
Свойства параметра
Тип:
AvailabilityGroupAutomatedBackupPreference
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-AvailabilityReplica
Specifies an array of availability replicas that this cmdlet includes in the availability group.
To obtain an AvailabilityReplica object, use the New-SqlAvailabilityReplica cmdlet.
Specify the AsTemplate parameter.
Свойства параметра
Тип:
AvailabilityReplica[]
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
True
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-BasicAvailabilityGroup
The New-SqlAvailabilityGroup cmdlet creates an availability group in AlwaysOn Availability Groups.
The InputObject or Path parameter specifies the server that hosts the initial primary replica.
Свойства параметра
Тип:
SwitchParameter
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-Confirm
Prompts you for confirmation before running the cmdlet.
Свойства параметра
Тип:
SwitchParameter
Default value:
False
Поддерживаются подстановочные знаки:
False
DontShow:
False
Aliases:
cf
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-Database
Specifies an array of local, read/write user databases.
These databases must use the full recovery model and must not use AUTO_CLOSE.
These databases cannot belong to another availability group and cannot be configured for database mirroring.
You must specify a value for this parameter.
Свойства параметра
Тип:
String[]
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-DatabaseHealthTrigger
The New-SqlAvailabilityGroup cmdlet creates an availability group in AlwaysOn Availability Groups.
The InputObject or Path parameter specifies the server that hosts the initial primary replica.
Свойства параметра
Тип:
SwitchParameter
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-DtcSupportEnabled
The New-SqlAvailabilityGroup cmdlet creates an availability group in AlwaysOn Availability Groups.
The InputObject or Path parameter specifies the server that hosts the initial primary replica.
Свойства параметра
Тип:
SwitchParameter
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-FailureConditionLevel
Specifies the automatic failover behavior of the availability group.
The acceptable values for this parameter are:
OnServerDown.
Failover or restart if the SQL Server service stops.
OnServerUnresponsive.
Failover or restart if any condition of lower value is satisfied, plus when the SQL Server service is connected to the cluster and the HealthCheckTimeout threshold is exceeded, or if the availability replica currently in primary role is in a failed state.
OnCriticalServerError.
Failover or restart if any condition of lower value is satisfied, plus when an internal critical Server error occurs, which include out of memory condition, serious write-access violation, or too much dumping.
OnModerateServerError.
Failover or restart if any condition of lower value is satisfied, plus if a moderate Server error occurs, which includes persistent out of memory condition.
OnAnyQualifiedFailureConditions.
Failover or restart if any condition of lower value is satisfied, plus if a qualifying failure condition occurs, which includes engine worker thread exhaustion and unsolvable deadlock detected.
Свойства параметра
Тип:
AvailabilityGroupFailureConditionLevel
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-HealthCheckTimeout
Specifies the length of time, in milliseconds, after which AlwaysOn availability groups declare an unresponsive server to be unhealthy.
Свойства параметра
Тип:
Int32
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-InputObject
Specifies the instance of SQL Server that hosts the primary replica of the availability group that this cmdlet creates.
Свойства параметра
Тип:
Server
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
ByObject
Position:
3
Обязательно:
True
Значение из конвейера:
True
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-Name
Specifies the name of the availability group that this cmdlet creates.
Свойства параметра
Тип:
String
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
2
Обязательно:
True
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-Path
Specifies the path of the instance of SQL Server that hosts the initial primary replica of the availability group that this cmdlet creates.
If you do not specify this parameter, this cmdlet uses current working location.
If you specify a value, the path must currently exist.
Свойства параметра
Тип:
String
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
ByPath
Position:
3
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-Script
Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.
Свойства параметра
Тип:
SwitchParameter
Default value:
None
Поддерживаются подстановочные знаки:
False
DontShow:
False
Наборы параметров
(All)
Position:
Named
Обязательно:
False
Значение из конвейера:
False
Значение из конвейера по имени свойства:
False
Значение из оставшихся аргументов:
False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Свойства параметра
Тип:
SwitchParameter
Default value:
False
Поддерживаются подстановочные знаки:
False
DontShow:
False
Aliases:
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.