Create a Database Mirroring Endpoint for Always On Availability Groups (SQL Server PowerShell)

 

Published: May 17, 2016

Updated: May 17, 2016

Applies To: SQL Server 2016

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2016)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

This topic describes how to create a database mirroring endpoint for use by Always On Availability Groups in SQL Server 2016 by using PowerShell.

In This Topic

  • Before you begin:  Security

  • To create a database mirroring endpoint, using:  PowerShell

Security

System_CAPS_ICON_important.jpg Important


The RC4 algorithm is deprecated. This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. We recommend that you use AES.

Permissions

Requires CREATE ENDPOINT permission, or membership in the sysadmin fixed server role. For more information, see GRANT Endpoint Permissions (Transact-SQL).

To create a database mirroring endpoint

  1. Change directory (cd) to the server instance for which you want to create the database mirroring endpoint.

  2. Use the New-SqlHadrEndpoint cmdlet to create the endpoint and then use the Set-SqlHadrEndpoint to start the endpoint.

Example (PowerShell)

The following PowerShell commands create a database mirroring endpoint on an instance of SQL Server (Machine\Instance). The endpoint uses port 5022.

System_CAPS_ICON_important.jpg Important


This example works only on a server instance that currently lack a database mirroring endpoint.

# Create the endpoint.  
$endpoint = New-SqlHadrEndpoint MyMirroringEndpoint -Port 5022 -Path SQLSERVER:\SQL\Machine\Instance  
  
# Start the endpoint  
Set-SqlHadrEndpoint -InputObject $endpoint -State "Started"  
  

To Configure a Database Mirroring Endpoint

To View Information About the Database Mirroring Endpoint

Create an Availability Group (Transact-SQL)
Overview of Always On Availability Groups (SQL Server)

Community Additions

ADD
Show: