Search This Blog & Web

Friday, August 30, 2013

SQL SERVER 2012 HIGH AVAILABILITY SOLUTION (SQL Server 2012 Enterprise Installation)

In my previous post; We have learnt how to install Windows Server 2008 R2 Failover Cluster. Reivew from this link
to Setup SQL Cluster we need to install SQL Server 2012.
SQL Server 2012 Installation
You can install standalone SQL server 2012 on both nodes that are ready for cluster setup or you can install it using single cluster node wizard. Microsoft .Net framework 3.5 or above needs to be installed on VMs. I will perform standalone here, cluster node installation require share disk to be install and I am doing this on share folder, that’s why I am unable to install SQL server using single cluster node installation.

Needs to add feature from windows features  


Start SQL Server installation this is Enterprise setup


SQL Server 2012 install updates if required. Internet connection is required


If there is any error or warning message i.e firewall is enabled, allow proper ports or disable firewall


Select appropriate features that are required to install for always on feature. Features are
  • SQL Server setup
  • Network Name,
  • IP Address,
  • Shared disk or nodes,
  • Database Engine,
  • Agent Service,
  • Analysis Services if installed,
  • One file share resource, if FILESTREAM feature is installed.

Along with database engine, analysis services service will be installed 


Changed database engine service account from [NT Service] user to the domain user i.e SQL . Otherwise it will generate error while you are configuring always group through wizard.


Mix user mode selected


SQL Server 2012 successfully installed. Please install it on both nodes to complete SQL Server Always On availability Group.

In Next Step 


SQL SERVER 2012 HIGH AVAILABILITY SOLUTION (Windows Server Failover Cluster Setup)

SQL SERVER 2012 HIGH AVAILABILITY SOLUTION
A SQL Server Always On Availability Group is a new concept in 2012 SQL server. To understand high availability solution we need to understand following three concepts

1.      Windows Server Failover Clustering (WSFC)
2.      Failover Cluster Instance (FCI)
3.      Always On Availability Group
4.      Always On Availability Group Instance

Let’s understand above concepts in following paragraph

As part of the SQL Server AlwaysOn offering, AlwaysOn Failover Cluster Instances leverages Windows Server Failover Clustering (WSFC) functionality to provide local high availability through redundancy at the server-instance level—a failover cluster instance (FCI). An FCI is a single instance of SQL Server that is installed across Windows Server Failover Clustering (WSFC) nodes and, possibly, across multiple subnets. On the network, an FCI appears to be an instance of SQL Server running on a single computer, but the FCI provides failover from one WSFC node to another if the current node becomes unavailable. Always On availability group enables you to specify a set of databases that you want to fail over together as a single entity. When an availability group fails over to a target instance or target server, all the databases in the group fail over also. Because SQL Server 2012 can host multiple availability groups on a single server, you can configure Always On to fail over to SQL Server instances on different servers. This reduces the need to have idle high performance standby servers to handle the full load of the primary server, which is one of the many benefits of using availability groups.

To setup high availability solution we need to setup windows server failover cluster. To setup this I have used Windows 2008 R2 Enterprise/Data Center with Service pack 1.

Windows Server Failover Cluster Setup
To install Cluster using windows server following are Pre-requisites
·         Windows 2008 R2 with Service pack 1
·         Shared Storage (SAN) is recommended for secure SQL Server availability solution but you can use Share drive or Folder to setup cluster in Windows.
·         For Lab purpose I have used VMWare to setup 3 instances of Windows server 2008 R2 SP1
·         My network consists of One domain Server and other two are Client machines
·         Disable the firewall for testing purpose if not then perform following two steps
·         Port 1433 must enabled (Inbound/Outbound) as it is default port for SQL Server across network
·         Port 5022 must enabled (Inbound/Outbound) as it is default port for SQL Server Always On availability group end point throughout the network
·         Domain user must have read all properties / create computer objects
·         Same user is used to run database engine service this will require to allow database synchronization between two databases.
·         1 Share drive or Share folder on a third drive (it is required for quorum settings)
Let’s consider my user name is Domain\SQL and windows servers are as follows SQL01, SQL02 along with domain server as DC01
Add Windows cluster feature from server manager on both nodes. (SQL01, SQL02)

This will restart your systems to show windows Fail over cluster manager in control panel. After restart go to the Server Manger and verify that Fail over clustering feature is enabled on both nodes.



Go to Windows Startà Administrative Tools à Windows Failover Cluster Managerà 


Open Failover Cluster Manager and start creating cluster setup. It is recommended and beneficial to validate configuration before setup. To setup cluster both nodes must be up and running and user have appropriate rights to communicate between both nodes. You might need Network person with you to help you creating cluster setup.
In my example I have made SQL01 node as Primary and SQL02 as secondary node. Start validating a configuration wizard


Next screen shot is asking permission to test all possibilities before setting up cluster environment


View successful report, there might be some errors regarding share storage disk but in the case of windows clustering we can continue with that

After successful verification Start create new cluster wizard


I have named my cluster as SQL-Cluster


Before finishing above is detail of your cluster. IP Address range is auto selected from you domain


You have successful configured you Cluster with minimal 2 nodes. Now have a look at cluster up and running in Windows cluster manager


Next step is creating Quorum setting for your cluster. 
Quorum; cluster generally requires more than half of the nodes to be up to facilitate high availability. This concept is called quorum. A Quorum is the numbers’ element that must be online for the cluster to continue running. In our scenario we have 3 nodes cluster (sql01, sql02 and share folder/node3). So if one node is down but node 2 and share folder is up cluster will remain on-line, the cluster will be on-line by winning majority vote. In the end of cluster set-up following alarms has been raised


To start setting up Quorum setup I have used Domain server DC01 server and create a share folder on one of its drive. Let's configure quorum setting for SQL-Cluster from Failover cluster manager


Select Quorum settings. The following screen describes the different quorum modes available since Windows Server 2008.


Select share folder


Selected options are shown before configuring quorum


Once Quorum configured you can view its type and detail on SQL-Cluster setup screen from Cluster Manager


At this point we have successfully established Windows server cluster WFCS and FCI. To configure SQL Server 2012 feature Always On availability we need to install SQL Server 2012 on both nodes (node1, node2).

WINDOWS SERVER 2012 ENTERPRISE
You need to Install SQL Server 2012 Enterprise or Data center edition to use this feature

During next steps

Tuesday, June 25, 2013

Windows Azure SQL Database Support in SQL Server 2012

Microsoft Windows Azure SQL Database supports some, but not all, of the programmability enhancements made in the SQL Server 2012 Database Engine. This topic describes which SQL Server 2012 programmability enhancements are supported in Windows Azure SQL Database.


·         OFFSET … FETCH: Supported in ORDER BY clause.

·         Error Handling: THROW: Supported

·         Metadata Discovery: Windows Azure SQL Database supports the use of management functions sp_describe_first_result_set and sp_describe_undeclared_parameters in place of SET FMTONLY to determine the format of a response without actually running the query are not supported.
·         EXEC … WITH RESULT SETS: Supported in enforcing contracts for result sets for the EXEC command.

·         New Conversion Functions: Windows Azure SQL Database supports TRY_CAST for converting for all types, and it supports FORMAT, PARSE, and TRY_PARSE for converting to and from strings.

·         New String Functions: The CONCAT string function is supported in Windows Azure SQL Database.

·         New Date and Time Related Functions: Windows Azure SQL Database supports DATEFROMPARTS, DATETIME2FROMPARTS, DATETIMEFROMPARTS, DATETIMEOFFSETFROMPARTS, EOMONTH, SMALLDATETIMEFROMPARTS, and TIMEFROMPARTS.

·         New Logical Functions: Windows Azure SQL Database supports IIF and CHOOSE.

·         New Spatial Features: Windows Azure SQL Database supports enhancements to spatial data types; new and updated methods and aggregates for geometry and geography; improved precision, enhancements to the geography type; spatial performance improvements; spatial helper stored procedures; support for persisted computed columns; and changes in the client-side spatial programming library.




·         Query Optimizer: The enhanced query optimizer hints, FORCESEEK and FORCESCAN, are supported.