Share via

DBCC CHECKDB Mirroring

Chaitanya Kiran 841 Reputation points
2022-02-18T13:12:22.217+00:00

We have mirroring configured. If I run DBCC CHECKDB command on principal database, will it get replicated to mirror database?

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

Answer accepted by question author

Robbie Varn 351 Reputation points
2022-02-18T15:57:06.07+00:00

No, it does not get replicated and this is because it (the database/s) are on a separate instance on a totally different storage system. You have to run it on the Secondary on the databases there. If the database is mirrored, you won't be able to connect to it to run it because it will be inaccessible. So, some people take snapshots and restore it, and then run it on the restored snapshot. Then, there are opinions that you only need to run dbcc checkdb on the Primary databases and that suffices. We have checkdb set up to run on the Primary and Secondary servers. That way, if the database(s) are failed over to the Secondary, you are sure to get dbcc checkdb run against the active database. I hope this helps.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Ronen Ariely 15,221 Reputation points
    2022-02-18T16:02:40.047+00:00

    Hi,

    We have mirroring configured. If I run DBCC CHECKDB command on principal database, will it get replicated to mirror database?

    No

    The command is run per database

    Mirroring is implemented on a per-database basis and based on transaction log. The mirroring is accomplished by sending a stream of active transaction log records to the mirror server. DBCC CHECKDB does not change the data and does not write transaction which should be mirror

    https://learn.microsoft.com/en-us/sql/database-engine/database-mirroring/database-mirroring-sql-server

    Was this answer helpful?

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.