This immediately launches the Configure Database Mirroring Security Wizard for the database you have selected AdventureWorks, in this example.. FIGURE 20.10 The Principal Server Instance
Trang 1FIGURE 20.9 Including the witness server instance in the mirroring configuration
You need to click the Configure Security button on the Mirroring page This immediately
launches the Configure Database Mirroring Security Wizard for the database you have
selected (AdventureWorks, in this example) Figure 20.8 shows this initial wizard splash page
You must configure all three server instances (principal, mirror, and witness servers) for
the high-availability mode The first option that must be indicated is whether you plan to
include a witness server instance in your mirroring configuration You are configuring a
high-availability database mirroring configuration (synchronous mode with automatic
failover), so you should select Yes on the wizard dialog shown in Figure 20.9; you do so
because you want to create a full high-availability mode for automated failover
FIGURE 20.8 The Configure Database Mirroring Security Wizard for the AdventureWorks
database
Trang 2FIGURE 20.10 The Principal Server Instance screen of the Configure Database Mirroring
Security Wizard
endpoint name EndPoint4DBMirroring1430, in this example)
Next comes the specification of the listener and endpoint entry for the mirror server
instance (where the mirror copy of the database will be located) Initially, this page lists all
server instances available on your network (that is, possible mirror server instances) and
does not have a listener port or endpoint name specified yet You need to identify which
server you want to use as the mirror server instance (REM12374333\SQL08DE02, in this
example) and click the Connect button to establish a valid (authorized) connection to the
mirror server instance Because you already set up the endpoint on this server (and
granted connection permission, using a specific login ID), when you complete the
connec-tion dialog, the endpoint (EndPoint4DBMirroring1440, in this example) and
listener_port value (1440, in this example) should be enabled, as shown in Figure 20.11
Finally, you need to specify the witness server instance Again, this dialog page lists all
server instances available on the network (that is, possible witness server instances) and
does not have a listener port or an endpoint name specified yet You need to identify
which server you want to use as the witness server instance (REM12374333\SQL08DE03, in
this example) and click the Connect button to establish a valid (authorized) connection to
the witness server instance Because you already set up the endpoint on this server (and
Trang 3FIGURE 20.12 The Witness Server Instance screen of the Configure Database Mirroring
Security Wizard
FIGURE 20.11 The Mirror Server Instance screen of the Configure Database Mirroring
Security Wizard
granted connection permission, using a specific login ID), when you complete the
connec-tion dialog, the endpoint (EndPoint4DBMirroring1450, in our example) and
listener_port value (1450, in this example) should be enabled, as shown in Figure 20.12
The last step in the Configure Database Mirroring Security Wizard is to identify any service
accounts that you want to use for the server instances in this database mirroring
Trang 4FIGURE 20.13 Summary of actions to be performed for the database mirroring configuration
A report is generated, telling the total number of actions taken (three, in this case) and the
status of each action If any errors or warnings result, you can drill down into the Report
button option in the bottom-right corner of this summary of actions page to determine
what has occurred If each status shows success, a Database Properties dialog, as shown in
Figure 20.14, appears when you close this report page This dialog gives you the option to
start mirroring immediately or not start mirroring (because you will start mirroring at
some other time) For this example, you want to start mirroring right away, so click the
Start Mirroring button
Trang 5FIGURE 20.15 Fully configured properties and active mirroring for database mirroring
Figure 20.15 shows the full Database Properties screen for the AdventureWorks database, all
server network addresses, and the operating mode for mirroring
If you look at the SQL Server log file (that is, the current log), you can see log entries
indi-cating that database mirroring is active:
2/21/2009 22:33:33,spid21s,Unknown,Database mirroring is
active with database ‘AdventureWorks’ as the
principal copy This is an informational message
only No user action is required
2/21/2009 22:33:09,spid17s,Unknown,Starting up database ‘AdventureWorks’
FIGURE 20.14 Specifying to start database mirroring for high safety with automatic failover
Trang 6FIGURE 20.16 Launching Database Mirroring Monitor from SSMS
Monitoring a Mirrored Database Environment
After active mirroring has started, you can monitor the complete mirrored topology in a
few ways You can start by registering the database being mirrored to a new facility within
SSMS called Database Mirroring Monitor Database Mirroring Monitor allows you to
monitor roles of the mirroring partnership (that is, principal, mirror, and witness), see the
history of transactions flowing to the mirror server, see the status and speed of this
trans-action flow, and set thresholds to alert you if failures or other issues occur In addition, you
can administer the logins/service accounts being used in the mirrored database topology
Figure 20.16 shows how you launch the Database Mirroring Monitor from SSMS: you
right-click the principal database being mirrored, choose Tasks, and then choose Launch
Database Mirroring Monitor
Trang 7FIGURE 20.17 Registering the mirrored database within the Database Mirroring Monitor
FIGURE 20.18 The registered database and status of each mirroring partner
You must register the database being mirrored To do so, you select the principal or mirror
server instance and set the Register check box for the database Database Mirroring
Monitor registers the database and both partner server instances, as shown in Figure 20.17
After the database is registered, all partners and the witness server instances show up in
the Database Mirroring Monitor, as shown in Figure 20.18
At a glance, you can see which server is playing what role (principal or mirror) and
whether each partner has defined and is connecting to a witness server In addition, you
can see the unsent log (in size), the un-restored log (in size), when the oldest unsent
trans-action occurred, the amount of time it took to send the transtrans-action to the mirror server
instance, the send rate (KB/second), the current rate at which the transactions get restored
Trang 8FIGURE 20.19 Transaction history of mirroring partners
If you click the Warnings tab of the Database Mirroring Monitor, you can set various
thresholds within the monitor to alert you when they have been reached (see Figure
20.20) Basically, you want to set thresholds that monitor the effectiveness of the
mirror-ing operation
If these key thresholds are ever exceeded, you want to be notified that something is very
wrong and that failover may be in jeopardy When a threshold is exceeded, an event is
logged to the Application event log You can configure an alert on this event by using
SSMS or Microsoft Management Operations Manager (MOM) The threshold levels depend
on your own failover tolerance Our advice is to monitor the transaction and transfer rates
for a peak period and then set the thresholds to be 100% higher than that For example, if
you see a peak mirror commit overhead value of 750 milliseconds, you should set the
threshold to 1,500 milliseconds This should be within the tolerance for commit overhead
in your organization
Figure 20.21 shows how easy it is to administer the service accounts/login IDs being used
for database mirroring You simply click an Edit button to change or set the login account
you want to use for database mirroring at each instance in the mirroring topology
Trang 9FIGURE 20.21 Setting service accounts/login IDs within the mirroring topology
FIGURE 20.20 Setting thresholds to monitor mirroring effectiveness
From the Database Properties Mirroring page, you can easily pause (and resume) database
mirroring if you suspect that there are issues related to the mirroring operation In
addi-tion, you can easily see what role each server instance is playing
Trang 10FIGURE 20.22 Removing database mirroring
Looking at the options on Figure 20.22, you simply choose to remove mirroring (from the
principal server instance) This is just a bit too easy to do—almost dangerous!
The mirroring process is immediately disabled When mirroring is disabled, you can drop
the database on the mirror server instance, remove the endpoints on each server instance
(that is, principal, mirror, and witness instances), and be done—all through SSMS This
approach is straightforward
If you’re removing mirroring with SQL scripts, however, you need to break the mirroring
from the principal, remove the principal’s endpoint, drop the mirror database and remove
the mirror’s endpoint, and then drop the witness server’s endpoint At this point, all
mirroring is removed Follow along as we remove the database mirroring configuration we
just set up