| title | Modify session-timeout for an availability group replica | |||
|---|---|---|---|---|
| description | Describes how to configure the session-timeout period of a replica within an Always On availability group. | |||
| ms.custom | seo-lt-2019 | |||
| ms.date | 05/17/2016 | |||
| ms.prod | sql | |||
| ms.reviewer | ||||
| ms.technology | high-availability | |||
| ms.topic | how-to | |||
| helpviewer_keywords |
|
|||
| ms.assetid | e23c6e06-1cd1-4d4a-9bc2-e3e06ab2933d | |||
| author | MashaMSFT | |||
| ms.author | mathoma |
[!INCLUDE SQL Server] This topic describes how to configure the session-timeout period of an Always On availability replica by using [!INCLUDEssManStudioFull], [!INCLUDEtsql], or PowerShell in [!INCLUDEssCurrent]. The session-timeout period is a replica property that controls how many seconds (in seconds) that an availability replica waits for a ping response from a connected replica before considering the connection to have failed. By default, a replica waits 10 seconds for a ping response. This replica property applies only the connection between a given secondary replica and the primary replica of the availability group. For more information about the session-timeout period, see Overview of AlwaysOn Availability Groups (SQL Server).
- You must be connected to the server instance that hosts the primary replica.
We recommend that you keep the time-out period at 10 seconds or greater. Setting the value to less than 10 seconds creates the possibility of a heavily loaded system missing PINGs and declaring a false failure.
Requires ALTER AVAILABILITY GROUP permission on the availability group, CONTROL AVAILABILITY GROUP permission, ALTER ANY AVAILABILITY GROUP permission, or CONTROL SERVER permission.
To change the session-timeout period for an availability replica
-
In Object Explorer, connect to the server instance that hosts the primary replica, and expand the server tree.
-
Expand the Always On High Availability node and the Availability Groups node.
-
Click the availability group whose availability replica you want to configure.
-
Right-click the replica to be configured, and click Properties.
-
In the Availability Replica Properties dialog box, use the Session timeout (seconds) field to change the number of seconds for the session-timeout period on this replica.
To change the session-timeout period for an availability replica
-
Connect to the server instance that hosts the primary replica.
-
Use the ALTER AVAILABILITY GROUP statement, as follows:
ALTER AVAILABILITY GROUP group_name
MODIFY REPLICA ON 'instance_name' WITH ( SESSION_TIMEOUT =seconds )
where group_name is the name of the availability group, instance_name is the name of the server instance that hosts the availability replica to be modified, and seconds specifies the minimum number of seconds that the replica must wait before applying log to databases when acting as a secondary replica. The default is 0 seconds, which indicates that there is no apply delay.
The following example, entered on the primary replica of the
AccountsAGavailability group, changes the session-timeout value to15seconds for the replica located on theINSTANCE09server instance.ALTER AVAILABILITY GROUP AccountsAG MODIFY REPLICA ON 'INSTANCE09' WITH (SESSION_TIMEOUT = 15);
To change the session-timeout period for an availability replica
-
Change directory (cd) to the server instance that hosts the primary replica.
-
Use the Set-SqlAvailabilityReplica cmdlet with the SessionTimeout parameter to change the number of seconds for the session-timeout period on a specified availability replica.
For example, the following command sets the session-timeout period to 15 seconds.
Set-SqlAvailabilityReplica -SessionTimeout 15 ` -Path SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MyAg\AvailabilityReplicas\MyReplica[!NOTE]
To view the syntax of a cmdlet, use the Get-Help cmdlet in the [!INCLUDEssNoVersion] PowerShell environment. For more information, see Get Help SQL Server PowerShell.
To set up and use the SQL Server PowerShell provider