Database mirroring in SQL server |Mt Buzzer

Database mirroring in SQL server

Database mirroring is one type of relational database management system (RDMS) method to keep up critical information in spite of high accessibility needs by making excess copies of a dataset.

Database mirroring in SQL server, Database mirroring was presented with Microsoft SQL Server 2005 innovation that can be used to design high-accessibility and high-performance solutions for database repetition. It is designed to keep up a hot backup server with a transitionally predictable copy of the database. Mirroring is cost-effective, speedy, requires no extraordinary equipment, and guarantees value-based consistency. Here won't get into the specifics of the SQL Server 2008 improvements, however, will take an abnormal state voyage through SQL Server Mirroring ideas.
Database mirroring in SQL server keeps up two duplicates of a single database that must reside on various server occurrences of SQL Server Database Engine. Normally, these server cases dwell on PCs in various areas. Beginning database reflecting on a database starts a relationship, known as a database reflecting session, between these server occasions.

One server instance serves the database to customers (the main server). The other instance goes about as a hot or warm reserve server (the mirror server), depending upon the arrangement and condition of the reflecting session. At the point when a database reflecting session is synchronized, database mirroring in SQL server gives a hot backup server that backings fast failover without loss of information from conferred exchanges. At the point when the session is not synchronized, the mirror server is regularly accessible as a warm backup server.

Database mirroring in SQL server includes re-trying each embed, update, and delete activity that happens on the main database onto the mirror database as fast as could reasonably be expected. Re-trying is refined by sending a flood of dynamic exchange log records to the mirror server, which applies log records to the mirror database, in succession, as fast as could reasonably be expected. Not at all like replication, has which worked at the intellectual level, database mirroring works at the level of the physical log record. Starting in SQL Server 2008, the primary server stream of transaction log records before sending it to the mirror server. This log pressure happens in all reflecting sessions.

How is database mirroring in SQL server works?

In database mirroring, transaction log records are sent instantly from the main database to the mirror database. This stays up with the latest with the foremost database, with no loss of submitted information. On the off chance that the main server falls flat, the mirror server naturally turns into the new chief server and recoups the foremost database using a witness server under high-accessibility mode. A principal database is the dynamic live database that backings every one of the charges, Mirror is the hot backup and witness which takes into account a majority in the event of an automatic switch over.

Database Mirroring Terms and Definitions:

Automatic failover:

The procedure by which, when the essential server ends up inaccessible, the mirror server to assume control over the part of the key server and brings its copy of the database online as the main database.

Failover partners:

The two server instances (the key server or the mirror server) that go about as part exchanging accomplices for a mirrored database.

Forced service:

A failover started by the database proprietor upon the failure of the primary server that exchanges service to the mirror database while it is in an obscure state.

High-performance mode:

The database mirroring session works on concurrently and uses just the main server and mirror server. The main type of part exchanging is constrained service (with conceivable information loss).

High-safety mode:

The database mirroring session works synchronously and, alternatively, uses an observer, and additionally the important server and mirror server.

Manual failover:

A failover started by the database owner, while the vital server is as yet running, that exchanges benefit from the important database to the mirror database while they are in a synchronized state.

Mirror database:

The copy of the database that is ordinarily completely synchronized with the foremost database.

Mirror server:

In a database mirroring design, the server instance on which the mirror database resides.

Principal database:

In database mirroring, a read-compose database whose transaction log records are connected to a perused just copy of the database (a mirror database).

Principal server:

In database mirroring, the accomplice whose database is right now the central database.

Redo queue:

Received exchange log records that are looking out for the plate of a mirror server.


The essential server and mirror server perform reciprocal vital and mirror parts. Alternatively, the part of a witness is performed by a third server instance.

Role switching:

The assuming control of the essential part by the mirror.

Send queue:

Unsent transaction log records that have aggregated on the log disk of the main server.


The relationship that happens during database mirroring among the important server, reflect server, and witness server (if display).

After a mirroring session begins or continues, the procedure by which log records of the main database that have gathered on the primary server are sent to the mirror server, which composes these log records to circle as fast as conceivable to get up to speed with the important server.

Transaction safety:

A mirroring particular database property that decides if a database mirroring session works synchronously or no concurrently. There are two security levels in which one is FULL and the other one is OFF.


For use just with a high-security mode, a discretionary occurrence of SQL Server that empowers the mirror server to perceive when to start a programmed failover. Not at all like the two failover accomplices, the witness does not serve the database. Supporting programmed failover is the main part of the witness.

Benefits of Database Mirroring in SQL server:

Database mirroring in SQL server is a simple strategy that offers the following benefits:

Increases availability of a database:

In case of a disaster, in a high-security mode with automatic failover, failover quickly brings the backup of the database on the web (without information loss). In the other operating modes, the database head has the option of driving administration (with conceivable information misfortune) to the backup duplicate of the database.
Increases data protection:

Database mirroring in SQL server gives a complete or relatively total repetition of the information, contingent upon whether the working mode is high-security or high performance.

A database mirroring in SQL server accomplice running on SQL Server 2008 Enterprise or later forms naturally attempts to determine certain kinds of mistakes that avoid reading an information page.
The accomplice that can't read a page asks for a new duplicate from the other accomplice. In the event that this demand succeeds, the disjointed page is supplanted by the duplicate, which as a rule settle the blunder.
Improves the availability of the production database during upgrades:

To limit downtime for a mirrored database, you can consecutively redesign the occasions of SQL Server that are facilitating the failover accomplices. This will bring about the downtime of just a single failover. This type of redesign is known as a moving upgrade.

Operating modes of database mirroring in SQL server:

SQL Server database mirroring can be set to give high accessibility or disaster recuperation. Based upon the requirements, a DBA can pick among three accessible modes

High safety mode:

In this mode, information is written and conferred on the foremost and mirror databases synchronously. Simply subsequent to submitting on the two databases, the database application can proceed with movement might create delay and slower activity since exchanges must be submitted on both of the databases.

In this mode, if the main database goes down, two options are available:

1. Do nothing

Wait for the main to become accessible once more. During that time, the SQL Server occurrence is inaccessible. Database mirroring will proceed where it has ended.

2. Force the SQL Server instance on the mirror database

In this situation, the mirror database turns into the central. Conceivable information loss because of conferred exchanges on the first primary database which are not yet dedicated on the mirror presently going about as the key.

High safety with automatic failover mode:

In this situation, Information is written and should be conferred synchronously both on the central and mirror databases. Simply in the wake of submitting on the two databases, the application can keep running. It might create delay and slower task since exchanges must be conferred on both of the databases.

In this mode, if the principal database goes down, only one option is available:

1.High performance :

As the asynchronous communication, information is written and committed on the principal server, and later sent and committed to the mirror server. Automatic failover is not possible and the witness server cannot be used.

High availability mode:

In this mode, if the principal database goes down, three options are available:

1. Do nothing

Wait for the important to end up accessible once more. The SQL Server is inaccessible. Database mirroring will proceed where it has halted.

2. Force the SQL Server instance on the mirror database

In this situation, the mirror database turns into the main. A more prominent probability for information loss, because of asynchronous communication between databases.

3. Manual update

In order to minimize information loss, take the tail of the log backup if the failed server allows, remove mirroring and restore the tail of the log on the previously mirrored database
What do I need to know about database mirroring?

database mirroring in SQL server is an entire backup of the database that can be used if the essential database falls flat. Exchanges and changes to the essential database are exchanged straightforwardly to the mirror and prepared instantly so the mirror is dependably progressive and accessible as a "hot" backup.

Who uses database mirroring?

Database mirroring in SQL server is a type of information replication. While all transactional-based frameworks require some type of information replication keeping in minds the end goal to anticipate misfortune and keep up high accessibility, not all databases using reflecting. Among business RDBMS frameworks, Microsoft SQL Server is important for its use of database mirroring.

Database Mirroring Vs. Log Shipping?

Log shipping and database mirroring are two unique advances that give insurance to the individual databases. Both technologies depend on the reestablishment and recovery abilities of SQL Server databases; however, execute it in various ways. Log shipping depends on planning incessant reinforcements for the exchange log records and putting away the reinforcement documents in the database of an optional server. Both conferred and moved back exchanges are signed in the exchange log document on the essential server. This exchange information is then sent to the reinforcement log record on the secondary server.

Database mirroring is based on TCP endpoints. In database mirroring, only committed transaction data is sent from the principal to the mirror server; rolled-back transaction data is not sent to the mirror server. In log shipping, both committed and rolled-back transaction data are backed up. Database mirroring cannot transfer bulk-logged data, and you can use only one mirror server. Log shipping, on the other hand, can transfer bulk-logged data, and you can use multiple secondary servers.

Database mirroring in SQL server depends on TCP endpoints. In database mirroring, just dedicated exchange information is sent from the important to the mirror server; moved back exchange information isn't sent to the mirror server. In log delivery, both conferred and moved back exchange information is moved down. Database reflecting can't exchange mass logged information, and you can utilize just a single mirror server. Log shipping, then again, can exchange mass logged information, and you can use different auxiliary servers.

Unlike log shipping, database mirroring encourages failover. If there is a witness server, failover happens naturally; otherwise, failover should be performed manually. A failover takes under 3 seconds, and the database downtime during a failover is under 10 seconds. During a failover, the mirror server performs the role of the principal server. Failover preserves only committed transaction data.
Posted in: , ,

Liked us? Tell your friends on Facebook!


Post a Comment