IT tutorials
 
Database
 

Microsoft SQL Server 2008 R2 : Setting Up and Configuring Database Mirroring (part 2) - Creating the Endpoints & Granting Permissions

2/27/2012 6:11:11 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Creating the Endpoints

Each server instance in the database mirroring configuration must have an endpoint defined so that the other servers can communicate with it. This is sort of like a private phone line to your friends. Let’s use the scripts provided as opposed to using the Configure Security Wizard. The first endpoint script is in the file 2008 Create EndPoint Partner1.SQL.

From SSMS, you need to open a new query connection to your principal database by selecting File, New and in the New Query dialog, selecting Query with Current Connection. Open the SQL file for the first endpoint.

The following CREATE ENDPOINT T-SQL creates the endpoint named EndPoint4DBMirroring1430, with the listener_port value of 1430, and the database mirroring role Partner:

-- create endpoint for principal server --
CREATE ENDPOINT [EndPoint4DBMirroring1430]
    STATE=STARTED
    AS TCP (LISTENER_PORT = 1430, LISTENER_IP = ALL)
    FOR DATA_MIRRORING (ROLE = PARTNER, AUTHENTICATION = WINDOWS NEGOTIATE
, ENCRYPTION = REQUIRED ALGORITHM RC4)

After this T-SQL runs, you should quickly run the following SELECT statements to verify that the endpoint has been correctly created:

select name,type_desc,port,ip_address from sys.tcp_endpoints;

SELECT db.name, m.mirroring_role_desc
FROM sys.database_mirroring m
JOIN sys.databases db
ON db.database_id = m.database_id
WHERE db.name = N'AdventureWorks';

select name,role_desc,state_desc from sys.database_mirroring_endpoints;

Figure 4 shows the desired result set from these queries.

Figure 4. Verifying that an endpoint is created for database mirroring.

If you also look at the database properties for the AdventureWorks database on the principal server (SQL08DE01, in this example), you see the server network address for the principal server automatically appear now when you look at the Database Properties Mirroring page (see Figure 5).

Figure 5. The Mirroring page of the AdventureWorks database on the principal server.

Starting with the sample SQL scripts 2008 Create EndPoint Partner2.SQL and 2008 Create EndPoint Witness.SQL, you need to repeat the endpoint creation process for the mirror server (using a listener_port value of 1440) and the witness server (using a listener_port value of 1450) by opening a query connection to each one of these servers and running the following CREATE ENDPOINT commands:

-- create endpoint for mirror server --
CREATE ENDPOINT [EndPoint4DBMirroring1440]
    STATE=STARTED
    AS TCP (LISTENER_PORT = 1440, LISTENER_IP = ALL)
    FOR DATA_MIRRORING (ROLE = PARTNER, AUTHENTICATION = WINDOWS NEGOTIATE
, ENCRYPTION = REQUIRED ALGORITHM RC4)

For the witness server (notice that the role is now Witness), you run the following:

-- create endpoint for witness server --
CREATE ENDPOINT [EndPoint4DBMirroring1450]
    STATE=STARTED
    AS TCP (LISTENER_PORT = 1450, LISTENER_IP = ALL)
    FOR DATA_MIRRORING (ROLE = WITNESS, AUTHENTICATION = WINDOWS NEGOTIATE
, ENCRYPTION = REQUIRED ALGORITHM RC4)

Granting Permissions

It is possible to have an AUTHORIZATION [login] statement in the CREATE ENDPOINT command that establishes the permissions for a login account to the endpoint being defined. However, separating this out into a GRANT greatly stresses the point of allowing this connection permission. From each SQL query connection, you run a GRANT to allow a specific login account to connect on the ENDPOINT for database mirroring. If you don’t have a specific login account to use, default it to [NT AUTHORITY\SYSTEM].

First, from the principal server instance (SQL08DE01), you run the following GRANT (substituting [DBARCHLT\Paul Bertucci] with your specific login account to be used by database mirroring):

GRANT CONNECT ON ENDPOINT::EndPoint4DBMirroring1430 TO [DBARCHLT\Paul Bertucci];


					  

Then, from the mirror server instance (SQL08DE02), you run the following GRANT:

GRANT CONNECT ON ENDPOINT:: EndPoint4DBMirroring1440 TO [DBARCHLT\Paul Bertucci];


					  

Then, from the witness server instance (SQL08DE03), you run the following GRANT:

GRANT CONNECT ON ENDPOINT:: EndPoint4DBMirroring1450 TO [DBARCHLT\Paul Bertucci];					  
 
Others
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us