Category: Small Bites of Big Data

Technology, Tech, Big Data, SQL Server, Azure, cloud

  • Checklist for installing SQL Server 2005 as a clustered instance

    Checklist for installing SQL Server 2005 as a clustered instance

     

    Windows/Hardware

    1)      Verify the Windows cluster is set up per basic best practices and that basic failover works.

    2)      Verify you have the latest patches, especially security patches, for Windows.

    3)      For Windows 2008: Validate the configuration using “Validate a Configuration” in Failover Cluster Management.

    4)      For Windows 2008: Make sure your quorum choice is appropriate for the number of nodes and other factors in your environment.

    5)      Unless you have verified that your network cards support it, disable TCP Chimney and the other SNP settings.

    6)      Verify none of the cluster nodes are domain controllers.

    7)      Request a disk subsystem configured per IO and recoverability best practices that meets your minimum performance requirements (often you will require that Avg disk sec/read < 10-20ms and Avg disk sec/write < 3-5ms for a given load on the system).

    8)      Have one or more “shared disks” that are not otherwise used by anything else (not even another instance of SQL) available to SQL Server. Create a new group and move the disk(s) from “Available Storage” (new in Windows 2008) to the group you created for this SQL Server instance. The disks should be configured per database best practices. Generally no other resources should be in this group.

     

    Prep

    9)      Download whatever service packs (SPs) and cumulative updates (CUs) you will be installing. Make sure the files you download are the proper architecture (x86 vs. x64).

    10)   Download Visual Studio 2005 SP1.

    11)   Find a new, (preferably) static IP address that is not currently used by anything. You will enter this during setup and the setup process will take care of adding it to DNS and other locations as appropriate.

    12)   Find or create one or more domain groups that will be used by setup. The best practice is to use three unique groups for each instance of SQL Server, one each for SQL Server, SQL Agent, and Full Text. If the account you are using for setup does not have the permission to add the startup account(s) to the groups, add them manually ahead of time.

    13)   Determine your SQL virtual name (cannot be used for a physical or virtual machine anywhere in the domain).

    14)   Determine an instance name which will be unique in the cluster. Note that the name of a default instance is implicitly MSSQLSERVER so you can only have one default instance per cluster.

    15)   Determine which domain user account(s) you will assign to run SQL Server, SQL Agent, and Full Text. The account(s) you choose will be added to the domain groups by the setup process if your setup account has permissions to do so. As a security best practice each service should have a unique account.

    16)   Look through the items in my blog to find possible setup blockers http://blogs.msdn.com/cindygross/archive/2009/06/10/sql-server-2005-clustering-tips-references.aspx.

     

    Install

    17)   From the node which currently owns the group with the disks to be used by SQL Server, log in with an account that is a local admin on all nodes.

    18)   Make sure no one is logged on through terminal services to any of the remote nodes.

    19)   Make sure the Remote Registry service, Cryptography services, and Task Scheduler service are started on all nodes.

    20)   Verify all available disks in the cluster are online, even those that SQL Server will not use.

    21)   Stop non essential services that may slow down file copies (like virus scanners) or try to connect to SQL Server (like IIS or monitoring tools).

    22)   Install the RTM version of SQL Server, for SQL Server 2005 you run setup once per instance. It will install the cluster aware components on all nodes. This includes SQL Server and Analysis Services if you choose them.

    1.       Install the SQL SP.

    2.       Install the SQL CU.

    3.       Install the VS05 SP1.

    23)   On every other node in the cluster, if you want the non-cluster aware components to be available, install those components on each node.

    1.       RTM (for example, you may want to install the client tools and SSIS on the other node(s))

    2.       SQL SP.

    3.       SQL CU.

    4.       VS05 SP1.

     

    After

    24)   Make SQL depend on any drives it will use for data and log files. Those drives must be in the SQL Server group.

    25)   If you will be using DTC, you may want to cluster it.

    26)   Update MSDTSSrvr.ini.xml on each node to point to the SQL Server virtual nameinstance. If you have multiple instances of SQL Server that will store SSIS packages you can add multiple instance names to the file.

    27)   Consider setting “Max server memory” for each instance of SQL Server.

    28)   Make sure the SQL Server service is set to “affect the group”.

    29)   Follow your normal SQL Server best practices and standard configuration such as removing builtinadministrators and configuration maintenance operations.

     

    References

    ·         The 3 Things you Need to Know to Install SQL 2005 on Windows 2008 Cluster http://blogs.msdn.com/psssql/archive/2009/04/08/the-3-things-you-need-to-know-to-install-sql-2005-on-windows-2008-cluster.aspx

    ·         List of known issues when you install SQL Server 2005 on Windows Server 2008 http://support.microsoft.com/default.aspx?scid=kb;EN-US;936302

    ·         SQL Server 2005 Failover Clustering White Paper http://www.microsoft.com/downloads/details.aspx?familyid=818234dc-a17b-4f09-b282-c6830fead499&displaylang=en

    ·         System Configuration Check (SCC) http://msdn.microsoft.com/en-us/library/ms143185(SQL.90).aspx

    ·         Hardware and Software Requirements for Installing SQL Server 2005  http://msdn.microsoft.com/en-us/library/ms143506(SQL.90).aspx

    ·         How to: Create a New SQL Server 2005 Failover Cluster (Setup) http://msdn.microsoft.com/en-us/library/ms179530(SQL.90).aspx

    ·         SQL Server 2005 Readme http://download.microsoft.com/download/5/0/e/50ec0a69-d69e-4962-b2c9-80bbad125641/ReadmeSQL2005.htm

    ·         Changes to the readme file for SQL Server 2005 http://support.microsoft.com/default.aspx?scid=kb;EN-US;907284

    ·         (my blog) SQL Server 2005 Clustering Tips/References http://blogs.msdn.com/cindygross/archive/2009/06/10/sql-server-2005-clustering-tips-references.aspx

    ·         (my blog) How to configure DTC for SQL Server in a Windows 2008 cluster http://blogs.msdn.com/cindygross/archive/2009/02/22/how-to-configure-dtc-for-sql-server-in-a-windows-2008-cluster.aspx

  • SQL Server and TCP Chimney

    If you are using SQL Server or Analysis Services: I suggest you double check that your SNP settings, especially TCP Chimney Offset, are all OFF unless your NIC vendor has verified they support it and you have installed their version of drivers that support it. Windows 2003 SP2 turned it on by default, you can disable it with a hotfix (which updates three registry key values) or manually set the registry key values yourself. If the NIC vendor does support the settings they can improve your network performance, but when they don’t support it you can see odd connectivity problems.

     

    My suggestion for a standard:

     

    SNP/TCP Chimney settings will be disabled to avoid known problems with SQL Server and other products.
    REASON: Performance and usability. When TCP Chimney is enabled it will often result in failed connectivity to SQL Server and/or dropped packets and connections that affect SQL server. See  948496 An update to turn off default SNP features is available for Windows Server 2003-based and Small Business Server 2003-based computers
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;948496 and 942861 Error message when an application connects to SQL Server on a server that is running Windows Server 2003: “General Network error,” “Communication link failure,” or “A transport-level error” http://support.microsoft.com/default.aspx?scid=kb;EN-US;942861

     

    948496 An update to turn off default SNP features is available for Windows Server 2003-based and Small Business Server 2003-based computers http://support.microsoft.com/default.aspx?scid=kb;EN-US;948496

     

    Some of the known SNP/Chimney issues:

    ·         951037  Information about the TCP Chimney Offload, Receive Side Scaling, and Network Direct Memory Access features in Windows Server 2008 http://support.microsoft.com/default.aspx?scid=kb;EN-US;951037

    ·         942861  Error message when an application connects to SQL Server on a server that is running Windows Server 2003: “General Network error,” “Communication link failure,” or “A transport-level error” http://support.microsoft.com/default.aspx?scid=kb;EN-US;942861

    ·         945977  Some problems occur after installing Windows Server 2003 SP2 http://support.microsoft.com/default.aspx?scid=kb;EN-US;945977

    ·         947775 On a Windows Server 2003 computer that has a TCP Chimney Offload network adapter, TCP data stream may be corrupted when the network adapter indicates a MDL chain whose starting MDL has a nonzero offset http://support.microsoft.com/default.aspx?scid=kb;EN-US;947775

    ·         936594 You may experience network-related problems after you install Windows Server 2003 SP2 or the Scalable Networking Pack on a Windows Server 2003-based computer http://support.microsoft.com/default.aspx?scid=kb;EN-US;936594

    ·         947773 A Windows Server 2003-based computer responds slowly to RDP connections or to SMB connections that are made from a Windows Vista-based computer http://support.microsoft.com/default.aspx?scid=kb;EN-US;947773

    ·         946056 A Windows Server 2003-based computer responds slowly to RDP connections or to SMB connections that are made from a Windows Vista-based computer http://support.microsoft.com/default.aspx?scid=kb;EN-US;946056

    ·         940202 A Windows Server 2003-based computer may stop responding during shutdown after you install the Scalable Networking Pack http://support.microsoft.com/default.aspx?scid=kb;EN-US;940202

    ·         924325 Network applications that use the NetBT keep-alive transmissions may not work correctly after you install the Windows Server 2003 Scalable Networking Pack on a Windows Server 2003-based computer http://support.microsoft.com/default.aspx?scid=kb;EN-US;924325

    ·         945466 Stop error occurs when a computer that is TCP Offload Engine (TOE) enabled is running under stress with a “low resource simulation” mode http://support.microsoft.com/default.aspx?scid=kb;EN-US;945466

    927168 TCP traffic stops after you enable both receive-side scaling and Internet Connection Sharing in Windows Vista or in Windows Server 2003 with Service Pack 1 or Service Pack 2 http://support.microsoft.com/default.aspx?scid=kb;EN-US;927168

  • How to automate Update Statistics

    For SQL Server 2005 here are some options to update statistics with the default settings that samples the data instead of reading every row:

     

    1) If you are also defragmenting your database with REBUILD and/or REORGANIZE you will want to integrate your Update Statistics into that schedule. When you do a REBUILD you are essential getting the equivalent of an UPDATE STATISTICS WITH FULLSCAN so you do not want to turn around do a sampling of statistics or another FULLSCAN too soon after the REBUILD.

     

    Paul Randal talks about the interaction of the two: http://www.sqlskills.com/BLOGS/PAUL/post/Search-Engine-QA-10-Rebuilding-Indexes-and-Updating-Statistics.aspx  

     

    A great script that lets you schedule your defragmentation and statistics maintenance all at once:  SQL Server 2005 and 2008 – Backup, Integrity Check and Index Optimization

    http://ola.hallengren.com/

    If you choose to run this script you will need three components created in your master database.

    CommandExecute and DatabaseSelect and IndexOptimize

     

    2) Here is how to loop through all database and do an UPDATE STATISTICS on all objects (within the restrictions of the sp_updatestats procedure). It uses the undocumented and unsupported (but widely used) sys.sp_MSforeachdb. The query also captures how long it takes per database:

     

     

    exec master.sys.sp_MSforeachdb ‘ USE [?];

     

    DECLARE @starttime datetime, @endtime datetime

    SELECT @starttime = GETDATE()

    SELECT db_name() as CurrentDB, @starttime as DBStartTime

    EXEC sp_updatestats

    SELECT @endtime = GETDATE()

    SELECT @starttime as StartTime, @endtime as EndTime, DATEDIFF(MINUTE,@starttime,@endtime) as TotalMinutes

     

    3) If you want more control over which statistics are updated, you can specify an individual object or index:

    UPDATE STATISTICS [table_name]
    or

    UPDATE STATISTICS [table_name] [index_name/statistics_name]

     

    4) Create an SSIS package that uses the “UPDATE STATISTICS Task” as part of a maintenance plan. You can create it manually or with the maintenance plan wizard. Update Statistics Task (Maintenance Plan) http://msdn.microsoft.com/en-us/library/ms178678.aspx

     

    Considerations:

    ·         In most cases you will want auto update and auto create statistics ON and you will NOT want to use the RECOMPUTE option as that turns off the automatic updating. This (having auto stats on) works best when you have a regularly scheduled UPDATE STATISTICS (on a schedule and/or after large data modifications/batches) to reduce the chance that the auto update has to kick in during a busy time.

    ·         In many cases you will also want AUTO_UPDATE_STATISTICS_ASYNC on so that auto stats don’t make the query that pushed the stats over the edge to wait for updated statistics. The downside of this is that the query that ran right after the statistics reach the “stale” threshold will use the old statistics. Whether it is worth it for any given query to wait depends on how long it takes to update the statistics, whether the query plan changes afterwards, and whether a different query plan causes a significant difference in total response time.

    ·         Note from BOL: For databases with a compatibility level below 90, executing sp_updatestats resets the automatic UPDATE STATISTICS setting for all indexes and statistics on every table in the current database. For more information, see sp_autostats (Transact-SQL). For databases with a compatibility level of 90 or higher, sp_updatestats preserves the automatic UPDATE STATISTICS setting for any particular index or statistics.

     

    References:

    ·         Statistics Used by the Query Optimizer in Microsoft SQL Server 2005 http://technet.microsoft.com/en-us/library/cc966419.aspx

    ·         Statistics Used by the Query Optimizer in Microsoft SQL Server 2008 http://msdn.microsoft.com/en-us/library/dd535534.aspx

  • SQL Server with NetApp SAN

    If you are planning to use  NetApp as the SAN for your SQL Server instance(s), take a look at these documents in addition to the normal SQL Server IO planning best practices documents.

    TR-3779 Sizing best practice guide.
    http://media.netapp.com/documents/tr-3779.pdf

    TR-3696 This is for the storage layout best practices.
    http://www.netapp.com/us/library/technical-reports/tr-3696.html

    White Paper on 1 TB DSS systems
    http://www.netapp.com/us/library/technical-reports/tr-3650.html

    SMSQL 5.0 Best Practice Guide
    http://media.netapp.com/documents/tr-3431.pdf

    Microsoft® SQL Server 2005 Performance and Scalability Testing Using NetApp FAS920 Storage Systems
    http://media.netapp.com/documents/tr-3402.pdf

  • SQL Server Security Granularity

    I have had some questions recently about how to grant developers certain permissions without giving them sysadmin rights. Hopefully this summary will help you determine how to grant the least possible privileges. The summary is based on SQL Server 2005 but will also apply to SQL Server 2008.

    ·         I would hesitate to grant any more permissions in development than they get in production. This means avoid not only sysadmin but also db_owner where possible.

    o   This avoids problems where they spend a long time developing something only to find out at the last minute that it won’t work with production permissions.

    o   If there is any production data on the development system it may be more vulnerable to attack when more people have elevated permissions.

    o   As an alternative you may want to create an application that lets them submit requests to do things that require elevated permissions. It can log on to SQL Server with the appropriate permissions and perform whatever action they need. It can optionally log this activity, create a change request ticket, email the DBAs, or whatever you like. This should reduce the chance that some elevated permission need makes it into the application because it is much more obvious when they are performing an activity that they or the application will not be able to do in production.

    ·         Generally you will not want to grant CREATE DATABASE permissions to non-DBAs. Creating databases involves OS level permissions and space management, performance considerations, best practice implementations, backups, maintenance, etc. Also, the creator of a database can make themselves a db_owner which is usually more than a developer needs. If you do decide to grant permissions to create databases, the permission is GRANT CREATE DATABASE TO … and/or GRANT ALTER ANY DATABASE TO ….

    ·         The KILL command to kill an existing SPID requires either PROCESSADMIN or SYSADMIN role membership. The PROCESSADMIN role includes both ALTER ANY CONNECTION and ALTER SERVER STATE and the combination of the two are required to use the KILL command.

    ·         To run SHOWPLAN or use the GUI actual/estimated execution plans to see execution plans, you can GRANT SHOWPLAN TO… in the database(s) that contain the objects referenced in the queries. They also need permission to execute the query itself. There is no need to grant anything more than the ability to execute the query if you just want to SET STATISTICS TIME or SET STATISTICS IO. The danger in granting this permission is that the plan could theoretically contain information about data or the schema that would help a hacker.

    ·         To run SQL Profiler you can GRANT ALTER TRACE TO…. The danger is that the user can see information about the schema and sometimes the data that could be used to hack into the system.

    ·         To use Job Activity Monitor, first add the login or group as a user in the MSDB database. Then add them to the operator role:

    sp_addrolemember ‘SQLAgentReaderRole’, ‘test1’

    ·         Using the Activity Monitor requires VIEW SERVER STATE and SELECT on sysprocesses and syslocks. The SELECT on sysprocesses and syslocks is granted by default to PUBLIC and therefore everyone, but VIEW SERVER STATE has to be explicitly granted.

    ·         To run the Database Tuning Advisor (DTA) you need SHOWPLAN permissions and the ability to execute the queries in all the databases in the workload. However, if the trace file used as input includes the LoginName data column DTA will try to impersonate the users and therefore permission needs to be granted to each user OR you can avoid collecting the LoginName data column. Right after a new instance of SQL Server is installed, a sysadmin must run DTA once before anyone else can use it initialize some settings.

    ·         To create objects, you have a couple of choices. You can GRANT CREATE TABLE, GRANT CREATE PROCEDURE, etc. in each database. Alternatively you can add them to the db_ddladmin role in the appropriate databases. This will grant them VIEW ANY DATABASE and the database level permissions ALTER ANY ASSEMBLY, ALTER ANY ASYMMETRIC KEY, ALTER ANY CERTIFICATE, ALTER ANY CONTRACT, ALTER ANY DATABASE DDL TRIGGER, ALTER ANY DATABASE EVENT, NOTIFICATION, ALTER ANY DATASPACE, ALTER ANY FULLTEXT CATALOG, ALTER ANY MESSAGE TYPE, ALTER ANY REMOTE SERVICE BINDING, ALTER ANY ROUTE, ALTER ANY SCHEMA, ALTER ANY SERVICE, ALTER ANY SYMMETRIC KEY, CHECKPOINT, CREATE AGGREGATE, CREATE DEFAULT, CREATE FUNCTION, CREATE PROCEDURE, CREATE QUEUE, CREATE RULE, CREATE SYNONYM, CREATE TABLE, CREATE TYPE, CREATE VIEW, CREATE XML SCHEMA COLLECTION, REFERENCES

     

    This query will show you the list of available privileges:
    select * from sys.fn_builtin_permissions (DEFAULT)

  • x64 Windows – Upgrade from 32bit SQL Server to 64bit SQL Server

    Many people are now upgrading from 32bit to 64bit SQL Servers. Most of you have a match between your operating system and your SQL Server platform. For example, most of you install a 32bit SQL Server on 32bit Windows, and if you have the x64 platform of Windows, you usually install the x64 SQL Server. But what happens when you have a 32bit SQL Server on an x64 system and you want to change it to be al x64? Note that you cannot install 32bit SQL Server on IA64 so this scenario does not apply to Itanium systems. In the example below both the platform and the version of SQL Server are changing.

    You have an instance of SQL Server 2000 32bit installed on Windows 2003 SP2 x64. This means SQL Server is “running in the WOW”. WOW stands for Windows on Windows and means you have a 32bit application running inside a 64bit OS. This gives SQL Server a full 4GB of user addressable virtual memory space, which is more than any 32bit application can get on a 32bit OS without memory mapping (in SQL we do memory mapping of the buffer pool through “AWE”). However running in the WOW doesn’t give you the full memory advantages you would get from running a true x64 application on an x64 OS. SQL Server 2000 was not released in an x64 “flavor”, but once you upgrade to SQL Server 2000 SP4 Microsoft will support running it in the WOW. SP4 was required for this particular configuration even before we discontinued support for SP3. See 898042 Changes to SQL Server 2000 Service Pack 4 operating system support http://support.microsoft.com/default.aspx?scid=kb;EN-US;898042 Generally you should avoid installing 32bit applications on x64 systems whenever possible. Any recently purchased hardware will be x64 and putting a 32bit OS on it will throttle back its memory capabilities, so your best bet is going to be an x64 version of SQL Server on x64 Windows.

     

    You want to upgrade this instance from SQL Server 2000 32bit to SQL Server 2005 x64 on the same box. You would like to keep the same instance name. However, we do not support an in-place upgrade from any 32bit SQL Server to any 64bit SQL Server. Additionally, you cannot restore system databases (master, model, tempdb, msdb) to a different version, not even a different service pack or hotfix level.

    ·         Version and Edition Upgrades “Upgrading a 32-bit instance of SQL Server 2000 from the 32-bit subsystem (WOW64) of a 64-bit server to SQL Server 2005 (64-bit) on the X64 platform is not supported. However, you can upgrade a 32-bit instance of SQL Server to SQL Server 2005 on the WOW64 of a 64-bit server as noted in the table above. You can also backup or detach databases from a 32-bit instance of SQL Server 2000, and restore or attach them to an instance of SQL Server 2005 (64-bit) if the databases are not published in replication. In this case, you must also recreate any logins and other user objects in master, msdb, and model system databases.”

    ·         You cannot restore system database backups to a different build of SQL Server “You cannot restore a backup of a system database (master, model, or msdb) on a server build that is different from the build on which the backup was originally performed.”

    ·         If the SQL Server versions are the same, even system databases can be restored between different platforms (x86/x64). However, you do sometimes have to make one update to the msdb database when you do this (because often the SQL Server install path has changed, such as using “program files (x86)” on an x64 system). For non-system databases the version you restore to doesn’t have to be identical, generally you can restore a user database to a higher version and the platform (x86/x64) is irrelevant. Error message when you restore or attach an msdb database or when you change the syssubsystems table in SQL Server 2005: “Subsystem % could not be loaded”

     

    So in this case you have two basic options if you must keep the same server and instance name:

    1.       Upgrade, reinstall, attach

    a.       Make sure all users, applications, and services are totally off the system for the entire duration of the downtime

    b.      Upgrade SQL 2000 SP4 32bit to SQL 2005 (or 2008) 32bit (NOT x64! – that is not a viable upgrade path)

    c.       Backup all databases

    d.      Detach the user databases (the detach does a checkpoint to ensure consistency)

    e.      Make copies of the mdf/ldf files for user and system dbs

    f.        Uninstall SQL Server 2005 32bit (to make the instance name available)

    g.       Install SQL Server 2005 x64 to the same instance name and at the EXACT same version as what was just uninstalled

    h.      Restore master, model, msdb

    i.         Attach the user databases

    j.        If needed, run the update from Error message when you restore or attach an msdb database or when you change the syssubsystems table in SQL Server 2005: “Subsystem % could not be loaded”

    k.       Apply the appropriate Service Pack and/or Cumulative Update

    l.         Take full backups

    m.    Allow users back in the system

    2.       Reinstall, attach, copy system db info

    a.       Make sure all users, applications, and services are totally off the system for the entire duration of the downtime

    b.      Backup all databases

    c.       Extract all relevant information to allow re-creation of system database information. This includes logins/passwords, configuration settings, replication settings, linked servers (including login mappings), custom error messages, extended stored procedures, MSDB jobs, DTS/SSIS packages stored in MSDB, proxies, any objects manually created in any system database. If you go this route let me know and I’ll double check that this list is complete.

    d.      Detach the user databases (the detach does a checkpoint to ensure consistency)

    e.      Make copies of the mdf/ldf files for user and system dbs

    f.        Uninstall SQL Server 2000 32bit (to make the instance name available)

    g.       Install SQL Server 2005 x64 to the same instance name.

    h.      Attach the user databases

    i.         Apply all the system information you extracted above including sync’ing users to the new logins.

    j.        If needed, run the update from Error message when you restore or attach an msdb database or when you change the syssubsystems table in SQL Server 2005: “Subsystem % could not be loaded”

    k.       Apply the appropriate Service Pack and/or Cumulative Update

    l.         Take full backups

    m.    Allow users back in the system

  • SQL Server Consolidation

    Many companies are now looking to consolidate their SQL Server instances. The old strategy of one instance per server can be wasteful of resources. Often large chunks of physical resources sit idle and a lot of money is spent on electricity to power all those machines. If you can consolidate even some of your instances onto fewer machines, you can save both physical and human resources. Note that any one of the below strategies will work on either a standalone or clustered system.

     

    Some of the pros/cons of each common type of consolidation strategy:

     

    Hyper-V virtualization

    ·         Great when you have to use a version of the OS, drivers, or applications that aren’t used anywhere else or that don’t ‘play well with others’.

    ·         Can be more flexible and easier to move to another host machine than a physical instance.

    ·         Has great performance for SQL Server if configured per best practices, you can get the same throughput at a slight cost in increased CPU usage.

    ·         Network intensive applications may have a higher network and CPU cost on a VM.

    ·         For now, any Hyper-V virtual machine (VM) is limited to only 4 CPUs assigned per VM (for Windows 2008, 2 CPUs for Windows 2003 guest OS).

    ·         For now, any Hyper-V virtual machine is limited to 64GB of RAM per VM.

    ·         Requires x64 chips with Intel VT or VMD virtual with DEP enabled

    ·         Allows total isolation of the entire environment.

     

    Multiple instances

    ·         Very good for isolating security (assuming each SQL Server service starts with a different account).

    ·         Allows each instance to be managed and configured to meet the needs of a single group of users. This often makes downtime for SQL Server patches easier to arrange.

    ·         There is some additional overhead, mainly memory, required compared to a single instance because each instance has some allocations that occur at startup regardless of actual usage. However, this is usually low, especially on today’s high RAM systems.

    ·         Allows multiple versions of SQL Server to be installed at once with each application on its preferred version. The different version could mean 2000 vs. 2005 vs. 2008, or it could mean different service pack and hotfix levels.

     

    Single instance with multiple databases/applications

    ·         This method can be very cost effective and is often easy to manage as long as the applications/databases don’t have performance problems or cause conflicts with one another.

    ·         If a SQL Server patch has to be applied for one database, all the databases share the downtime. The administration is easier because the patch only has to be applied once, but it can be more difficult to arrange downtime that is acceptable to all users.

    ·         This method can cause security problems. If any application has permissions, such as sysadmin role membership, which extends outside of its own database it can affect other databases/applications on the server.

    o   One example of a problem is an application with sysadmin permissions that changes configuration settings, TempDB settings, or other things that affect other databases/applications either directly or indirectly.

    o   Another example is that if an application doesn’t protect against SQL injection, it can allow a hacker into the database. If that database is on an instance with other databases and the id used by the hacked application has elevated permissions such as sysadmin then the hacker now has access to all the other databases.

    o   This could include accidental or intentional changes by internal employees or contractors, so the danger is not limited to databases accessible through the internet.

    ·         Applications share TempDB which can sometimes be a bottleneck depending on the way the applications access the databases. Often this can be managed with proper TempDB sizing and number of data files.

    ·         Depending on how you license your software, this could possibly save you some money.

     

    I hope you find this information helpful, and I have included some references below with more details on your options.

    Green IT in Practice: SQL Server Consolidation in Microsoft IT

    http://msdn.microsoft.com/en-us/architecture/dd393309.aspx

    Running SQL Server 2008 in a Hyper-V Environment – Best Practices and Performance Recommendations

    http://sqlcat.com/whitepapers/archive/2008/10/03/running-sql-server-2008-in-a-hyper-v-environment-best-practices-and-performance-recommendations.aspx

    Planning for Consolidation with Microsoft SQL Server 2000

    http://www.microsoft.com/technet/prodtechnol/sql/2000/plan/SQL2KCon.mspx

    SQL Server Consolidation on the 64-Bit Platform

    http://www.microsoft.com/technet/prodtechnol/sql/2000/deploy/64bitconsolidation.mspx

     

  • SQL Server 2005 Clustering Tips/References

    I have copied this over from an older blog. I have cleaned it up a bit to clarify a few areas and added some links.

    SQL Server 2005 Clustering Tips/References

    This information will supplement the clustering information I wrote in chapter 10 of SQL Server 2005 Practical Troubleshooting: The Database Engine  

    — Handy cluster related info

    select SERVERPROPERTY(‘IsClustered’) as _1_Means_Clustered

    , SERVERPROPERTY(‘ComputerNamePhysicalNetBIOS’) as CurrentNode

    , SERVERPROPERTY(‘Edition’) as Edition

    , SERVERPROPERTY(‘MachineName’) as VirtualName

    , SERVERPROPERTY(‘InstanceName’) as InstanceName

    , SERVERPROPERTY(‘ServerName’) as Virtual_and_InstanceNames

    , SERVERPROPERTY(‘ProductVersion’) as Version

    , SERVERPROPERTY(‘ProductLevel’) as VersionNameWithoutHotfixes

    select * from sys.dm_io_cluster_shared_drives

    select * from sys.dm_os_cluster_nodes

    Best practices

    Setup (RTM, Service Pack, Cumulative Update, or hotfix)

    ·         The account you use to launch setup must be a local admin on all nodes. However, it is not required that the account you choose to assign as the service account for each service be a local admin. Only setup requires local admin permissions.

    ·         Install and cluster DTC before installing any SQL instance. For Windows 2003, DTC should ideally go in its own group with its own disk and IP address. Second best is to place it in the cluster group and make it depend on the quorum disk and IP address. For Windows 2008 see this blog.

    ·        For SQL 2005, the client tools, SSIS, NS, and RS are only installed on the node where setup was run because they are not cluster aware. If you are installing as many or more instances than nodes, you can run the install program for each instance from a different node so the non cluster aware components are installed on each node. Otherwise install the non cluster aware components later on the other node(s). This means that the service packs and hotfixes must be installed on each node as well so that the non cluster aware components are updated. Setup is run once per instance and that will update all the cluster aware and components for that instance. The first time setup (RTM, SP, hotfix) is run from each node it will also update any non cluster aware components on the box such as the tools, SSIS, NS, and RS.

    ·         All nodes should be configured identically.

    ·         Windows level policies should be the same on all nodes.

    ·         Remote Registry, Cryptography services, and Task scheduler must be started on all nodes during the setup process.

    ·         No Terminal Services users can be logged in on any remote nodes during setup.

    ·         Do not use quotes in the password for SQL service account.

    ·         Do not allow <, >, ‘, “, & in the cluster group names.

    ·         Virtual Server name should be 14 characters or less.

    ·         NIC name cannot have trailing spaces.

    ·         Stop any non-essential applications or services as they may hold open files that setup needs to modify or may otherwise interfere with setup.

    ·         All nodes must have access to setup files without prompting for credentials.

    ·         All disks in all groups must be online during setup.

    ·         All other, existing instances in the cluster must have valid, non-UNC paths for the SQL Server registry keys

    ·         If there are many trusts for the domain the nodes/service account reside in, see KB 910070 before running setup

    ·         For Windows 2003, the complete node must be on HCL, for Windows 2008 each node in the cluster must pass a validation.

    ·         Copy the setup files to the “primary” node or at least make sure all nodes can access the setup files without being prompted for credentials.

    ·         Any mounted drives must have an associated drive letter and be clustered, even if they will not be used by SQL Server. Do not use mounted drives anywhere on a cluster if SQL Server 2000 will exist in the cluster. A mounted drive must be in SQL resource group and SQL Server must depend on them if you want that instance of SQL Server to use them for data or log files.

    ·         Verify you have not installed terminal services, there are no compressed drives, and no node is a domain controller.

    ·         Disable netbios on private NICs.

    ·         Pre-create the domain groups needed by setup.

    ·         Make sure the SQL Server resource is set to “affect the group”. Often it’s best to leave SQL Agent, FTS, and DTC to not “affect the group” but that depends on your business needs.

    ·         Test failover of all groups before any SQL setup, test again before any service packs or hotfixes. If any group gets an error during failover, address that problem before running SQL setup.

    After setup

    ·         Go back to the cluster administrator and take the SQL Server resource offline. Make SQL Server dependent on the disk(s) and mount points in their group (any disk or mount point where you need to create data files, log files, or full text catalogs) then bring SQL Server, SQL Agent, and FTS back online.

    ·         For the SSIS service, %ProgramFiles%Microsoft SQL Server90DTSBinnMsDtsSrvr.ini.xml must have the SQL virtual server name instead of “.”

    ·         Configure memory to handle instances moving due to failover.

    ·         If you installed NS, you now have to configure it separately.

    ·         Leave SQL services set to manual in the services applet.

    Maintenance

    ·         Use add/remove programs to add/remove nodes.

    ·         Add/remove non-cluster aware components must be done from cmd line.

    ·         Can rename the virtual server name but not the instance name.

    ·         Make IP changes in cluster admin instead of setup.

    ·         Cluster service account must have a login in SQL, must be sysadmin only for FTS.

    ·         Clustered SQL Server startup account can only be a local admin if SQL 2000/7.0 is not installed side-by-side with 2005. Even if a lower version is not installed side-by-side it is best not to make the SQL Server startup account a local administrator or otherwise give it excessive permissions.

    ·         After adding new node, fail to that node to  apply SPs/hotfixes.

    ·         For Kerberos on a cluster, you need two SPNs per instance, one with and one without the port. They must belong to the current SQL Server startup account and not to any other accounts.

    ·         If you use SSL encryption, install certificates on all nodes before turning on the SSL encryption.

    ·         If antivirus is installed, see http://support.microsoft.com/kb/250355

    References:

    ·         Updated Books Online: http://www.microsoft.com/downloads/details.aspx?FamilyId=BE6A2C5D-00DF-4220-B133-29C1E0B6585F&displaylang=en

    ·         915846  Best practices that you can use to set up domain groups and solutions to problems that may occur when you set up a domain group when you install a SQL Server 2005 failover cluster http://support.microsoft.com/default.aspx?scid=kb;EN-US;915846

    ·         819546  SQL Server 2000 and SQL Server 2005 support for mounted volumes http://support.microsoft.com/default.aspx?scid=kb;EN-US;819546

    ·         913815  Error message when you install a SQL Server 2005 failover cluster on a node: “The drive specified cannot be used for program location” http://support.microsoft.com/default.aspx?scid=kb;EN-US;913815

    ·         922670  How to use the Add or Remove Programs item in Control Panel to add or remove components for stand-alone installations and clustered installations of SQL Server 2005 http://support.microsoft.com/default.aspx?scid=kb;EN-US;922670

    ·         910230  How to install SQL Server 2005 Analysis Services on a failover cluster http://support.microsoft.com/default.aspx?scid=kb;EN-US;910230

    ·         910233  Migrate a SQL Server 2000 Analysis Services cluster to a SQL Server 2005 Analysis Services cluster http://support.microsoft.com/default.aspx?scid=kb;EN-US;910233

    ·         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 http://support.microsoft.com/default.aspx?scid=kb;EN-US;912397

    ·         910851  You receive error messages when you try to set up a clustered instance of SQL Server 2005 http://support.microsoft.com/default.aspx?scid=kb;EN-US;910851

    ·         926621  Error message when you try to install SQL Server 2005 in a cluster environment: “SQL Server Setup could not validate the service accounts” http://support.microsoft.com/default.aspx?scid=kb;EN-US;926621

    ·         327518  The Microsoft SQL Server support policy for Microsoft Clustering http://support.microsoft.com/default.aspx?scid=kb;EN-US;327518

    ·         254321  Clustered SQL Server do’s, don’ts, and basic warnings http://support.microsoft.com/default.aspx?scid=kb;EN-US;254321

    ·         942176  Description of the SQL Server Integration Services (SSIS) service and of alternatives to clustering the SSIS service http://support.microsoft.com/default.aspx?scid=kb;EN-US;942176

    ·         922209  The SQL Server 2005 Setup program does not remove all IP address cluster resources when you uninstall SQL Server 2005 http://support.microsoft.com/default.aspx?scid=kb;EN-US;922209

    ·         295732  How to create databases or change disk file locations on a shared cluster drive on which SQL Server was not originally installed http://support.microsoft.com/default.aspx?scid=kb;EN-US;295732

    ·         263712  How to impede Windows NT administrators from administering a clustered instance of SQL Server http://support.microsoft.com/default.aspx?scid=kb;EN-US;263712

    ·         932881  How to make unwanted access to SQL Server 2005 by an operating system administrator more difficult http://support.microsoft.com/default.aspx?scid=kb;EN-US;932881

    ·         934749  BUG: Error message when you try to install SQL Server 2005 Service Pack 1 or SQL Server 2005 Service Pack 2 from the existing active node: “The product instance <InstanceName> been patched with more recent updates” http://support.microsoft.com/default.aspx?scid=kb;EN-US;934749

    ·         283811  How to change the SQL Server or SQL Server Agent service account without using SQL Enterprise Manager in SQL Server 2000 or SQL Server Configuration Manager in SQL Server 2005 http://support.microsoft.com/default.aspx?scid=kb;EN-US;283811

    ·         910070  FIX: The SQL Server 2005 Setup program may take much longer than expected to finish running http://support.microsoft.com/default.aspx?scid=kb;EN-US;910070

    ·         909967  How to uninstall an instance of SQL Server 2005 manually http://support.microsoft.com/default.aspx?scid=kb;EN-US;909967

    Windows 2003 SP2 is better than SP1 because:

    ·         918483  How to reduce paging of buffer pool memory in the 64-bit version of SQL Server 2005 http://support.microsoft.com/default.aspx?scid=kb;EN-US;918483

    ·         922658  SQL Server 2000 or SQL Server 2005 may temporarily stop responding on a Windows Server 2003 Service Pack 1-based computer http://support.microsoft.com/default.aspx?scid=kb;EN-US;922658

    ·         904160 Network performance is slower than expected in Windows Server 2003 SP1 http://support.microsoft.com/?id=904160

    Cluster specific:

    ·         923830  Recommended hotfixes for Windows Server 2003 Service Pack 1- based server clusters http://support.microsoft.com/default.aspx?scid=kb;EN-US;923830

  • What to know before you choose a SQL Server Disaster Recovery and/or High Availability solution

    Why disaster recovery planning matters:

    ·         Do you know what your plans are to recover from various data losses? Have you ever tested those plans? Can they be implemented within your Service Level Agreements (SLA)? Are you confident your plans cover the most likely and/or most painful types of data losses?

    ·         Who gets to explain to the CEO and potentially the press why you were down for X hours more than the agreed upon SLA or why you were never able to recover your customers’ data at all? If it’s not you and your department that does the explaining directly, you can still bet you’ll be grilled by the person who does get to do the talking.

    ·         What will happen to the business if there’s a large and possibly catastrophic data loss to one or maybe even multiple sites? What will happen to your job?

    Methodology:

    ·         Decide what you would like to protect against. Examples: hardware failures (disk, CPU, memory, etc.), loss of server, loss of server room (flooding for example), loss of electric grid in a city or section of country, malicious attack (internal or external), accidental data loss (delete wrong rows, drop database), etc. You may want to do a probability/impact matrix.

    ·         Decide how much downtime you can afford per type of potential downtime. For example, if it’s an electrical outage expected to last one day, will you bring up all systems on generators or bring up remote locations. It’s possible that with a bigger loss you may be able to have a longer acceptable downtime. If the entire city is without power people may expect that they won’t be able to do business locally. But they may expect that their data is available at other sites during the local outage (their last bank transaction, the prescription they just dropped off, the fantasy game predications they just entered).

    ·         Decide how much data you can afford to lose. Can you reenter the last X minutes/hours/days worth of data or must you be able to save every byte? What is the level of acceptable loss within your budget?

    ·         How long do you need to keep data backups? If there’s an accidental data loss that is not discovered for X amount of time, what will you do? What if you find out backups have been failing for the last 3 weeks and for some reason no one knew about it, but all the older backups are gone and you’ve lost the current database?

    ·         Once a system is taken offline, is there still a chance you’ll be asked to recover data from it? For example, regulatory requirements might demand that you be able to pull up data from 7 years ago, even if you only migrated only the most recent year from the obsolete system to your current system. Will you have the hardware, software, and operational expertise to restore an older backup taken from a system on what is now outdated hardware and software?

    ·         Once you know what you need to protect against, you can begin to consider technical and resource considerations that will help you meet those goals. This includes frequent testing of whatever technologies and processes you put into place. There will be many tradeoffs in cost vs. functionality. It would be astronomically expensive to protect against all types of potential failures, the business has to decide where to draw the line. The planning should be revisited periodically to make sure it still meets your needs and that it is still working properly (based on your testing).

    ·         Once you decide on technologies, then you can develop policies, procedures, and responsibility (departments/groups and/or people) guidelines. This is at least as important as the technologies you choose. This will include how to implement the technology on existing and forthcoming systems and monitoring the system as well as periodic testing. The testing must include the entire process across all responsible groups or it isn’t complete/accurate.

    ·         Determine who is responsible for making sure this is done initially and who is responsible for making sure it is revisited periodically.

    SQL Server 2008

    ·         High Availability http://www.microsoft.com/sql/techinfo/whitepapers/SQL_2008_HA.mspx

    ·         Always On http://download.microsoft.com/download/c/a/f/caff7135-8d80-4dad-a104-0da8558d8a0e/Availability%20DataSheet.pdf

    SQL Server 2005

    SQL Server 2000

    Technical options/considerations:

    ·         RAID arrays to reduce disk failure problems. RAID 10 is generally the best across the board.

    ·         Clustering to reduce failures from non-disk hardware problems (this can be local or geographically dispersed).

    ·         Mirroring or log shipping to protect against various types of failures (various levels/options are available).

    ·         Replication to provide concurrently usable copies of some data on another server (you must build your own recovery methods, there is not anything built in). You have to consider recovery from loss of publisher(s), distributor, and subscribers and scenarios that require a reinitialization.

    ·         Backups, which should include frequent testing of the entire restore process, both from a technology and personnel/procedure perspective. You also have to make a wise decision on full, differential, and tran log backup frequency and retention as well as compression. Point in time recovery might be an option for incorrect data updates (malicious or accidental) but may be difficult to across multiple databases. The media (local disk, remote disk/same room, very remote disk/different location, tape/dvd) should also be considered. The frequency is important and may vary depending on the time of day or even time of year. Are the backups themselves protected from loss, theft, and corruption?

    ·         Various recovery models and settings in the databases.

    ·         Database snapshots have a limited potential role is very specific scenarios (maybe to protect against accidental data loss where you would know about the problem very quickly).

    ·         Be able to consolidate various systems on one set of hardware (if sufficient hardware cannot be found, you may have to run a 2nd system on an existing server). This may involve a 2nd instance or just another set of databases on an existing instance. There may be issues to consider with sync’ing logins/users either across domains or if you combine two instance’s worth of databases into a single instance. Will you combine databases from different versions? This goes into the bigger issue of knowing when you can recover in the same location and/or hardware vs. new hardware/location. This could involve Virtual Server or the Hyper-V virtualization features in Windows 2008.

    ·         You should plan to run DBCCs on your backups to make sure they are valid.

    ·         Available disk space plays a big part in some of these decisions.

    ·         Consistency of names, disk layouts, configuration, etc. can make recovery simpler. Regardless of planned consistency, you need to have metadata, login/user, and configuration information available remotely separately from the backups (or at least know/practice how to get the necessary data from the backups).

    ·         For a warehouse or Analysis Services database, you will need to have the ability to rebuild from the source data. The warehouse or AS database may have to re-populated when the design changes which requires that the source data still be available.

    ·         Do you have the media available to apply the exact same OS, firmware, SQL Server, etc. versions including hotfixes, editions, and x86 vs. x64 vs. IA64? Do you have a way to track exactly what version/hotfix level is needed?

    ·         What about other applications on the box, especially those that rely on SQL Server? Do you have a recovery plan for Sharepoint, Project Server, BizTalk, Performance Point, or whatever applications you run against SQL Server databases?

    ·         What if you can’t restore one or more of the system databases, do you have enough information saved off (ids, password, job schedules, linked servers, etc.) to be able to rebuild the system so you can use the user databases you did have saved?

    Non-technical considerations:

    ·         How often can you afford to test the restore process (this is a very important step and the proper resources should be dedicated to it, weigh the costs of testing against the costs if you cannot restore the data for some reason). This will probably involve training each time as people move through various positions/responsibilities and the technology changes over time as well.

    ·         Define general priorities in case multiple systems fail at once (such as a big storm or a malicious attack). You won’t necessarily have the hardware, bandwidth, or personnel available to restore everything at once. Where do you start?

    ·         Are your SLAs realistic? Well-documented?

    ·         Make sure the planning process is revisited at least once a year (preferably more often), including verifying that testing is still occurring and succeeding.

    ·         Have well-defined procedures for reacting in a timely, preferably automated fashion to technical failures (such as the backups failing due to lack of disk space or one disk in a RAID 5 array failing).

    ·         Will your plan facilitate/complement population of your QA or development environment? Will it facilitate/compliment the plan to rollout new systems?

    ·         How will you detect a problem? DBCCs, users reporting problems, etc.

    ·         Document completely and clearly and make sure more than one person knows where the documents and passwords are and more than one person practices implementing them. This is a very important process and you cannot afford to leave it in one person’s hands in case that person is not available at the time of a disaster.

    ·         Document why you didn’t implement the options you choose not to use. For example, maybe you’ll choose not to implement option X because it would put you over budget or you chose technology A over B because it was more important to have quick recovery even if it meant losing a small amount of data.

    ·         Know and document where you are now and where you want and need to be.

    ·         Know your executive sponsors and make sure they understand the tradeoffs in the system.

  • SQL Server 2005/2008 Now Supports Guest Clustering in a Virtual Machine!

    Technorati Tags: ,

    Guest clustering in a Virtual Machine for SQL Server has been a hotly requested feature for quite some time, and as of today it is officially supported! See the below links from Bob Ward for the exact details. Basically the guest OS has to be Windows 2008 or higher, SQL Server has to be version 2005 or higher, everything must pass the cluster validation tests, and the virtualization software has to be supported for SQL Server (for most of us that means Hyper-V and some versions of VMWare). So test it out and tell us your implementation stories!

    SQL Server Support Policy for Failover Clustering and Virtualization gets an update…

    Support policy for Microsoft SQL Server products that are running in a hardware virtualization environment