Thursday, March 5, 2009

HOWTO: Migrating Quorum and DTC drive to different LUNs for SQL Cluster

HOWTO: Migrating Quorum and DTC drive to different LUNs for SQL Cluster

1. Create two new LUNs for Quorum and DTC drives and present them to ESX Host;
2. Adding the new LUNs as raw disk mapping to cluster nodes using the same SCSI ID on all nodes;
3. Go to computer management and initialize the disks, create new partition and format them;
4. Move Quorum Drive to DTC temporally via cluster administration:
5. Go to disk management and remove the drive letter ‘Q:’, assign drive letter ‘Q:’ to the new disk that mapped to the new LUN, do this on all nodes;
6. Go back to cluster administration, add the new disk into ‘Cluster Group’ then assign the new drive as Quorum Resource;
7. The old quorum disk is now ready to be removed;
8. To move DTC storage, remove the DTC resource first, then delete the old DTC drive from DTC Group;
9. Remove the drive letter from old DTC Drive and assign it to the new DTC Drive;
10. Add the new DTC drive to DTC group;
11. Create DTC Resource and bind it to the new drive;
12. The old DTC Drive is now ready to be removed.

Notes: this is the actual steps I took to move quorum/DTC drive inside our environment, please be reminded that quorum and DTC sit on different drives here.

SQL Server 2005 Cluster - Moving quorum/DTC drive

This exercise was done within VMWare ESX environment.

Notes:

-- this part relates to building the test environment

System drive (C:\) and shared drive need to sit on differenct scsi adapter

system drive need to sit on local disk resource (host storage)

map LUNs on nodes following same order and use same scsi id.

enable network dtc

'msdtc.exe -install' if things go wrong with MSDTC.

-- this part relates to moving quorum/dtc drive

>Break existing LUN to small LUNs: unmap the LUN from controller first then remove it, create new LUNs, map new LUNs to controller.
>check ESX storage controller and make sure new LUNs are presented to HOST.

--> add new LUNs to all nodes via raw disk mapping, make sure you use same SCSI ID on all nodes;

--> Move quorum drive to DTC drive temporally, release the drive letter from old quorum drive, assign it to the new drive, this need to be done on all nodes;

--> move quorum drive to the new disk;
--> for moving DTC drive, you will need to remove DTC first then add it back with the new drive;

Monday, March 2, 2009

Moving quorum/MSDTC drive in a SQL server cluster environment

Moving quorum/MSDTC drive in a SQL server cluster environment
22 July from external source
Moving a Cluster to a New SAN
A fairly common scenario for a cluster administrator is to move a cluster from one SAN to another as SAN equipment is replaced with newer/faster SANs or the old SAN's lease is up and a new one is being brought in.
The easiest way that I have found to do this is to use these steps (this is from memory, let me know if I missed one or two):
Super High Level Steps:

1. Put the new array in the same fabric as the existing array
2. Create new LUNs on the new array and make sure they are visible to the nodes
3. Map the new LUNs to the old drive letters
4. Copy data from the old drive to the new drive
5. Move quorum and MSDTC

Slightly More Detailed Steps:

1. Carve the new LUNs on the new array
2. Add the new array and its LUNs to the same switch as the existing array
3. Configure the LUN masking on the switch to expose the new LUNs to NodeA and NodeB
4. Use the disk management tools in Windows to rescan the drives
5. Use the active node to partition and format the disks
6. Use Cluster Administrtor to create the new physical disk resources and put them into their proper cluster groups
7. Move the Quorum using the GUI to a temp location
1. In Cluster Administrator, right click the cluster name
2. Select Properties
3. Select the Quorum tab
4. Use the drop down box to select a temp location for the quorum
8. Delete the existing MSDTC folder (if any)
1. Stop the MSDTC resource
2. Copy the MSDTC folder from Q: to the final quorum disk target location
3. Stop the Q: resource (remember, the quorum isn't there anymore)
4. Delete the MSDTC resource
9. Move the quorum to its final location
1. Go into disk management and change the Q: name to another letter
2. Use disk management and name the final quorum drive to Q:
3. Repeat steps 1-4 to move the quorum to its final destination
10. Recreate the MSDTC resource
1. Create a new MSDTC resource with the clustername network name resource and the new Q: as dependencies
2. Bring the MSDTC resource online
11. Stop the cluster service and the application cluster groups (you can just stop the application resources if you want to move app data an app at a time)
12. Move the data from the old disks to the new ones
13. Re-letter the old disks to something outside the current range, but do not remove them yet - you might need to use them in your back out plan
14. Re-letter the new disks to the same drive letter as the old ones (no, you do not have to worry about disk signatures as applications don't understand disk signatures and don't care about anything other than drive letters)
15. Verify the dependencies and update them as needed
16. Restart the cluster service
17. Make sure the new drive letters and disk resources are showing up properly in cluster administrator
18. Bring everything back online

Again, these are basic steps. Some of the individual steps will require lots of work. I have done this now several times and am very happy with the results.

http://support.microsoft.com/default.aspx?scid=kb;en-us;280353

Fom: http://msmvps.com/blogs/clusterhelp/archive/2005/08/05/moving-a-cluster-to-a-new-san-original-posted-jul-22-2005.aspx

Tuesday, February 24, 2009

Good Regular Expression to Enforce Password Complexity in ASP.NET Applications

Regular expression to enforce password complexity in your applications:

^.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$

The regular expression enforces the following rules:

  • Must be at least 10 characters
  • Must contain at least one one lower case letter, one upper case letter, one digit and one special character
  • Valid special characters (which are configurable) are - @#$%^&+=

Originally from Anil John's post

Wednesday, February 18, 2009

Debug Distributed Transactions Error in SQL Server

In Windows 2003, the security was tight on MSDTC service. you will get the following error if you start a distributed transaction agaist a linked server:

Server: Msg 7391, Level 16, State 1, Line 2
The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a].

To enable distributed transactions against linked SQL server or in ad-hoc queries, please follow these steps:

1) Enable network DTC access:
Goto control panel-->Add or Remove Programs, click Add/Remove Windows Components. In the popup window, highlight Application servers, click "Details..." button. In popup window, check "Enable network DTC access" check box if it's not selected.

You need to reboot your computer for this change to take effect.

2) Set up MSDTC security
Goto Administrator Tools-->Componet Services, expand Component Services-->Computers, right click "My Computer"-->Properties-->MSDTC tab-->"Security Configuration...", in the popup window,
Check Network DTC Access;
Check Allow IUnBound and Allow Outbound
make sure DTC Logon Account is NT Authority\NetWorkService


Save the change, MSDTC will restart

3) If firewall exists between the involved servers.
DTC uses Remote Procedure Call (RPC) dynamic port allocation. By default, RPC dynamic port allocation randomly selects port numbers above 1024. By modifying the registry, you can control which ports RPC dynamically allocates for incoming communication. You can then configure your firewall to confine incoming external communication to only those ports and port 135 (the RPC Endpoint Mapper port).
Reference MS article http://support.microsoft.com/?id=250367 to configure the ports RPC uses and firewall.

4) If your servers are running on different domain, or if you can run queries against the linked server, but get the same error messages when transaction is used, you need to change Authentication Mode of MSDTC security.

In the same UI in step 2), select "No Authentication Required" option. This is equivalent to turn off the RPC security. You can achieve the same effect by changing the registry key avlue:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\TurnOffRpcSecurity to 1. If the key not exists, you need to manually add it.

The option in the UI "Incoming Caller Authentication Required" only athenticate incoming RPC. It can be acheieved by the regisgy key value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\FallbackToUnsecureRPCIfNecessary to 1.

If you manually change registry, you need to restart MSDTC service.


Reference MS article: http://support.microsoft.com/?id=899191

BEGIN TRAN
SELECT * FROM LinkedServername.msdb.dbo.sysjobs
COMMIT TRAN
GO

The above query should be succeeded.

From: http://p-sql.spaces.live.com/?_c11_blogpart_blogpart=blogview&_c=blogpart&partqs=amonth%3d2%26ayear%3d2007


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

How to change SQL Server parameters in a clustered environment when SQL Server is not online

INTRODUCTION

When you use Microsoft SQL Server 2008 Configuration Manager, SQL Server 2005 Configuration Manager, SQL Serverhttp://images.intellitxt.com/ast/adTypes/mag-glass_10x10.gif 2000 Enterprise Manager, or SQL Server 2000 Setup to change SQL Server parameters in a clustered environment, you have to make changes on the active node while the SQL Server cluster resource is online. If SQL Server is not online, you have to bring SQL Server online first. However, in some circumstances, you may be unable to bring SQL Server online.

This article describes how to change SQL Server parameters in a clustered environment when SQL Server is not online or when you cannot bring SQL Server online.

http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gifBack to the top

MORE INFORMATION

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756Â (http://kbalertz.com/Feedback.aspx?kbNumber=322756/ ) How to back up and restore the registry in Windows

To change SQL Server parameters in a clustered environment when SQL Server is not online, use one of the following methods.

http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gifBack to the top

Method 1

Note We recommend that you try to use this method first.

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate the quorum disk. To do this, follow these steps:
    1. Locate the following registry key:

HKEY_LOCAL_MACHINE\Cluster\Quorum

    1. The Path entry contains the path of the quorum disk. For example, the Path entry contains the following path:

<QuorumDrive>:\MSCS

  1. Locate the GUID of the SQL Server cluster resource. To do this, follow these steps:

. Locate the following registry key:

HKEY_LOCAL_MACHINE\Cluster\Resources

a. Examine the Name column of the registry entries.

Note Several registry entries include "GUID" in the name of the entry.

    1. For the default instance, locate the SQL Server cluster resource that includes "SQL Server" in the Name column.

      For named instances, locate the SQL Server cluster resources that include "SQL Server (<InstanceName>)" in the Name column.
  1. Locate the checkpoint file name. To do this, follow these steps:

. Locate the following registry key:

HKEY_LOCAL_MACHINE\Cluster\Resources\{GUID}\RegSync

a. In the details pane, view the checkpoint registry hives and the corresponding numbers that resemble the following:

For the default instance
00000004 SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLSERVER

For a named instance
00000004 SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.X\MSSQLSERVER

Note For a named instance, X corresponds to the instance ID.

The number is the checkpoint file name. In this example, the checkpoint file name is 00000004.cpt.

  1. In Registry Editor, click HKEY_LOCAL_MACHINE.
  2. On the File menu, click Load Hive.
  3. In the <QuorumDrive>:\<GUID> folder, locate the checkpoint file that you found in step 4.
  4. In the Key Name box, type 1, and then click OK.
  5. Locate the following registry key to correct the invalid checkpoint registry key value:

HKEY_LOCAL_MACHINE\1\<YourRegistryKey>

Note The following examples correct the MSSQLSERVER checkpoint registry key:

    • Example 1
      To correct the invalid path of the Master.mdf file, follow these steps:

a. Locate the following registry key:

HKEY_LOCAL_MACHINE\1\Parameters

b. Correct the SQLArg0 key.

    • Example 2
      To disable the incorrectly enabled VIA protocol, follow these steps:
      1. Locate the following registry key:

HKEY_LOCAL_MACHINE\1\SuperSocketNetLib\Via

a. Change the value of the Enabled entry from 1 to 0.

  1. After you correct the registry key, click HKEY_LOCAL_MACHINE\1, click the File menu, and then click Unload Hive.

Note After you follow these steps, this checkpoint is fixed and is replicated to the specific node automatically during failover. You can bring the instance of SQL Server online.

http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gifBack to the top

Method 2

Note Do not perform SQL cluster group failover between step 1 and step 3.

  1. At a command prompt, run one of the following commands to disable the cluster checkpoint for the specific registry subkey:
    • For an instance of SQL Server 2008, run the following command:

cluster . resource "SQL Server (<InstanceName>)" /removecheckpoints:"HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\MSSQL.x\MSSQLSERVER"

Note In this command, MSSQL.x is a placeholder for the instance ID of the instance of SQL Server. You can determine the corresponding value for the system from the value of the MSSQLSERVER registry entry in the following registry subkey:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<Instance Names>\SQL\

    • For an instance of SQL Server 2005, run the following command:

cluster res "SQL Server (<InstanceName>)" /removecheck: "Software\Microsoft\Microsoft SQL Server\ MSSQL.x \MSSQLSERVER"

    • For the default instance of SQL Server 2000, run the following commands:

cluster res "SQL Server" /removecheck: "Software\Microsoft\MSSQLServer\MSSQLSERVER"

cluster res "SQL Server" /removecheck: "Software\Microsoft\MSSQLServer\Cluster"

Note You have to run the second command only when you add or remove one or more IP addresses on which SQL Server 2000 listens.

    • For a named instance of SQL Server 2000, run the following commands:

cluster res "SQL Server (<InstanceName>)" /removecheck: "SOFTWARE\Microsoft\Microsoft SQL Server\Instance_Name\MSSQLSERVER"

cluster res "SQL Server (<InstanceName>)" /removecheck: "SOFTWARE\Microsoft\Microsoft SQL Server\Instance_Name\Cluster"

Note In these commands, Instance_Name is a placeholder for the name of the instance of SQL Server 2000. Additionally, you have to run the second command only when you add or remove one or more IP addresses on which SQL Server 2000 listens.

  1. Change the parameter for the clustered instance of SQL Server on all nodes.
  2. At a command prompt, run one of the following commands to enable the cluster checkpoint for the specific registry subkey:
    • For an instance of SQL Server 2008, run the following command:

cluster . resource "SQL Server (<InstanceName>)" /addcheckpoints:"HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\MSSQL.x\MSSQLSERVER"

    • For an instance of SQL Server 2005, run the following command:

cluster res "SQL Server (<InstanceName>)" /addcheck: "Software\Microsoft\Microsoft SQL Server\MSSQL.x\MSSQLSERVER"

    • For the default instance of SQL Server 2000, run the following commands:

cluster res "SQL Server" /addcheck: "Software\Microsoft\MSSQLServer\MSSQLSERVER"

cluster res "SQL Server" /addcheck: "Software\Microsoft\MSSQLServer\Cluster"

    • For a named instance of SQL Server 2000, run the following commands:

cluster res "SQL Server (<InstanceName>)" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\Instance_Name\MSSQLSERVER"

cluster res "SQL Server (<InstanceName>)" /addcheck: "SOFTWARE\Microsoft\Microsoft SQL Server\Instance_Name\Cluster"

  1. Note The resource name "SQL Server (<InstanceName>)" may be different in your case. To confirm the resource name, start Cluster Administrator, click SQL Group, locate the SQL Server resource properties, and then determine the exact name of the resource.
  2. Bring the instance of SQL Server online.

http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gifBack to the top

REFERENCES

For more information about how to configure server startup options in SQL Server Configuration Manager, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/ms345416.aspx (http://msdn2.microsoft.com/en-us/library/ms345416.aspx)

For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

912397Â (http://kbalertz.com/Feedback.aspx?kbNumber=912397/ ) The SQL Server service cannot start when you change a startup parameter for a clustered instance of SQL Server 2000 or of SQL Server 2005 to a value that is not valid

244980Â (http://kbalertz.com/Feedback.aspx?kbNumber=244980/ ) How to change the network IP addresses of SQL Server failover cluster instances


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

Monday, February 16, 2009

Things I Wish I Had Known

Things I Wish I Had Known
By Tim Mitchell in Tim Mitchell | 02-11-2009 10:46 PM | Categories: Filed under: Career

It's OK to make mistakes. It's also OK to admit it.
There are two types of people in this world: those who make mistakes and fess up, and those that make mistakes and try to cover it up. Everyone - everyone - makes mistakes in their jobs, and in life in general. While there are some high-profile mistakes that are notoriously noteworthy (airline disasters, medical errors), the vast majority of us are permitted, and even expected, to make a few errors here an there. As long as you can learn from your errors and not continue to make the same mistakes, it can be filed under the "Valuable Lessons Learned" heading. Further, those whom you work with and for will have more respect for you if you admit your errors up front, especially when you deliver a plan for resolution.
Technical skills are not enough
When I started out, I had my mind set on simply learning a craft, fine-tuning my skills to become one of the best in the field, and keeping my head down and working hard for the next 40 years. While it is important to grow and learn hard skills, today's economy is not friendly to the stereotypical technical geek working in a dark basement and slinging code (or monitoring logs, or building desktops, or whatever). To be successful, you've got to break out of your technical world every now and again and interface with nontechnical people. Spend half a day shadowing one of your end users to see how the systems you build/support help them to do their jobs. Spend time with senior management and executives to find out what big-picture goals they have, and how you help get the organization there. Have coffee with someone unfamiliar with technology and learn how you can ease them into the digital age. Most importantly, get to know the overall goals of your organization/clients/customers - you'll be far more successful in the long run.
You are responsible for your own career development
Technical careers require constant learning. Training, college, and conferences/trade shows are great ways to learn and network, but many companies can't or won't fork over the cash for these career development events. The bottom line is, it's up to you to take charge of your career. A few thousand dollars for conference fees can be painful, but it could be argued that you'll easily recoup that investment over the course of your career. For those who truly are budget strapped, there are tons of free career resources; user group events, online references (even videos!), libraries, and volunteer opportunities are all cost conscious ways to build your network and skillset.
Don't try to be an expert in everything
There are generalists, and there are specialists; nobody can be an expert in all things technical. Find something that you enjoy doing (that statement alone should be a bullet point), and become an expert in that thing. You don't have to specialize to the point that you're a niche player, but you can limit your scope such that you can be known as an authority in your chosen area.
Don't take things too seriously
I almost didn't type this last one for fear that I would portray myself as having a lackadaisical attitude toward my career; nothing could be further from the truth. We're all human (see #1 above) and are limited by a number of factors, including emotions, limited energy, family commitments, and natural abilities. Don't be a stickler for absolute perfection; accept that some things are part of live and unchangeable. When obstacles block your path, don't freak out or become the voice of negativity; take a breath, smile, and know that, if it was easy, everybody would be doing it and our skills would be far less valuable. Address problems or deadlines with a sense of urgency, but don't let your commitments consume you to the point that you spend all of your time working.


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

Disable Microsoft Defender for Cloud for Visual Studio Subscription (MSDN)

I use a visual studio pro subscription which comes with $150 azure cloud credit, for some reason Microsoft Defender for Cloud was turned on ...