You are on page 1of 119

7/23/2019 Print content

Administering Microsoft SQL Server 2012 Databases

Implement Database Mirroring and Replication

Introduction
Implement Database Mirroring
Implementing Replication
Summary

Introduction
The Implement Database Mirroring and Replication module provides you with
the instruction and server hardware to develop your hands on skills in the defined topics.
This module includes the following exercises:

Implement Database Mirroring


Implementing Replication

Lab Diagram

During your session you will have access to the following lab configuration. Depending
on the exercises you may or may not use all of the devices, but they are shown here in the
layout to get an overall understanding of the topology of the lab.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 1/119
7/23/2019 Print content

Connecting to your lab

In this module you will be working on the following equipment to carry out the steps
defined in each exercise.

PLABSQL01 (SQL Server 1)


PLABSQL02 (SQL Server 2)

To start, simply choose a device and click Power on. In some cases, the devices may
power on automatically.

For further information and technical support, please see our Help and Support
page.

Copyright Notice
This document and its content is copyright of Practice-IT - © Practice-IT 2014. All rights reserved. Any
redistribution or reproduction of part or all of the contents in any form is prohibited other than the
following:
1) You may print or download to a local hard disk extracts for your personal and non-commercial use
only.
2) You may copy the content to individual third parties for their personal use, but only if you
acknowledge the website as the source of the material. You may not, except with our express written
permission, distribute or commercially exploit the content. Nor may you transmit it or store it in any
other website or other form of electronic retrieval system.

Exercise 1 - Implement Database Mirroring


In this exercise, you will perform the tasks required to manage database mirroring in
Microsoft SQL Server 2012. To better understand this tasks, please refer to your course
material or visit http://msdn.microsoft.com/en-us/library/ms189852.aspx to gain an
understanding of this topic.

Task 1 - Database Mirroring

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 2/119
7/23/2019 Print content

In this task, you will mirror the AdventureWorks2012 database between PLABSQL01
and PLABSQL02.

Step 1
Ensure that you have powered on the required devices.

Connect to PLABSQL01 server. Launch SQL Server Management Studio from


desktop.

Step 2
In the Connect to Server dialogue box, click Connect to use the default credentials.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 3/119
7/23/2019 Print content

Step 3
Expand Databases node and right-click on AdventureWorks2012 database then
chose Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 4/119
7/23/2019 Print content

Step 4
On Database Properties - AdventureWorks2012 dialogue box, in Select a page
section, click on Options.

Go to Recovery Model drop-down list and change it to Full, then click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 5/119
7/23/2019 Print content

Step 5
Right-click again on AdventureWorks2012 and choose Tasks > Back Up…

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 6/119
7/23/2019 Print content

Step 6
On Back Up Database-AdventureWorks2012, while in General page, go to
Destination section.

Select the indicated folder path and click Remove.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 7/119
7/23/2019 Print content

Step 7
After removing the folder path, click Add…

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 8/119
7/23/2019 Print content

Step 8
In the Select Backup Destination, click in the File name box and type:

C:\backup\aw2012.bak

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 9/119
7/23/2019 Print content

Step 9
On Back Up Database-AdventureWorks2012 dialogue box, click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 10/119
7/23/2019 Print content

Step 10
Click OK when notified that the backup was successfully completed.

Minimize SQL Server Management Studio.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 11/119
7/23/2019 Print content

Step 11
Switch to PLABSQL02 device. Launch Windows Explorer from taskbar.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 12/119
7/23/2019 Print content

Step 12
Click in the address bar and type:

\\plabsql01\c$

Press Enter.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 13/119
7/23/2019 Print content

Step 13
The connection to \\plabsql01\c$ is displayed.

Right-click on Backup folder and choose Copy.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 14/119
7/23/2019 Print content

Step 14
Expand Computer and then expand Local Disk C.

Paste the Backup folder here.

Note: If you prompted that you are overwriting a folder, click Yes.

Close Windows Explorer after successfully copying the folder.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 15/119
7/23/2019 Print content

Step 15
Launch SQL Server Management Studio from desktop.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 16/119
7/23/2019 Print content

Step 16
From Connect to Server dialogue box, click Connect.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 17/119
7/23/2019 Print content

Step 17
Expand Databases folder.

Then right-click on Databases folder and choose Restore Database…

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 18/119
7/23/2019 Print content

Step 18
On Restore Database dialogue box, under Source section, click on Device radio
button then click on […]

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 19/119
7/23/2019 Print content

Step 19
The Select backup devices dialogue box appears.

Click Add button.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 20/119
7/23/2019 Print content

Step 20
The Locate Backup File-PLABSQL02 is displayed.

Scroll up the folder tree and click on Backup folder.

In the File name box, select aw2012.bak

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 21/119
7/23/2019 Print content

Step 21
Back in the Select backup devices, the backup media is now added click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 22/119
7/23/2019 Print content

Step 22
You are redirected back to Restore Database-AdventureWorks2012 dialogue box.

On Select a page, click on Options.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 23/119
7/23/2019 Print content

Step 23
In the Options page, enable Overwrite the existing database (WITH REPLACE)
check box.

In Recovery state drop-down list, change it to RESTORE WITH NORECOVERY

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 24/119
7/23/2019 Print content

Step 24
The database restore runs momentarily.

Click OK when notified that the Database ‘AdventureWorks2012’ restored


successfully is displayed.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 25/119
7/23/2019 Print content

Step 25
Minimize Microsoft SQL Server Management Studio window.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 26/119
7/23/2019 Print content

Task 2 - Change the SQL Server service accounts

The SQL Server service account is used to initialize the SQL server instance on a
computer. To change the SQL Server service account, follow these steps:

Step 1
Switch to PLABSQL01.

Click Start go to All Programs and then Microsoft SQL Server 2012 go to
Configuration Tools folder and finally click on SQL Server Configuration
Manager.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 27/119
7/23/2019 Print content

Step 2
SQL Server Configuration Manager opens.

Click on SQL Server Services node. Then in the right details pane, right-click SQL
Server (MSSQLSERVER) and choose Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 28/119
7/23/2019 Print content

Step 3
On SQL Server (MSSQLSERVER) Properties dialogue box, click in Account
Name box and type:

practicelabs\administrator

In the Password and Confirm password boxes, type:

Passw0rd

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 29/119
7/23/2019 Print content

Step 4
Click Yes when prompted that this will cause the service to be restarted.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 30/119
7/23/2019 Print content

Step 5
There will be a momentary pause while the change is being applied.

You will be redirected back to Sql Server Configuration Manager. Notice that SQL
Server (MSSQLSERVER) Log On As details has changed.

Close the Sql Server Configuration Manager.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 31/119
7/23/2019 Print content

Step 6
Using the same steps done earlier, you will change the SQL Service Account in
PLABSQL02.

Switch to PLABSQL02 device.

Click Start go to All Programs and then Microsoft SQL Server 2012 go to
Configuration Tools folder and finally click on SQL Server Configuration
Manager.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 32/119
7/23/2019 Print content

Step 7
SQL Server Configuration Manager opens.

Click on SQL Server Services node. Then in the right details pane, right-click SQL
Server (MSSQLSERVER) and choose Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 33/119
7/23/2019 Print content

Step 8
On SQL Server (MSSQLSERVER) Properties dialogue box, click in Account
Name box and type:

practicelabs\administrator

In the Password and Confirm password boxes, type:

Passw0rd

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 34/119
7/23/2019 Print content

Step 9
Click Yes when prompted that this will cause the service to be restarted.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 35/119
7/23/2019 Print content

Step 10
There will be a momentary pause while the change is being applied.

You will be redirected back to Sql Server Configuration Manager. Notice that SQL
Server (MSSQLSERVER) Log On As details has changed.

Close the Sql Server Configuration Manager.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 36/119
7/23/2019 Print content

Task 3 - Configure Database Mirroring

Next we need to configure the database AdventureWorks2012 on the principal server,


which is PLABSQL01, for database mirroring.

Step 1
Connect to PLABSQL01 and reopen SQL Server Management Studio.

Expand Databases and right-click AdventureWorks2012 and select Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 37/119
7/23/2019 Print content

Step 2
The Database Properties - AdventureWorks2012 dialog box is displayed.

In Select a page section, click Mirroring.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 38/119
7/23/2019 Print content

Step 3
On Mirroring page, and click Configure Security in the right pane.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 39/119
7/23/2019 Print content

Step 4
The Configure Database Mirroring Security Wizard database appears.

On the Configure Database Mirroring Security Wizard screen, click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 40/119
7/23/2019 Print content

Step 5
On the Include Witness Server screen, select No and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 41/119
7/23/2019 Print content

Step 6
From the Principal Server Instance page, use the default Listener port and the
Endpoint name chosen by SQL Server Management Studio.

Clear the check box to Encrypt data sent through this endpoint as shown in the
screenshot, then click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 42/119
7/23/2019 Print content

Step 7
In the Mirror Server Instance page, click the drop down box and click <browse for
more>…

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 43/119
7/23/2019 Print content

Step 8
In the SSMS Connect to Server prompt type the hostname of PLABSQL02.

Click Connect.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 44/119
7/23/2019 Print content

Step 9
You’re redirected back to Mirror Server Instance, clear Encrypt data sent
through this endpoint check box.

Click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 45/119
7/23/2019 Print content

Step 10
In the Service Accounts window, type the appropriate service account you want to use
for database mirroring.

For this setup as we are in a lab environment type in the Principal and Mirror check
boxes:

practicelabs\administrator

Click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 46/119
7/23/2019 Print content

Step 11
Double check the summary details and click Finish.

This will configure database mirroring.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 47/119
7/23/2019 Print content

Step 12
Please wait while database mirroring is being created.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 48/119
7/23/2019 Print content

Step 13
The Status - Success should be displayed in the Configuration Endpoints dialogue
box.

Click Close.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 49/119
7/23/2019 Print content

Step 14
On Database Properties dialogue box, click Start Mirroring button.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 50/119
7/23/2019 Print content

Step 15
There will be a momentary pause while mirroring is in progress.

If everything has been successful you will get the following screen saying
Synchronized: the databases are fully synchronized.

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 51/119
7/23/2019 Print content

Step 16
From Microsoft SQL Server Management Studio, notice that
AdventureWorks2012 (Principal, Synchronized) is now displayed.

You can see the caption of the database has changed in both the principal and the
mirrored server.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 52/119
7/23/2019 Print content

Step 17
Switch to PLABSQL02 and reopen Microsoft SQL Server Management Studio.

You can see the caption of the database has changed in both the principal and the
mirrored server.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 53/119
7/23/2019 Print content

Step 18
Go to Practice Labs web application.

Click on PLABSQL01 and click on Power off this device.

Do the same with PLABSQL02 device.

This will restore the default configuration of the devices.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 54/119
7/23/2019 Print content

Step 19
Power back on PLABSQL01 and then PLABSQL02.

Then proceed to Exercise 2.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 55/119
7/23/2019 Print content

Exercise 2 - Implementing Replication


In this exercise you will perform the tasks required to implement replication of a
database. Please refer to your course material or visit http://msdn.microsoft.com/en-
us/library/ms151198.aspx to gain an understanding Database Mirroring, Replication and
Log Shipping.

Task 1 - Change the SQL Server service accounts and configure


SQL Server agent to Automatic start

The SQL Server service account is used to initialize the SQL server instance on a
computer. To change the SQL Server service account, follow these steps:

Step 1
Connect to PLABSQL01.
https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 56/119
7/23/2019 Print content

Click Start go to All Programs and then Microsoft SQL Server 2012 go to
Configuration Tools folder and finally click on SQL Server Configuration
Manager.

Step 2
SQL Server Configuration Manager opens.

Click on SQL Server Services node. Then in the right details pane, right-click SQL
Server (MSSQLSERVER) and choose Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 57/119
7/23/2019 Print content

Step 3
On SQL Server (MSSQLSERVER) Properties dialogue box, click in Account
Name box and type:

practicelabs\administrator

In the Password and Confirm password boxes, type:

Passw0rd

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 58/119
7/23/2019 Print content

Step 4
Click Yes when prompted that this will cause the service to be restarted.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 59/119
7/23/2019 Print content

Step 5
There will be a momentary pause while the change is being applied.

You will be redirected back to Sql Server Configuration Manager. Notice that SQL
Server (MSSQLSERVER) Log On As details has changed.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 60/119
7/23/2019 Print content

Step 6
Now right-click on SQL Server Agent (MSSQLSERVER) and choose Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 61/119
7/23/2019 Print content

Step 7
On SQL Server Agent (MSSQLSERVER) Properties, click Start.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 62/119
7/23/2019 Print content

Step 8
Please wait while the service is being restarted.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 63/119
7/23/2019 Print content

Step 9
Back in the SQL Server Agent (MSSQLSERVER) Properties, click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 64/119
7/23/2019 Print content

Step 10
Close Sql Server Configuration Manager window.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 65/119
7/23/2019 Print content

Step 11
Using the same steps done earlier, you will change the SQL Service Account in
PLABSQL02.

Switch to PLABSQL02 device.

Click Start go to All Programs and then Microsoft SQL Server 2012 go to
Configuration Tools folder and finally click on SQL Server Configuration
Manager.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 66/119
7/23/2019 Print content

Step 12
SQL Server Configuration Manager opens.

Click on SQL Server Services node. Then in the right details pane, right-click SQL
Server (MSSQLSERVER) and choose Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 67/119
7/23/2019 Print content

Step 13
On SQL Server (MSSQLSERVER) Properties dialogue box, click in Account
Name box and type:

practicelabs\administrator

In the Password and Confirm password boxes, type:

Passw0rd

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 68/119
7/23/2019 Print content

Step 14
Click Yes when prompted that this will cause the service to be restarted.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 69/119
7/23/2019 Print content

Step 15
There will be a momentary pause while the change is being applied.

You will be redirected back to Sql Server Configuration Manager. Notice that SQL
Server (MSSQLSERVER) Log On As details has changed.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 70/119
7/23/2019 Print content

Step 16
Right-click on SQL Server Agent (MSSQLSERVER) and choose Start.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 71/119
7/23/2019 Print content

Step 17
Please wait while the service is being started.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 72/119
7/23/2019 Print content

Step 18
Find SQL Server Agent (MSSQLSERVER) now Running.

Close Sql Server Configuration Manager window.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 73/119
7/23/2019 Print content

Task 2 - Configuring Replication

In this next example we are going to configure the replication of our


AdventureWorksDW2012 database. We are going to use transactional replication with a
push subscription on PLABSQL02.

Before carrying out this exercise, set the start of the SQL Server Agent to automatic
within Services.

Step 1
From PLABSQL02 server, click Start and go to Administrative Tools then select
Services.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 74/119
7/23/2019 Print content

Step 2
In Services console, scroll down the list.

Then right-click on SQL Server Agent (MSSQLSERVER) and choose Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 75/119
7/23/2019 Print content

Step 3
In SQL Server Agent (MSSQLSERVER) Properties (Local Computer), change
the Startup type to Automatic.

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 76/119
7/23/2019 Print content

Step 4
Close Services console.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 77/119
7/23/2019 Print content

Step 5
Switch to PLABSQL01 device.

Launch Services. Then right-click on SQL Server Agent (MSSQLSERVER) and


choose Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 78/119
7/23/2019 Print content

Step 6
On SQL Server Agent (MSSQLSERVER) Properties, change Startup type to
Automatic.

Click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 79/119
7/23/2019 Print content

Step 7
On PLABSQL01, open SQL Server Management Studio and click Connect.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 80/119
7/23/2019 Print content

Step 8
In Object Explorer, expand the Replication folder.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 81/119
7/23/2019 Print content

Step 9
Right-click Local Publications and then click New Publication.

The publication wizard will now start.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 82/119
7/23/2019 Print content

Step 10
On the New Publication Wizard page, click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 83/119
7/23/2019 Print content

Step 11
On the Distributor page, use the default selection which makes PLABSQL01 a
distributor and a publisher, then click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 84/119
7/23/2019 Print content

Step 12
On the Snapshot Folder page accept the default location and click Next.

Note that the default location is not able to support pull subscriptions because it is
not a network share.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 85/119
7/23/2019 Print content

Step 13
On the Publication Database page, click AdventureWorksDW2012 and then click
Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 86/119
7/23/2019 Print content

Step 14
On the Publication Type page, click Transactional publication and then click
Next.

A transactional publication is where the publisher streams transactions to the


subscribers after they receive an initial snapshot of the published data, as stated in
the text.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 87/119
7/23/2019 Print content

Step 15
On the Articles page, expand Tables, select DimAccount(dbo) and then click Next.

We’ll just publish this single article for our example.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 88/119
7/23/2019 Print content

Step 16
On the Filter Table Rows page click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 89/119
7/23/2019 Print content

Step 17
On the Snapshot Agent page, accept the default and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 90/119
7/23/2019 Print content

Step 18
On the Agent Security page, click the Security Settings button on the right hand
side.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 91/119
7/23/2019 Print content

Step 19
On the Snapshot Agent Security page, in the Process account box, type:

practicelabs\administrator

In the Password and Confirm Password boxes, type:

Passw0rd

Then click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 92/119
7/23/2019 Print content

Step 20
Back in the Agent Security page, click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 93/119
7/23/2019 Print content

Step 21
On the Wizard Actions page leave the default Create the publication option
selected and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 94/119
7/23/2019 Print content

Step 22
On the Complete the Wizard page enter a Publication name of
AdventureWorksDW2012, and then click Finish.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 95/119
7/23/2019 Print content

Step 23
Please wait while the publication is being created.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 96/119
7/23/2019 Print content

Step 24
When the publication is successfully created, click Close.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 97/119
7/23/2019 Print content

Step 25
You have now successfully configured replication using transactional streaming on
PLABSQL01.

Minimize SQL Server Management Studio.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 98/119
7/23/2019 Print content

Task 3 - Configuring the Subscription

Next you will need to configure the subscription on PLABSQL02.

Step 1
Connect to PLABSQL02 and open SQL Server Management Studio. Click
Connect when prompted.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 99/119
7/23/2019 Print content

Step 2
In Object Explorer pane, expand Replication and click on Local Subscriptions.

Right click Local Subscriptions and choose New Subscriptions…

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 100/119
7/23/2019 Print content

Step 3
At the new subscription wizard click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 101/119
7/23/2019 Print content

Step 4
Then at the Publication page, use the drop down box to select <Find SQL Server
Publisher>…

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 102/119
7/23/2019 Print content

Step 5
In the Connect to Server window, enter in the name of PLABSQL01 and press the
Connect button.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 103/119
7/23/2019 Print content

Step 6
You will see the publication for AdventureWorksDW2012 that you previously
configured.

Select AdventureWorksDW2012 and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 104/119
7/23/2019 Print content

Step 7
At the agent location page, change the selection to Run all agents at the Distributor,
PLABSQL01 (Push subscriptions) because our replication directory is not on a share
we cannot use pull.

Click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 105/119
7/23/2019 Print content

Step 8
At the Subscribers page leave the default selection and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 106/119
7/23/2019 Print content

Step 9
On Distribution Agent Security page, click […] button.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 107/119
7/23/2019 Print content

Step 10
At the Distribution Agent Security dialogue box, in the Process account field, type:

practicelabs\administrator

In the Password and Confirm password text boxes, type:

Passw0rd

Clic

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 108/119
7/23/2019 Print content

Step 11
You will return to the Distribution Agent Security page where you need to click
Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 109/119
7/23/2019 Print content

Step 12
At the Synchronization Schedule leave the default of run continuously and click
Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 110/119
7/23/2019 Print content

Step 13
At the Initialize Subscriptions page accept the defaults and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 111/119
7/23/2019 Print content

Step 14
Again at the Wizard Actions, leave the default to create the subscription and click
Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 112/119
7/23/2019 Print content

Step 15
Finally at Complete the Wizard page, click Finish.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 113/119
7/23/2019 Print content

Step 16
Please wait while the subscription is being created.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 114/119
7/23/2019 Print content

Step 17
Click Close when Creating Subscriptions page indicates Success status.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 115/119
7/23/2019 Print content

Step 18
Minimize SQL Server Management Studio.

Step 19
Switch to PLABSQL01 and go back to SQL Server Management Studio.

Expand Replication then expand Local Publications >


[AdventureWorksDW2012]: AdventureWorksDW2012

Right-click on [PLABSQL01. [AdventureWorksDW2012] and select View


Synchronization Status…

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 116/119
7/23/2019 Print content

Step 20
You will see that there is a message saying that the initial snapshot is not available yet.

Click Close.

Step 21
To remedy this, right click the [AdventureWorksDW2012]:
AdventureWorksDW2012 publication and select View Snapshot Agent Status

Step 22
Then click Start.

Step 23
You will receive this message about pre-loading meta-data of all tables.

Please wait while this process is on-going.

Step 24
When the message “A snapshot of article(s) is generated… click Close.

Step 25

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 117/119
7/23/2019 Print content

Right-click again on the [PLABSQL02]: AdventureWorksDW2012 publication and


select View Synchronization Status

Step 26
You will get a message about No replicated transactions are available, since no
changes have been made on the database.

Click Close.

Step 27
Switch to PLABSQL02 device.

Go back to SQL Server Management Studio. Expand Replication then expand


Local Subscriptions.

You should see the [AdventureWorksDW2012]-[PLABSQL01].


[AdventureWorksDW2012]: AdventureWorksDW2012 subscription.

Shutdown all virtual machines used in this lab, by using the power functions located in
the Tools bar before proceeding to the next module.

Alternatively you can log out of the lab platform.

Summary
In this module, you covered carried the following practical tasks:

Implemented database mirroring


Implemented database replication
https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 118/119
7/23/2019 Print content

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 119/119

You might also like