lundi 29 décembre 2014

Please help me resolve this SQL mirroring error which comes when I ‘Start’ the mirror. The network address can not be reached or does not exist


Here are all the steps I took to build the mirror for the db MIRRORDATABASEI am using separate physical servers for mirroring.


I ran:



ALTER DATABASE MIRRORDATABASE SET TRUSTWORTHY ON


to ensure that SQL Server trusts the database and the contents within it.


I ran trace flag (1400) to ensure mirroring was enabled.

It should be for SQL Server 2008 r2.


Windows Firewall state is off on both principal and mirror.


Mirror db MIRRORDATABASE is in Norecovery.


Name and port of the Mirror server instance are correct. Name and port of the Principal server instance are correct.


The destination mirror server instance is not behind a firewall. The principal server instance is not behind a firewall.


I ran



ALTER AUTHORIZATION ON DATABASE::MirrorDatabase TO [Domain\User];


to provide authorization on db to service account for Mirroring.

I accessed the error log but nothing about mirroring or endpoints was ever in the log. I ensured that SQL Server Service account was the same on principal and mirror. Domain\User. Database mirroring does not support FILESTREAM. I have not set up any FILESTREAM code. I have ensured that both instances, principal and mirror, have Full recovery model. I created a master key and encrypted authentication by it.



CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'P@ssw0rd'
ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY


I have created two endpoints for principal and mirror which open these ports to listening for endpoint


On mirror instance:



CREATE ENDPOINT SSRS_Mirroring
STATE = STARTED
AS TCP (Listener_Port = 50279, LISTENER_IP = ALL)
FOR DATABASE_MIRRORING
(
AUTHENTICATION = Windows Kerberos,
ENCRYPTION = Supported,
ROLE = PARTNER
);
GO


On principal instance:



CREATE ENDPOINT SSRS_Principal
STATE = STARTED
AS TCP (Listener_Port = 50280, LISTENER_IP = ALL)
FOR DATABASE_MIRRORING
(
AUTHENTICATION = Windows Kerberos,
ENCRYPTION = Supported,
ROLE = PARTNER
);
GO


I have given the relevant user, the service account user of SQL SERVER, connect access to endpoints:



GRANT CONNECT ON ENDPOINT::Endpoint_Mirroring TO public;--public covers all logins
GRANT CONNECT ON ENDPOINT::Endpoint_Principal TO [Domain\User];


AUTHENTICATION is Kerberos not Certificate As the above code shows I did not use a certificate so I do not have to deal with any of the configuration parameters for certs. Also I have Active Directory authentication on the accounts for mirroring so I don't have to use a cert.


Note that I am using the same form of Authentication and Encryption for principal and mirror.


I used this code to verify that permission was granted to the relevant user ("grantee") for access to endpoints



SELECT 'Metadata Check';
SELECT EP.name, SP.STATE,
CONVERT(nvarchar(38), suser_name(SP.grantor_principal_id))
AS GRANTOR,
SP.TYPE AS PERMISSION,
CONVERT(nvarchar(46),suser_name(SP.grantee_principal_id))
AS GRANTEE
FROM sys.server_permissions SP , sys.endpoints EP
WHERE SP.major_id = EP.endpoint_id
ORDER BY Permission,grantor, grantee;
GO


Both Endpoints have status of started.



SELECT * FROM sys.database_mirroring_endpoints
--look for state_desc column to say 'STARTED', it did say that for Principal and Mirror


I have set



ALTER DATABASE MirrorDatabase SET PARTNER = 'TCP://Principal:50280';


Works fine.



ALTER DATABASE MirrorDatabase SET PARTNER = 'TCP://Mirror:50279';


This is the only place there is an error:



“The network address cannot be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational”


which is what the Mirroring wizard does too.


I ran SELECT SERVERPROPERTY('ProcessID') and gained the processID for each instance, principal and mirror. Then I ran netstat -ANO to associate each instance to the ports they are using.

50279 was associated only with process ID 4784, which is Mirror, which is correct.

50280 was associated only with processID 9860, which is Principal.


I ran the following



EXEC sp_control_dbmasterkey_password @db_name = N'MirrorDatabase',
@password = N'P@ssw0rd', @action = N'add';
GO


to give the master key to the mirror server instance a password for encryption.


If the principal and mirror do not use domain accounts you must set up a certificate. I have only domain accounts so I did not set up a certificate, but 'ENCRYPTION SUPPORTED'.


NetCat and TELNET access I have tested the endpoints on the principal and mirror and all tests came back successful. NetCat brought up a new session window for both sockets, and TELNET brought up a new session window for both sockets, the principal IP:Port and the Mirror IP:Port.





Aucun commentaire:

Enregistrer un commentaire