Thursday, 17 April 2014

Enabling Log Shipping in SQL Server 2008 R2

Introduction

SQL Server Log Shipping allow to transfer data from one database to a lot of databases. So in Log Shipping we have 3 servers
  1. Primary
  2. Secondary
  3. Monitor (Optional)
*The secondary database can be more than one database.

Log Shipping involves copying a database backup and subsequent transaction log backups from the primary server and restoring the database and transaction log backups on one or more secondary servers

Steps

Create a folder in primary server (LogShipping_Primary) and also in secondary server (LogShipping_Secondary).This two folders must be sharing.

Take full and transaction log backup from the database in the primary Server

Restore this database on secondary server with stand by option.logShippingDB after Restore

On primary server right click >> properties >> Transaction Log Shipping >> Enable Log Shipping
Enable Log Shipping

Configure the backup setting for the transactional log backups
PrimaryServer backup path

  • Network backup path folder: the folder name LogShipping_Primary in primary server put the network path for this folder \\Servername\Foldername
  • Local path: the local path for the folder in primary server like C:\users\DBA\Desktop\LogShipping_Primary
Configure Scheduled job to backup database

4

Add Secondary Server

Add Secondry Server

Connect to select your secondary server

6

Select Secondry Server


Initialize Secondary Database
  • If you want to take full backup and restore it to the secondary server.
  • If you want to restore the existing backup from primary server to secondary server.
  • if you have manually restored the database on secondary server.
Copy Files
In this table you will put the path if the folder in the secondary server \\Servername\\Foldername

Copy Files

Configure the schedule to take the backup files copy from the primary server  to secondary server

10- Configure the Sehedule to take the backup

Restore transactional log : we will select Standby option and Disconnect all user in restore option

Restore transaction log

Configure the schedule to restore the backup taken from the primary server

12
Click OK

Optional (Check on monitor sever instance to monitor the backup status and the job status for the jobs in primary server and secondary server)

Configure the Sehedule to restore the backup

14

Last step in Log Shipping Configuration

Finish

After you finish from the Log Shipping go to the Primary Server to Check the new jobs

16

Return to the secondary server to check the new jobs

17

Note: Check the functionality of Log Shipping by executing all the SQL Jobs which have been scheduled during log shipping. All the jobs should execute successfully.

Installing Microsoft SQL Server 2008 R2 Cluster Step-By-Step

This is a step by step guide on SQL Server 2008 R2 Cluster.
Let's begin with the pre-requisites

Pre-requisites:

In order to plan everything ahead, we need to prepare some IP's and names as well as Network Configuration. During the deployment you will be using IP's and Names for the following
  1. Windows Cluster
  2. DTC
  3. SQL
You can plan for those and document them for use ahead of time, just to save yourself some time.
Please refer to the table below


DescriptionHostnameIP AddressSubnet MaskDefault Gateway
Cluster IP AddressXXCLUSTER172.21.XX.XX255.255.255.128N/A
SQL Instance IP AddressXX2010SQL172.21.XX.XX255.255.255.128N/A
MSDTC Virtual IPXX2010SQLDtc172.21.XX.XX255.255.255.128N/A
SQL Cluster Node 1Node1172.21.XX.XX255.255.255.0172.21.X.1
SQL Cluster Node 2Node 2172.21.XX.XX255.255.255.0172.21.X..1
We then need to setup 2 Network Interfaces to be used in production and other as a heartbeat.

clip_image002

We need to configure the HeartBeat interface on each node as follows

Node 1
clip_image004clip_image006


clip_image008clip_image010

Node 2

clip_image011clip_image013

clip_image014clip_image015

We do a little test and make sure they can communicate

clip_image016

Now the heart beat has been configured, you need to assign IP's to the production interfaces, those are the interfaces that will communicate with the servers.

Now that the networking part is out of the way, let's go ahead and start the Failover Cluster Role installation.

Windows Failover Cluster Installation

The following steps need to be performed on both database tier machines.
  1. Click on Server Manager > Features > Add Features clip_image018clip_image020
  2. Check the Failover Clustering checkbox and click Next
  3. Click on Install to install the feature clip_image021
  4. Click Close to conclude the installation wizard clip_image022

Host Validation Tests:

Now we need to run the validation tests to make sure our nodes are correctly configured

clip_image024

  1. Click on Validate Configuration clip_image026
  2. Click Next at the validation wizard's intro screen clip_image028
  3. Click Browse in the Select Servers or a cluster window clip_image030
  4. Set the Object Types to Computers and search for the two cluster nodes clip_image032
  5. Once the two cluster nodes have been selected click on Next to proceed clip_image034
  6. Leave radio button at its default position (Run all tests) and then click Next clip_image036
  7. The validation wizard summary will be displayed. Review it and click Next to initiate the cluster validation clip_image037
  8. If the validation wizard returns any errors review and resolve them before proceeding. Errors need to be resolved before creating the cluster. Ensure that you review warnings.

Creating Windows 2008 Cluster:

SQL Server 2008 R2 clustering requires a windows cluster to be setup prior to creating the SQL node. To create the windows cluster perform the following steps.
    1. In the Failover Cluster Console click on Create a cluster clip_image039
    2. Click Next on the welcome screen clip_image041
    3. Click Browse and select the appropriate cluster nodes clip_image043
    4. Click Next to run pre-configuration validation (essentially the same validation as before, but recommended to run again right before the cluster setup). clip_image044
    5. Enter the following information in the Access point for Administering the Cluster window
      • Cluster Name: SPSLUSTER
      • IP Address: 172.21.x.x
      • clip_image045
    6. Review the summary in the confirmation window and click Next to proceed with the cluster installation clip_image046
    7. If any warnings/errors were generated review them and retry if necessary. If none were generated click on Finish to close the wizard.

Verifying Cluster Storage and Quorum

Now in  windows server 2008 R2, the cluster Quorum and storage will be configured automatically, we need check on that clip_image048
And this seems right, now we need to check on the Quorum type to make sure that it is set to Node and Disk Majority.clip_image050''

Configuring Windows 2008(R2) Application Server

We now need to start deploying the application server role on both the nodes

clip_image052

clip_image054

clip_image056

clip_image058

clip_image060

clip_image062

clip_image064

clip_image066

clip_image068

clip_image070

Configuring MSDTC

clip_image072

clip_image074

clip_image076

clip_image078

clip_image080

clip_image081

clip_image083

clip_image084

clip_image086

clip_image087

Installing SQL Server 2008 R2 Cluster

Now we are about to start the installation of the First Node in the cluster.clip_image089
Enter your product key
clip_image091
Install the support files
clip_image093
Install Features
clip_image095
Configure the Network Name (this is going to be the cluster name) and the instances
clip_image096

clip_image098

Choose your Cluster Resource Group (I left it at default)

clip_image099

clip_image101

clip_image103

clip_image105

Configure the Service account Users and Passwords (Best practice is to use individual accounts)

clip_image107

clip_image109

Configure your locations (Best practice to separate Database File from Log Files)

clip_image111

The Install, But do not configure is the only option available as we haven't installed the pre-requisites for Reporting Services.

clip_image113

Make sure everything passes on the cluster installation Rules

clip_image115

Review your installation summary and click install

clip_image116

Now wait for installation to finish.

clip_image118

Now after the installation finishes, make sure your resources are up.

clip_image120

Now all that is good and green we need to start the installation on the second node.
So fire up the setup  and choose
clip_image121

Install Support rules and make sure all passes

clip_image123

Enter the Product Key

clip_image124

clip_image126

You will see that the setup has detected the current single node cluster from above, click next

clip_image128

Enter the same accounts and password and make sure everything is green

clip_image129

Review your installation

clip_image131

Click on install and wait the install to finish

clip_image133

Verify the Cluster

Now if you go to the SQL Server Clustered application properties you see both nodes added

clip_image135

I hope this document will help you in "Installing Microsoft SQL Server 2008 R2 Cluster".




SQL Server Query Execution Plans for beginners – Clustered Index Operators

In this article we will continue discussing the various execution plan operators related to clustered indexes and what they do, when do the...