How to Setup Mirroring in SQL
-
Upload
christopher-romero -
Category
Documents
-
view
203 -
download
5
Transcript of How to Setup Mirroring in SQL
How to Setup Mirroring in SQL Server ?(Screen Shots)
What is Mirroring in SQL Server ?
Database mirroring is an alternative high-
availability solution to failover clustering in SQL
Server. Database mirroring supports automatic
failover, but does not require cluster-capable
hardware, and can therefore provide a cost-
effective alternative to failover clustering. In
this Article, we will implement Mirroring
with witness Server and will Automatic
Failover too.
What is the Hardware and software
requirement for implementing Mirroring in
SQL Server ?
There is no any such hardware and software requirement for implementing. Even SQL Server Standard
Edition supports Mirroring. For More Details about feature supported by various editions, please check my
previous post, "Does SQL Server Standard Edition Supports Mirroring?" To test the Automatic
failover, you need three SQL Server Instances.
In case there is a firewall in between Principal, Mirror and Witness Server, please ensure there endpoint
ports are Opened in firewall.
How to implement Database Mirroring in SQL Server 2008 R2?
Implementing SQL Server Mirroring is quite simple in SQL Server 2008 R2. For better understanding, Lets
take an real business requirement and deploy mirroring with WITNESS Server (Automatic Failover)
I have already posted an Video Post, where a step by step implementation of mirroring is available, but you
need to have silver light installed in your system to watch this video and a good bandwidth.
In this Article, I am going to implement a Mirroring using three SQL Server Instances, where
Principal Server 1.
Mirror Server 2.
Witness Server 3.
Principal Server Details
SQL Server Instance Name : <SERVER_NAME>\SQL1 •
Version : SQL Server 2008 R2 •
Posted by DBATAG on December 20, 2010 Leave a comment (7)Go to comments
MYOB Warehousing AddOn www.datapel.com
Best Practice Warehouse Management AddOn for
your MYOB.
MEX Maintenance Software www.mex.com.au/free-trial
Australia's #1 Maintenance Solution Save costs &
increase uptime.
F2 Dealership Software www.comsolf2.com
Australia's leading parts inventory Dealership
Software.
NuoDB - NewSQL Leader www.nuodb.com
Elastic SQL database for the cloud Download the
Beta today
SQL Server Training & Consulting DBATAG, a tag to every DBA!!!
Home Offerings Featured Articles Certification Clients Contact US SEARCH
Q & A
Search: type, hit enter
Page 1 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Edition : Evaluation Copy •
Database Name : Test_SQLServer_Mirroring •
Mirror Server Details
SQL Server Instance Name : <SERVER_NAME>\SQL2 •
Version : SQL Server 2008 R2 •
Edition : Evaluation Copy •
Database Name : Test_SQLServer_Mirroring •
Witness Server Details
SQL Server Instance Name : <SERVER_NAME>\SQL3 •
Version : SQL Server 2008 R2 •
Edition : Evaluation Copy •
*Note : In this example, all these instances are named instances hosted on a single operative case. In
case you are implementing in your production environment, All these three roles should be on different
machines.
We are going to perform following Steps to setup Mirroring and automatic Failover Testing
Backup Primary Database (Principal Server) 1.
Using latest backup files, Restore database on Mirror Server with NORECOVERY Option 2.
Set up Mirroring using Wizard where we will define 3.
Identify of Principle Server, Mirror Server and Witness Server 1.
Create End Points for Principle Server, Mirror Server and Witness Server 2.
Configure Security 3.
Start Mirroring 4.
Test Manual Failover 5.
Test Automatic Failover 6.
STEP 1 - Backup Primary Database (Principle Server)
On Principal Server Perform a full backup and copy this backup file to mirror server for restore. Backup is
quite simple, which can be taken using the following Script on Principal Server (.\SQL1)
-- This will Backup Database named Test_SQLServer_Mirroring to C:\temp\Mirroring\TEST.b
BACKUP DATABASE [Test_SQLServer_Mirroring] TO DISK = N'C:\temp\Mirroring\TEST.bak'
GO
STEP 2 - Restore Database on Secondary Database (Mirror Server)
On Mirror Server, Restore the database with same name with NORECOVERY option on Server .\SQL2
Restore is quite simple, which can be taken using the following Script or by SSMS
-- Restore Database name Test_SQLServer_Mirroring] on Mirror Server (.\SQL2) with NOREC
RESTORE DATABASE [Test_SQLServer_Mirroring] FROM DISK = N'C:\temp\Mirroring\TEST.bak'
GO
Page 2 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
STEP 3 - Set up Mirroring using Wizard where we will Identify of Principle Server, Mirror Server and
Witness Server, Create End Points for Principle Server, Mirror Server and Witness Server and will also
configure Security
Open SSMS and connect to Principal Server >>> Database, which you wanted to enabled for mirroring
>>> right click >>> and Select Properties
which will open up a Database Properties Box like this and Click on Mirroring
Page 3 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Once you are on Mirroring Properties page, select "Configure Security…" button, which will open a
Configure Database Mirroring Security Wizard
Page 4 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Next screen, will ask you, do you want to include Witness Server or not ? Witness Server is useful to initiate
Automatic failover. As per our requirement, we will be opting to include Witness Server, so we will Select
YES
Page 5 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Next screen will ask you, where you wanted to save the configuration, In case we opted for Automatic
Failover / Witness Server, configuration must be saved at Witness Server. In case, we do not want to
include Witness Server and would like to to do Manual failover, then we can have option for saving
Configuration either on Principal Server or on Mirror Server.
As per our requirement (Automatic Failover), we will opt for Witness Server Instance.
Page 6 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Next Screen where we need to specify information about the SQL
instance where the database was originally located. In out example this
is .\SQL1
NuoDB - NewSQL Leader
Elastic SQL database for the
cloud Download the Beta todaywww.nuodb.com
SQL Server Consulting -
Making Business Intelligent -
Database Solutions from SQL
Expertspragmaticworks.com/services/
Page 7 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Here we have option to specify the TCP / IP port on which endpoint will be listening to requests. In case
there is a firewall in between Principal and Mirror Server, please ensure there these ports are Open.
In our example, all these three instances are hosted on a single physical box that the reason we will opt for
different port for Mirror and Witness Server End point.
Adding to this we have an option to encrypt data, which travel between principal, mirror and witness
server. In case we opt for this, we assume that you are already have certificates, otherwise, this will work
without Certificates too.
So In Select Principal Option, we specified .\SQL1 as Server name and used Windows Authentication to
connect to principal server, which has sysadmin privileges. We also checked the Encrypt Data option and
5022 is the Port number which we used for Principal endpoint.
Next Screen where we need to specify information about the SQL instance where the mirror copy of the database will be located, in our example this is ./SQL2
MYOB Warehousing AddOnBest Practice Warehouse Management AddOn for your MYOB.
www.datapel.com
Page 8 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
So In Select Mirror Option, we specified .\SQL2 as Server name and used Windows Authentication to
connect to principal server, which has sysadmin privileges. We also checked the Encrypt Data option and
5023 is the Port number which we used for Mirror endpoint.
Next Screen where we need to specify information about the SQL instance that monitors the status of the principal and mirror server instances
Page 9 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & Con...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
So In Select Witness Server Option, we specified .\SQL3 as Server name and used Windows
Authentication to connect to principal server, which has sysadmin privileges. We also checked the Encrypt
Data option and 5024 is the Port number which we used for Mirror endpoint.
Next Screen will actually create these endpoint in the respective Server
Page 10 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & C...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
This is Work in progress status, Once this is being configured and running, you will get a confirmation
status as shown below.
Page 11 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & C...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
STEP 4 - Start Mirroring
Once this is Done, you are ready to start the mirroring, the wizard, will itself ask you to do that, as shown
in the following screen shot
Once, you click on YES, this will implement the mirroring and will take some time to revert back to old
screen, Please wait, as this wait is depends on changes which has been performed on Principal Server after
full backup. This could take 30 minutes too.
Once this check all configuration and synchronized data, you will get the YES button enabled as shown
below.
Page 12 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & C...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Once, this is Done, you mirroring setup is completed. We can verify that by checking database status
connecting to Principal and Mirror Instance via SSMS. We will get a status like below
Database Status at Principal Server
Database status would be Principal and Synchronized, is (Role,Status) as shown below in the screen
shot.
Page 13 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & C...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Database Status at Mirror Server
Database status would be Mirror, Synchronized and restoring, is (Role,Status) as shown below in the
screen shot.
Page 14 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & C...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
This is quite lengthy post, so Post Check Implementation and Failover Testing (Step 5 and Step 6) I will be
posting in next article.
If you liked this post then,
Subscribe to this Blog via Email:
Submit Query
Click here to Subscribe to FREE email updates from "DBATAG ", so that you do not miss out anything
on SQL Server !!!
Tags : What is Mirroring in SQL Server,Hardware and software requirement for implementing SQL Server Mirroring ,Hardware and software
requirement for implementing Mirroring in SQL Server ,How to implement Database Mirroring in SQL Server 2008 R2, How to implement
Database Mirroring in SQL Server 2008 R2,Setup Mirroring in SQL Server screenshot,Setup Mirroring in SQL Server screenshots, sql
server database mirroring wizard
Related Posts:
How to perform SQL Server Mirroring Manual Failover? What is SQL Server Mirroring Failover ?
When the principal server is offline, ...
•
SQL Server Mirroring Automatic Failover What is Automatic Failover in SQL Server Mirroring?
When the principal ...
•
How to Set up Database Mirroring in SQL Server 2008 (Video) Database mirroring is an
alternative high-availability solution to failover clustering in SQL ...
•
Page 15 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & C...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Can we have Mirroring between Standard and Enterprise editions ? YES, we can have Mirroring
between Standard and Enterprise editions. But when ...
•
Does Mirroring works with FileStream databases ? NO, FILESTREAM doesn't work with mirroring
and database Snapshots. FileStream ...
•
Database mirroring must be removed before you drop SQL Server database Error Message
TITLE: Microsoft SQL Server Management Studio ...
•
What are the Features of HADRON in SQL Server DENALI (2011) ? I implemented HADR last
week, I was testing on my virtual machines ...
•
How to Monitor Database Mirroring, SQL Server? SQL Server Mirroring can be monitored SQL
Server ...
•
How to subscribe for SQL Server Cloud Services (SQL Server AZURE) FREELY ? YES, we can
create our own SQL Server and database on the ...
•
Database Mirroring Enhancements in SQL Server 2008 from 2005 Database mirroring is an
alternative high-availability solution to failover clustering in SQL ...
•
SQL Server High Availability Questions Question: How replication set up impacts to application
performance ? Answer: ...
•
What all Database Permissions are being assigned to a particular login ? During the Audit, this is
common question, which is being asked by ...
•
SQL Script to change a mirror endpoint SQL Error Database Mirroring login attempt failed with
error: 'Connection ...
•
What all you need to consider for SQL Server Hardware Migration? I was being contacted by one
of my existing customer to move ...
•
Database Mirroring in SQL Server 2008 R2 – Part 5b Database Mirroring in SQL Server 2008 R2 -
Part 5b In this video, ...
•
← Database mirroring must be removed before you drop
SQL Server database
SQL Server 2008 R2 Cumulative Update 5 is released →
2008 - New Features, All Blog Posts, Database, DBA, High Availibility, SQL 2005, SQL 2008, SQL 2008 R2, SQL
Azure, SQL Denali, Tutorials database status Mirror Synchronized and restoring, database status Principal and
Synchronized, Hardware and software requirement for implementing Mirroring in SQL Server, Hardware and
software requirement for implementing SQL Server Mirroring, How to implement Database Mirroring in SQL Server
2008 R2, Setup Mirroring in SQL Server screenshot, Setup Mirroring in SQL Server screenshots, sql server database
mirroring wizard, What is Mirroring in SQL Server , Author
7 Comments.Leave a comment
rohit May 4, 2011 at 7:57 pm
but how make instacne in same sql server?
Reply
DBATAG May 4, 2011 at 11:44 pm
Just run the sQL server setup again and during setup choose named instance option
Reply
rohit May 4, 2011 at 7:56 pm
sir but how to make instance ? in same sql server? is it possible that one server is 2008 and
other r2 can mirroring can be possible
Reply
Page 16 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & C...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-
Leave a Reply
Your email address will not be published.
Name
Website
CAPTCHA Code *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del
datetime=""> <em> <i> <q cite=""> <strike> <strong>
Post Comment
Notify me of followup comments via e-mail. You can also subscribe without commenting.
Trackbacks and Pingbacks:
SQL Mirroring « Simply Technological - Pingback on 2011/01/26/ 15:10 ◦
SQl Failover - dBforums - Pingback on 2011/07/04/ 14:33 ◦
SERVER_NAME>\SQL1
SERVER_NAME>\SQL2 SERVER_NAME>\SQL3
DBATAG May 4, 2011 at 11:44 pm
YEs, you can have multiple instances in single windows machine. for this you need to run the
SQL Server setup every time and during the installtion, select named Instances and proceed…
Reply
Chickie March 15, 2011 at 1:44 am
What does this mean?
There is no any such hardware and software requirement for implementing
Reply
Copyright © 2011 DBATAG, SQL Server Training & Consulting, if you found any copyrighted content, let us know, will remove ASAP| Powered by WordPress
Page 17 of 17How to Setup Mirroring in SQL Server ?(Screen Shots) | SQL Server Training & C...
27/10/2011http://www.sqlserver-training.com/how-to-setup-mirroring-in-sql-server-screen-shots/-