There are some prerequisites and key points to understand:
1. The principal database must be in full recovery model.
2. The mirror database has to be created from a full backup
of the principal server and should be restored in "Restore with Norecovery"
model. It is followed by a restore of transaction log backup of the principal
database so that the log sequence numbers of the mirror and the principal
database are in synch with each other.
3. The mirror database must have the same name as the
principal database.
4. The mirror database cannot be accessed directly; however
snapshots of the mirror database can be taken for read only purposes.
5. The mirroring partnership can run in synchronous (high
availability mode) or asynchronous (high performance mode).
6. As mentioned earlier, failover can be automatic in
presence of a witness server or else manual.
7. In case of a failover (manual, automatic or forced),
client applications will be automatically redirected to the mirror server provided
you use AD.NET or SNAC (SQL Native Client). Look at an example connection
string:
Listing 1
"Data Source=PrincipalServerName;Failover Partner= MirrorServerName;
Initial Catalog=AdventureWorks; Integrated Security=True;"
8. DB Mirroring is available in Enterprise, Developer and
Standard Editions, however, please refer to Microsoft website for a comparison
chart as some features are not available in the Standard Edition. SQL Server
Workgroup and Express Editions can only be used as witness servers.