Skip to main content

Database Mirroring

Overview of Mirroring:

Mirroring is mainly implemented for increasing the database availability. Similar to log shipping mirroring is also implemented on per database basis. Database mirroring maintains two copies of a single database that must reside on different instances of SQL Server Database Engine (server instances). Typically, these server instances reside on computers in different locations. One server instance serves the database to clients (the principal server), while the other server instance acts as a hot or warm standby server (the mirror server).
Mirroring provides a hybrid solution i.e
1. Provides a copy of the database like Log Shipping and
2. Rapid failover capabilities like Clustering

Advantages of Mirroring :

* Increases data protection ---> Depending on the mode of operation Mirroring provides minimal data loss.

* Increases availability of a database ---> In the event of a disaster, in high-safety mode with automatic failover, failover quickly brings the standby copy of the database online (with no data loss). In the other operating modes, the database administrator has the alternative of forcing service (with possible data loss) to the standby copy of the database.

* Improves the availability of the production database during upgrades ---> During service packs installation or any patch applied on Principal server which requires downtime, the standby comes into effect.

Components in Mirroring:

Database mirroring consist of the following components

1. Principal ---> The Principal is the originating server i.e it is the source server which contains the database which is configured for mirroring.There can be only one principal database and it has to be in a separate SQL Server instance than the mirror database.

2. Mirror ---> The Mirror is the receiving database in a mirror pair i.e it is the destination server which contains the mirrored database.There can be only one mirror for each principal database.The mirror needs to be on its own separate SQL Server instance preferably on separate physical server.

3. Mirrored Pair ---> A Principal and Mirror operating together are called a Mirrored Pair.The changes on the principal are reflected in the mirrored database

4. Witness ---> A Witness is optional and it monitors the Mirrored Pair. It ensures that both principal and mirror are functioning properly. The Witness is also a separate SQL Server instance preferably on a separate physical server than principal and mirror. One Witness server can monitor multiple Mirrored Pairs.

5. Quorum ---> A Quorum is the relationship between the Witness, Principal and the Mirror.

6. Endpoint ---> Endpoint is the method by which SQL Server Database engine communicates with applications. In the context of Database mirroring endpoint is the method by which the Principal communicates with the Mirror. The mirror listens on a port defined in the endpoint. The default is 5022. Each database mirror pair listens on its own unique port.


To list all the database mirror endpoints --> Run,
---> Select * from sys.database_mirroring_endpoints

To list all the endpoints --> Run,
---> Select * from sys.tcp_endpoints

Comments

Popular posts from this blog

Self Introduction and Responsibilities of a SQL Server DBA.

Hi, Self Introduction:                      I am Vang chew bigger , currently I am working with   Citronics , Here my role is SQL Server Database Administrator , I am having 3+ yrs Exp in SQL SERVER DBA with T-SQL, I have experience on SQL Server 2000, 2005 and 2008, I have a great experience on installation and configuration of SQL SERVER versions, and also applying the patches, hot fix, services packs and RTM’s accordingly, involved in upgrading on in place and side by side as per client requirement, and also Migrating the database on SQL SERVER 2000 to 2005 and 2008, Solid experience on configuring and maintenance of High availability SQL Server solutions, including Log shipping, Database Mirroring, Replication(Transactional and Merge) and SQL Server Clustering., having experience on performance tuning on server level, database level and query level, Responsible for working with application developers in identifying,...

Shrinking a SQL Server Log File with Database in Always ON Availability.

Shrinking a SQL Server Log File with Database in Always ON Availability.                    Once we had a situation in our production server that the database which is in Always ON Availability group has been grown to the maximum size.  Many of them say that we can't shrink the log file as the database is in Always ON and we should take the downtime to perform the operation. But we shrink-ed the database log file to 5 GB from 180 GB. Steps are as below: --To Check the Number of pages allocated by the LogFile. DBCC LOGINFO --To check the file sixe sp_helpdb [SQLPantry] --To check the Log file Size DBCC SQLPERF(LOGSPACE) The above statement will show the logspace of all db at present situation. --To check the Log_reuse_wait description of a log file. select log_reuse_wait_desc,* from sys.databases The above statement will show the status of the log whether it has to be backuped i.e., LogBackup, Nothing, Ac...

SQL Server 2022 Features in Detail.

SQL Server 2022 Features in Detail. 1. Data Virtualization: Data virtualization in SQL Server 2022 enables you to access and query data from various sources as if they were part of a single database. This eliminates the need for complex data integration processes and allows for seamless querying of distributed data. 2. Machine Learning Services Enhancements: SQL Server 2022 offers enhanced integration with machine learning frameworks like TensorFlow and PyTorch. This enables you to train and deploy machine learning models directly within the database, bringing AI-driven insights closer to the data. 3. Improved Security: The Data Discovery and Classification capabilities in SQL Server 2022 help identify sensitive data and apply appropriate security measures. Always Encrypted technology ensures that sensitive data remains encrypted in various scenarios. 4. Big Data Clusters: Big data clusters allow you to manage and query large datasets across SQL Server, Hadoop, and Spark clusters. This...