Prerequisites
- The database must be using the FULL RECOVERY or BULK LOGGED recovery models.
- On the secondary server, we must have already restored a full database backup with the NORECOVERY or STANDBY options, so that transaction logs may be applied.
- FILESTREAM is not supported by database mirroring. As a FILESTREAM filegroup cannot be created on the principal server. So, we can say that database mirroring cannot be configured for a database that contains FILESTREAM filegroups.
- Database mirroring can support a maximum of about 10 databases per server instance, on a 32-bit system.
- Database mirroring is not supported with either cross-database transactions or distributed transactions.
- Endpoints must be correctly configured: Make sure that each server instance (the principal server, mirror server, and witness, if any) has a database mirroring endpoint.
- Check that the port numbers are correct. To identify the port currently associated with database mirroring endpoint of a server instance, use the following Transact-SQL statement.
Note: Inspect each server instance to determine whether it is listening on the correct ports.- SELECT type_desc, port FROM sys.tcp_endpoints;
- GO
- Make sure that the endpoints are started (STATE=STARTED). On each server instance, use the following Transact-SQL statement.
- SELECT state_desc FROM sys.database_mirroring_endpoints
- To start an endpoint, use the following Transact-SQL statement.
- ALTER ENDPOINT Endpoint_Mirroring
- STATE = STARTED
- AS TCP (LISTENER_PORT = <port_number>)
- FOR database_mirroring (ROLE = ALL);
- GO
- Check that the ROLE is correct. On each server instance use the following Transact-SQL statement.
- SELECT role FROM sys.database_mirroring_endpoints;
- GO
- Make sure that the login from the other server has CONNECT permission. To determine who has CONNECT permission for an endpoint, on each server instance use the following Transact-SQL statement.
- 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
- Endpoints must be correctly configured: Make sure that each server instance (the principal server, mirror server, and witness, if any) has a database mirroring endpoint.
- Check that the port numbers are correct. To identify the port currently associated with database mirroring endpoint of a server instance, use the following Transact-SQL statement.
Note: Inspect each server instance to determine whether it is listening on the correct ports.- SELECT type_desc, port FROM sys.tcp_endpoints;
- GO
- Make sure that the endpoints are started (STATE=STARTED). On each server instance, use the following Transact-SQL statement.
- SELECT state_desc FROM sys.database_mirroring_endpoints
- To start an endpoint, use the following Transact-SQL statement.
- ALTER ENDPOINT Endpoint_Mirroring
- STATE = STARTED
- AS TCP (LISTENER_PORT = <port_number>)
- FOR database_mirroring (ROLE = ALL);
- GO
- Check that the ROLE is correct. On each server instance use the following Transact-SQL statement.
- SELECT role FROM sys.database_mirroring_endpoints;
- GO
- Make sure that the login from the other server has CONNECT permission. To determine who has CONNECT permission for an endpoint, on each server instance use the following Transact-SQL statement.
- 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








Hadshana KamalanathanPosted Sep 3, 2018, 1:24 PM
Thank you for sharing...