Close-up of Vikash's eyes behind his favourite dark-rimmed glasses About Roy

Learning Hyper-V Lesson 7

I am continuing this post from from Lesson 6.  Here we will discuss of setting up DB mirroring. So as per my understanding there are two way HA can be provided to DB 1) Clustering 2)Mirroring. In some situation both can be used as explained here and here .  Discussing SQL server HA is out of scope of this post.

Here we are using three server for mirroring 1) Principal running SQL enterprise edition 2) Mirror server running SQL 2008R2 enterprise edition and 3) Witness server running SQL 2008R2 standard edition. Witness can be any edition of server but Principal/Mirror need to be same edition. It is also recommended to use three different server for this purpose. Installation of SQL will be discussed in some other lesson. 

From Lesson 6 we have allowed SCVMM to create DB. Now we start with mirroring we need to backup the database. Before we backup the database make sure DB is in "Full Recovery " mode. By default SCVMM do not create DB in full recovery mode.

Learning Hyper-V Lesson 7 — screenshot 1

Now start the backup of SQL server database

Learning Hyper-V Lesson 7 — screenshot 2

And then perform choose backup type as full. Make sure you note down where the .BAK file is going to be placed. Because this need to copied to mirror server

Learning Hyper-V Lesson 7 — screenshot 3

Once the database backup is done , copy .bak file to the mirror server and then on Mirror server choose restore.

Learning Hyper-V Lesson 7 — screenshot 4 

Choose from device and provide the path to the copied .bak file. Make sure under "To Database" you should type exact name as that on "Principal"

Learning Hyper-V Lesson 7 — screenshot 5

Now very important select option and choose "Leave the database non-operational" . This will insure that DB does auto fail over. Also you can see it shows both the ldf and mdf file at respective location which is how we have setup SQL (Both Data and log on separate drive).

Learning Hyper-V Lesson 7 — screenshot 6

Once finish database status will appear with same name but status will be as "Restoring" . And FYKI this will not change because this is mirroring database is supposed to be setup (Sorry about my limited SQL knowledge).

Learning Hyper-V Lesson 7 — screenshot 7 

Now we have to start with mirroring on "Principal database"

Learning Hyper-V Lesson 7 — screenshot 8

And then choose configure security

Learning Hyper-V Lesson 7 — screenshot 9

This will run through Mirroring wizard

Learning Hyper-V Lesson 7 — screenshot 10

Here make sure witness server is selected to include this

Learning Hyper-V Lesson 7 — screenshot 11

By default Principal and Mirror will be selected.

Learning Hyper-V Lesson 7 — screenshot 12

Now Principal server will be selected and port by default will be 5022. IF all the three instance (Mirror/Principal/Witness) are on same server then we need to choose different port. End point name should not be changed because mirroring works using this endpoint.

Learning Hyper-V Lesson 7 — screenshot 13

Here it will ask for Mirror instance. Type the mirror SQL server name and then connect. Type port number and endpoint name should be same as principal.

Learning Hyper-V Lesson 7 — screenshot 14

Next screen will ask for Witness server type SQL server name connect it via SQL authentication. Maintain same port number and endpoint name

Learning Hyper-V Lesson 7 — screenshot 15

Type service account for all the 3 SQL instances

Learning Hyper-V Lesson 7 — screenshot 16

This provide nice summary

Learning Hyper-V Lesson 7 — screenshot 17

Here it will configure the end points

Learning Hyper-V Lesson 7 — screenshot 18

And then it will ask to start mirroring

Learning Hyper-V Lesson 7 — screenshot 19

If everything is OK then mirroring will be established for High Safety with Automatic Failover. Status on principal will show as "Principal,Synchronized" where as on Mirror it will show as "Mirror,Synchronized/Restoring"

 Learning Hyper-V Lesson 7 — screenshot 20      Learning Hyper-V Lesson 7 — screenshot 21

Next Blog I will discuss about SQL installation   

Comments