Sunday, 28 February 2016

DB Mirroring

What is the default of end points (port numbers) of principal, mirror and witness servers?

The default port numbers of principal, mirror and Witness servers are 5022, 5023 and 5024

What are the Database Mirroring states?

1) SYNCHRONIZING:­ The contents of the mirror database are lagging behind the contents of the principal database. The principal server is sending log records to the mirror server, which is applying the changes to the mirror database to roll it forward. At the start of a database mirroring session, the database is in the SYNCHRONIZING state. The principal server is serving the database, and the mirror is trying to catch up. 
2) SYNCHRONIZED:­ When the mirror server becomes sufficiently caught up to the principal server, the mirroring state changes to SYNCHRONIZED. The database remains in this state as long as the principal server continues to send changes to the mirror server and the mirror server continues to apply changes to the mirror database. If transaction safety is set to FULL, automatic failover and manual failover are both supported in the SYNCHRONIZED state, there is no data loss after a failover. If transaction safety is off, some data loss is always possible, even in the SYNCHRONIZED state.
3) SUSPENDED:­ The mirror copy of the database is not available. The principal database is running without sending any logs to the mirror server, a condition known as running exposed. This is the state after a failover. A session can also become SUSPENDED as a result of redo errors or if the administrator pauses the session SUSPENDED is a persistent state that survives partner shutdowns and startups. 
4) PENDING_FAILOVER:­ This state is found only on the principal server after a failover has begun, but the server has not transitioned into the mirror role. When the failover is initiated, the principal database goes into the PENDING_FAILOVER state, quickly terminates any user connections, and takes over the mirror role soon thereafter.
5) DISCONNECTED:­ The partner has lost communication with the other partner.

What are the Restrictions for Database Mirroring? 

a) Maximum 10 databases per instance can support on a 32­bit system. 

b) Database mirroring is not supported with either cross­database transactions or distributed transactions

What is End Point?

An endpoint is a network protocol which is used to communicate Principal, Mirror and Witness servers over the network. 

Creation of an end point:­ 

Create endpoint State=started/stopped/disabled as tcp (listener port=5022/5023) for database_mirroring (role=partner/witness)

How to set Automatic failover timeout?

The default timeout for communication between the principal, mirror, and witness servers is 10 seconds.

Adjusting the automatic failover time for SQL Server Database Mirroring

ALTER DATABASE dbName SET PARTNER TIMEOUT 20

How to do manual failover?

To perform a manual failover
ALTER DATABASE AdventureWorks SET PARTNER FAILOVER;
You can specify FAILOVER only on the principal server. This option is valid only when the SAFETY setting is FULL (the default).
FORCE_SERVICE_ALLOW_DATA_LOSS -- is available only on the mirror server and only when The principal server is down and WITNESS is set to OFF.

Pausing or Removing Database Mirroring?

To remove the database mirroring session
ALTER DATABASE AdventureWorks SET PARTNER OFF;
Removes a database mirroring session and removes mirroring from the database. You can specify OFF on either partner. 

To resume the database mirroring session
ALTER DATABASE AdventureWorks SET PARTNER RESUME;
You can specify RESUME only on the principal server

To pause the database mirroring session
ALTER DATABASE AdventureWorks SET PARTNER SUSPEND;
You can specify SUSPEND on either partner.

Enhancements in 2008

·         Automatic page repair(823,824,829 page errors).
·         compression of mirroring data stream.
·         Log send buffers - efficient use
·         Write-ahead event enhanced in 2008
·         Page read-ahead during the undo phase

Can we configure mirroring on different domain ?
Yes. both domain's should be trust each other.


No comments:

Post a Comment