Database Mirroring Doubt

Chaitanya Kiran 696 Reputation points
2023-02-06T06:00:59.36+00:00

I read that in Database Mirroring, every transaction on primary database is replicated to mirror database. I have a doubt here. The mirror database is not accessible, so how the mirror database gets updated?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,691 questions
{count} votes

Accepted answer
  1. Erland Sommarskog 100.9K Reputation points MVP
    2023-02-06T22:31:52.2333333+00:00

    The secondary gets updated by applying log records. Think of it as a constant restore of transaction-log backups. As you may recall, when you do restore with NORECOVERY, the database is not accessible, but you can apply more transaction-log backups to it.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Seeya Xi-MSFT 16,436 Reputation points
    2023-02-06T10:05:22.8133333+00:00

    Hi @chaitanya kiran ,

    Please refer to this MS document:

    https://learn.microsoft.com/en-us/sql/database-engine/database-mirroring/database-mirroring-operating-modes?view=sql-server-ver16

    You can find the answer in this link. Take the high-performance mode as an example.

    In high-performance mode, as soon as the principal server sends the log for a transaction to the mirror server, the principal server sends a confirmation to the client, without waiting for an acknowledgement from the mirror server. Transactions commit without waiting for the mirror server to write the log to disk. Asynchronous operation permits the principal server to run with minimum transaction latency.

    Since it is too long, I won't paste it here again, and please read that document.

    BTW, I remind you this feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use Always On availability groups instead.

    See: Database Mirroring (SQL Server)

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments