Share via


Overview of Database Mirroring Setup

This section describes the general steps for setting up database mirroring. For an introduction to database mirroring, see Overview of Database Mirroring.

Important

We recommend that you configure database mirroring during off-peak hours, because configuration can affect performance.

Setup Steps

To set up database mirroring, follow these general steps:

  1. Make sure that logins exist on the mirror server for all of the database users. For more information, see Setting Up Login Accounts for Database Mirroring.

  2. Before making a database available on another server instance, on the other server instance, you must set up the environment needed to use the database on the new server instance. For more information, see Managing Metadata When Making a Database Available on Another Server Instance.

  3. Create the mirror database by restoring with NORECOVERY a recent full database backup of the principal database. Make sure that the principal database was already using the full recovery model when the backup was taken. The mirror database must have the same name as the principal database, and they cannot be renamed during a database mirroring session.

    Important

    You must restore all of the log backups done since the full database backup. Before you can start mirroring on the partners, you should create a current log backup on the original database and restore it to the future mirror database.

    For more information, see How to: Prepare a Mirror Database for Mirroring (Transact-SQL). For information about creating and restoring log backups, see Working with Transaction Log Backups.

    Note

    Complete the remaining setup steps as soon as you can after taking the backup of the principal database.

  4. Set up security and start the database mirroring session.
    For more information, see one of the following:

    Note

    Database mirroring supports full-text catalogs. For more information, see Database Mirroring and Failover Clustering.

  5. Optionally, add a witness to the session.
    For more information, see one of the following:

    Note

    The database owner can turn off the witness for a database at any time. Turning off the witness is equivalent to having no witness, and automatic failover cannot occur.

For a comprehensive example of setting up database mirroring using Microsoft Windows Authentication, see Example: Setting Up Database Mirroring Using Windows Authentication (Transact-SQL).

For a comprehensive example of setting up database mirroring using certificate-based security, see Example: Setting Up Database Mirroring Using Certificates (Transact-SQL).

See Also

Concepts

Database Mirroring Sessions
Database Mirroring Transport Security
Database Mirroring and Backup and Restore
Managing Database Mirroring (SQL Server Management Studio)
Overview of Database Mirroring
Troubleshooting Database Mirroring Setup

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

14 April 2006

New content:
  • Added a recommendation about creating and restoring a log backup before starting mirroring.
Changed content: