DATABASE MIRRORING Applies To: Microsoft SQL Server 2008 R2 Note: How to create database mirroring with synchronous mode and with no witness server. Must Prepare: Principal Server Mirrored Server

: IT107\SQLSVR_1 : IT107\SQLSVR_2

1

1. Create a database DB1 on the principal server, using the following transact SQL statement. Example: For Server Database Task

: : : :

PRINCIPAL SERVER IT107\SQLSVR_1 Master Create Database

----code:start USE [master] GO IF

EXISTS (SELECT name FROM sysdatabases WHERE name = N'Northwind_Sample') DROP DATABASE [Northwind_Sample]

GO USE [master] GO CREATE DATABASE [Northwind_Sample] ON PRIMARY ( NAME = N'Northwind_Sample' , FILENAME = N'C:\DB Principal\Northwind_Sample.mdf', SIZE = 1280KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'Northwind_Sample_1' , FILENAME = N'C:\DB Principal\Northwind_Sample_1.LDF' , SIZE = 504KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO ----code:end

2

2. Create a database DB1 on the mirrored server, using the following transact SQL statement Example: For Server Database Task

: : : :

MIRRORED SERVER IT107\SQLSVR_2 Master Create Database

-----code:start USE [master] GO IF

EXISTS (SELECT name FROM sysdatabases WHERE name = N'Northwind_Sample') DROP DATABASE [Northwind_Sample]

GO USE [master] GO CREATE DATABASE [Northwind_Sample] ON PRIMARY ( NAME = N'Northwind_Sample' , FILENAME = N'C:\DB Mirror\Northwind_Sample.mdf', SIZE = 1280KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'Northwind_Sample_1' , FILENAME = N'C:\DB Mirror\Northwind_Sample_1.LDF' , SIZE = 504KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO

-----code:end

3

3. Let’s backup the database and transaction on the principal server using the following transact SQL statement. Example: For Server Database Task

: : : :

PRINCIPAL SERVER IT107\SQLSVR_1 Master Backup Database Principal

-----code:start use [master] go Backup database [HRD] to disk ='C:\Backups Principal\HRD.Bak' with init go

-----code:end -----code:start use [master] go Backup database [Northwind_Sample] to disk ='C:\Backups Principal\Northwind_Sample.Bak' with init go -----code:end

4

4. Restore the database on the target server using the following transact SQL statement. Example: For Server Database Task

: : : :

MIRRORED SERVER IT107\SQLSVR_2 Master Restore Database Principal To Mirrored Server

-----code:start use [master] go restore database [Northwind_Sample] from disk ='C:\Backups Principal\Northwind_Sample.Bak' with norecovery, replace, move 'Northwind_Sample' to 'C:\DB Mirror\Northwind_Sample.mdf', move 'Northwind_Sample_1' to 'C:\DB Mirror\Northwind_Sample_1.ldf' go

-----code:end

5

5. Configure the database [Northwind_Sample] on the principal server for database mirroring. a. Using SQL Server management studio, expand the databases and click on the Database [Northwind_Sample].  (Principal Server)

b. Right click on the database [Northwind_Sample] and select properties.

* In the properties window select the "Mirroring" option as shown below.

Click “OK”.

6

6. a. Now click on the "Configure Security" button  and you will see the following screen. b. Since we are not going to setup the witness server, select the option "No" and click next.

Click “Next >”.

7

7. a. Select the default port and the endpoint name chosen by the SQL server management studio and click Next. b. If you are choosing some other port, then make sure that port is open and available. Click “Next >”.

.

8

8. a. Now select the mirrored server name, click on the "Connect" button and make sure you can connect to the mirrored server. b. Select the default port and the endpoint name chosen by the SQL server management studio and click Next. c. If you are choosing some other port, then make sure that port is open and available. Click “Next >”.

9

9. Type the appropriate service account you want to use for the database mirroring. Click “Next >”.

Click “Finish”.

10

10.

Click “Close”.

11

11. On the next screen, click on the button "Start Mirroring"

12. The following screen shows that database mirroring is configured and running

12

13. a. Click OK and refresh the databases. b. You can see the caption of the [Northwind_Sample] database has changed in both principal and mirrored server.

Source: http://www.databasejournal.com/features/mssql/article.php/3828341/Database-Mirroringin-SQL-Server-2008.htm

13

How To Create Database Mirroring.pdf

How To Create Database Mirroring.pdf. How To Create Database Mirroring.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying How To Create ...

476KB Sizes 1 Downloads 211 Views

Recommend Documents

How To Create A Standby Database Using RMAN
standby database feature, built in the Recovery. Manager (RMAN) tool. .... log_archive_dest_2 = 'SERVICE=prodSB lgwr log_archive_dest_2 = 'SERVICE=prodSB lgwr async noaffirm' ..... channel ORA_AUX_DISK_1: sid=12 devtype=DISK.

How to Create a Record.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. How to Create a ...

How To Create Self-Evolution.pdf
INTRODUCTION. Our time on Earth isn't getting longer, it's actually getting shorter. – meaning we should start living & spending our time here more purposefully.

How to Create A DBQ
unexpectedly meeting together after long separation, scarce able to speak the same language. The Indians too, as ... and long example in war, yet whenever they come to give way to the native dictates of humanity, they ... many conflicts such as the F

create cdb database in oracle12c.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. create cdb database in oracle12c.pdf. create cdb database in oracle12c.pdf. Open. Extract. Open with. Sign I

Content Rules: How to Create Killer Blogs, Podcasts ...
The New Rules of Marketing and PR: How to Use Social Media, Online Video, Mobile Applications, ... Contagious: How to Build Word of Mouth in the Digital Age.

[Read] Ebook The DevOps Handbook: How to Create ...
healthcare.gov debacle, cardholder data breaches, or missing the boat with Big. Data in the cloud.And yet, high performers using. DevOps principles, such as.