Monday, July 25, 2011

Configure Database Mirroring to use a specific network card

The following article demonstrates how you can reconfigure your existing database mirroring to use a specific network card. Both the principal instance and mirroring instance servers have 2 network cards.
  • The principal instance is currently using 10.10.10.16
  • The mirror instance is currently using 10.10.10.15
  • Both are communicating over their local port of 5022


As shown on the principal instance, by default, the ip_address used for the mirroring endpoint is not specified so it will use any network card.


The steps to set the principal to only use the ip address 10.100.10.16 and the mirroring instance to use only 10.100.10.15 are listed below. Please note only 1 database is mirrored in the demo.
1.   Remove database mirroring for the database.

2.    Alter the Mirroring endpoint on the principal instance to use local network card 10.100.10.16. I'd suggest that it would be better to assign a DNS entry for the ip address and use that instead of hard coding an ip address.
 
3.   Verify that the ip_address of the Mirroring endpoint is now showing the ip address specified.
4.   On the mirror instance, alter the Mirroring endpoint to use local network card 10.100.10.15.

5.   Verify that the ip_address of the Mirroring endpoint is now showing the ip address specified.

6.   On the mirror instance set the partner to be the principal instance database.
7.   Finally, on the principal instance set the partner to be the mirror instance database.
You should now see mirroring using the specified network card.


I found that I had to remove database mirroring to get this to work, as the ALTER DATABASE command did not allow me to specify a new partner address while database mirroring was in use. The error given is shown below: