SQL Server 2012: building failover cluster

Just a note to self after tonights exam preparation on how to create a SQL Failover Cluster.

Every database server that hosts critical system should be created as high-availability solutions. This can be done by creating “Failover Cluster” or “AlwaysOn Availability Groups”. This post only includes notes on important points for Failover cluster.

  1. Configure shared storage. Make sure servers are in the OU for SQL Servers. Apply firewall rules for ports TCP/135, TCP/3260, in addition to UDP/138 and any SAN target software. Bring SAN volumes online and create disk partitions. Add DNS record for cluster name.
  2. Configure Windows Server R2 failover cluster. Apply .NET Framework 3.5.1 on all nodes. Configure cluster servers (nodes). Set cluster name and IP.
  3. Run “Advanced Cluster Preparation” on each node.  Each node in cluster need to perform this preparation task with node reboot. Installation includes db engine, replication, Mgmnt tools on default instans.
  4. Run “Advanced Cluster Completion” on node with shared storage.  Verify SAN disks. Set server network name, resource group, cluster IP and subnet-mask, including online status verfication.
  5. Perform a cluster failover. This can be done by powershell command “Move-ClusterGroup <resourcegroup> <node>”

SQL Server 2014 CTP 2 available

The road to new version of SQL Server seems to come closer every month. This week the CTP2 version was released. The main feature for the SQL Server 2014 is the in-memory processing, and extended AlwaysOn capabilities and better integration between on-premis and cloud to enable hybrid database solutions.

When I have completed 70-462 exam, I will definitivly set up hybrid alwayson solution on my VMs at work to test these new capabilities, in additions to the in-memory stuff.

ncalc@codeplex – excellent math library

The NCalc codeplex free library is excellent for evaluating mathematical expressions run-time in C#. It has alot of operators, supports functions and parameterized calculations. If you want to define a formula in string format and run-time pass calculated or stored values as parameters, this library is the best free tool I have worked with for a long time.

In my case, the following code gives an idea of the library usage:

string formula = "(2*[A]) + (2 *[B1]) + [B2] + [C]";
var expr = new Expression(formula);
expr.Parameters = new Dictionary<string, object>
    {
        { "A", 100 }, { "B1", 20 }, { "B2", 50 }, { "C", 20 }
    };
Console.WriteLine("Res: '" + formula + "' = " + expr.Evaluate());

The formula has 4 parameters – [A], [B1], [B2], and [C]. The example will use the values stored in the Dictionary. As a result the library will replave the parameters with the values from the dictonary as followed:

(2*100) + (2*20) + 50 + 20 ==> 310

And the result is 310. This is very useful and saves my for a lot of time in the current project at work. The parameters can also be replaced with functions.