Sunday, November 30, 2014

MS SQL Server DBA Checklist - High Availability Best Practices

MS SQL Server DBA Checklist - High Availability Best Practices

-- Physically protect your SQL Servers from unauthorized users.
-- Physically document all of your SQL Server instances. Incorporate effective change management.
-- Always use a RAIDed array or SAN for storing your data.
-- Use SQL Server clustering, database mirroring, or log shipping to provide extra fault tolerance.
-- Replication is not an effective means to protect your data.
-- Ensure that your entire IT infrastructure is redundant. It is only as strong as its weakest link.
-- Always use server-class hardware, and standardize on the same hardware as much as possible.
-- Use hardware and software monitoring tools so you can quickly become aware of when problems first arise.
-- After testing, apply all new service packs and hot fixes to the OS and SQL Server.
-- Cross-train staff so that there are multiple people who are able to deal with virtually any problem or issue.

MS SQL Server DBA Checklist - High Availability - Log Shipping

-- If you don’t currently employ clustering or database mirroring for your SQL Servers because of cost, consider employing log shipping to help boost your high availability. It provides reasonably high availability at low cost.
-- If you take advantage of SQL Server log shipping capability, you will want to keep the log shipping monitoring service on a SQL Server of its own, not on the source or destination servers participating in log shipping. Not only is this important for fault tolerance, but because the log shipping monitoring service incurs overhead that can affect the performance of the source and destination servers.
-- Monitor log shipping daily to ensure that is working successfully.
-- Learn what you need to know to fix log shipping if synchronization is lost between the production and backup databases.
-- Document, and test your server recovery plan, so you will be ready in case of a server failure.

MS SQL Server DBA Checklist - General – Replication

-- Replication needs should be clearly defined before creating a replication topology. Successful replication can be difficult and requires much pre-planning.
-- Ideally, publishers, distributors, and subscribers should be on separate physical hardware.
-- Create, document, and test a backup and restore strategy. Restoring replicated databases can be complex and requires much planning and practice.
-- Script the replication topology as part of your disaster recovery plan so you can easily recreate your replication topology if needed.
-- Use default replication settings, unless you can ensure that a non-default setting will actually improve replication performance or other issues. Be sure that you test all changes to ensure that they are as effective as you expect.
-- Fully understand the implications of adding or dropping articles, changing publication properties, and changing schema on published databases, before making any of these changes.
-- Periodically, validate data between publishers and subscribers.
-- Regularly monitor replication processes and jobs to ensure they are working.
-- Regularly monitor replication performance, and performance tune as necessary.
-- Add alerts to all replication jobs so you are notified of any job failures.
  
MS SQL Server DBA Checklist - High Availability - SQL Server Mirroring

-- The principal database and the mirror database should be on separate physical hardware, and ideally, in different physical locations.
-- The witness server should be on separate physical hardware, and be on a separate network (best if at a third location).
-- Initial database mirroring setup should be done during less busy times, as the setup process can negatively affect performance of the production database being mirrored.
-- Use high availability mode whenever possible, and high performance mode only when required.
-- While a fast connection is not required between mirrored servers, the faster the connection, and the better quality the connection, the better.
-- You will want to optimize the performance of the mirrored database as much as possible to reduce the overhead caused by the mirroring process itself.
-- Thoroughly test database mirroring before putting it into production.
-- Monitor database mirroring daily to ensure that it is working properly, and is meeting performance goals.
-- Develop a formal operational and recovery procedure (and document) to support mirroring. Periodically test the failover process to ensure that it works.

MS SQL Server DBA Checklist - High Availability – Clustering

-- Detailed planning is critical to the success of every SQL Server cluster installation. Fully plan the install before performing the actual install.
-- An expensive cluster is of little value if the supporting infrastructure is not also fault tolerant. For example, don’t forget power redundancy, network redundancy, etc.
-- Run only a single instance of SQL Server per node. Whether you have two or eight nodes in your cluster, leave at least one node as a failover node.
-- Cluster nodes must not be domain controllers, and all nodes must belong in the same domain and should have access to two or more domain controllers.
-- Since clustering is not designed to protect data (only SQL Server instances), the shared storage device used by the cluster must incorporate fault tolerant technology. Consider log shipping or mirroring to further protect your production databases.
-- When initially installing Windows and SQL Server Clustering, be sure that all drivers and software are up-to-date, including the latest service packs or hot fixes.
-- Each node of a cluster should have identical hardware, drivers, software, and configuration settings.
-- Once the cluster has been installed, test it thoroughly for every possible failure scenario.
-- Do not run antivirus or antispyware on a SQL Server cluster.
-- Monitor active production clusters on a daily basis, looking for any potential problems. Periodically test failover on production servers to ensure all is working well.
-- Once you have a stable SQL Server Cluster running, be very leery about making any changes to it, whatsoever.



MS SQL Server DBA Checklist


MS SQL Server DBA Checklist - General DBA Best Practices


-- Join (or start) a local SQL Server users group 
-- Attend at least one professional conference each year.
-- Attend at least one training session each year.
-- Read at least four books on SQL Server each year.
-- Read the free e-book, How to Become an Exceptional DBA
-- Learn everything you can about your job, especially those areas that nobody else likes or wants to master.
-- Volunteer at your work for new and challenging tasks that will make you known throughout your organization.
-- Install SQL Server on a laptop or desktop computer at home and practice learning new aspects of SQL Serve.
-- Participate in SQL Server forums (asking and answering questions)
-- Become a Microsoft Certified IT Professional

MS SQL Server DBA Checklist - General - Day-to-Day

-- Check OS Event Logs, SQL Server Logs, and Security Logs for unusual events.
-- Verify that all scheduled jobs have run successfully.
-- Confirm that backups have been made and successfully saved to a secure location.
-- Monitor disk space to ensure your SQL Servers won’t run out of disk space. For best performance, all disks should have 20% or more of free space.
-- Throughout the day, periodically monitor your server’s performance. Use System Monitor, Profiler, DMVs, or the SQL Server 2008 Performance Data Collector
-- Use Management Studio or Profiler to help monitor and identify blocking issues.
-- Keep a log of any changes you make to servers, including documentation of any performance issues you identify and correct.
-- Create SQL Server alerts to notify you of potential problems, and have them e-mailed to you. Take action as needed.
-- Take some time to learn something new as a DBA to further your professional development.

MS SQL Server DBA Checklist - General – Installation

-- Always fully document installs so that your SQL Server instances can easily be reproduced in an emergency.
-- If possible, install and configure all of your SQL Server instances consistently, following an agreed upon organization standard. Optionally use SQL Server 2008 Policy-based Management to enforce standards.
--. Don't install SQL Server services you don't use, such as Microsoft Reporting Services or Analysis Services, if you won’t be using them. -- For best performance of SQL Server running under Windows, turn off any operating system services that aren't needed.
-- For optimum SQL Server performance, dedicate your physical servers to only running a single instance of SQL Server, no other applications.
-- For best I/O performance, locate the database files (.mdf) and log files (.ldf) on separate volumns on your server to isolate potentially conflicting reads and writes.
-- If tempdb will be used heavily, also put it on its own separate array. In addition, pre-size tempdb to a size that will meet your server’s needs without having the need to autogrow. Divide the tempdb database into multiple files so that the number of files is equal to 50% to 100% of the number of CPU cores in your servers. Each physical file must be the same size.
-- Do not install SQL Server on a domain controller.
-- Don’t use NTFS data file encryption (EFS) and compression on SQL Server database and log files.


MS SQL Server DBA Checklist - General – Upgrading

-- Run the Upgrade Advisor on any database you intend to upgrade to identify potential problems.
-- Before performing an upgrade to SQL Server, thoroughly test your application in a test environment to ensure compatibility. Make any necessary changes before performing the upgrade.
-- Before you upgrade, be sure you have a plan in place to fall back to in case the upgrade is problematic.
-- While upgrading in place can work well, it is less risky to upgrade to new hardware with a fresh install of the OS and SQL Server.
-- If you upgrade from a previous version of SQL Server, you should update all of the statistics in all your databases using UPDATE STATISTICS. This is because statistics are not automatically updated during the upgrade process. In addition, run DBCC UPDATEUSAGE on all databases to correct any incorrect row or page counts.

MS SQL Server DBA Checklist - General – Security

-- Ensure the physical security of each SQL Server, preventing any unauthorized users from physically access your servers.
-- Only install required network libraries and network protocols on your SQL Server instances.
-- Minimize the number of sysadmins allowed to access SQL Server.
-- As a DBA, log on with sysadmin privileges only when needed. Create separate accounts for DBAs to access SQL Server when sysadmin privileges are not needed.
-- Assign the SA account a very obscure password, and never use it to log onto SQL Server. Use a Windows Authentication account to access SQL Server as a sysadmin instead.
-- When assigning permissions to users, only give them the minimum permissions they need to perform their jobs.
-- Use stored procedures or views to allow users to access data instead of letting them directly access tables.
-- When possible, use Windows Authentication logins instead of SQL Server logins.
-- Use strong passwords for all SQL Server login accounts.
-- Don’t grant permissions to the public database role.
-- Remove user login IDs who no longer need access to SQL Server.
-- Remove the guest user account from each user database.
-- Disable cross database ownership chaining if not required.
-- Never grant permission to the xp_cmdshell to non-sysadmins.
-- Use Windows Global Groups, or SQL Server Roles to manage groups of users that need similar permissions.
-- Avoid creating network shares on any SQL Server.
-- Turn on login auditing so you can see who has succeeded, and failed, to login. In SQL Server 2008, you can use SQL Server Audit instead. -- Don’t use the SA account, or login IDs who are members of the Sysadmin group, as accounts used to access SQL Server from applications. -- Ensure that your SQL Servers are behind a firewall and are not exposed directly to the Internet.
-- Remove the BUILTIN/Administrators group to prevent local server administrators from being able to access SQL Server. Before you do this on a clustered SQL Server, check Books Online for more information.
-- Run each separate SQL Server service under a different Windows domain account.
-- Only give SQL Server service accounts the minimum rights and permissions needed to run the service. In most cases, local administrator rights are not required, and domain administrator rights are never needed. SQL Server setup will automatically configure service accounts with the necessary permissions for them to run correctly, you don’t have to do anything, with one possible exception. You may want to give the SQL Server service account SE_MANAGE_VOLUME_NAME rights so that instant file initialization can be used for SQL Server 2005/2008. This is only required if the SQL Server service account is not a member of the local administrator’s group.
-- When using distributed queries, use linked servers instead of remote servers.
-- Do not browse the web from a SQL Server.
-- Instead of installing virus/antispyware protection on a SQL Server, perform scans from a remote server during a part of the day when user activity is less.
-- Add operating system and SQL Server service packs and hot fixes soon after they are released and tested, as they often include security enhancements.
-- Encrypt all SQL Server backups with a third-party backup tool, such as SQL Backup Pro. If you have SQL Server 2008, Enterprise Edition, you can use Transparent Data Encryption to ensure encrypted backups.
-- Only enable C2 auditing or Common Criteria compliance if required.
-- SQL Server 2008 includes a new built-in auditing tool called SQL Server Audit. It can be used to audit virtually any user activity. Keep the number of activities and objects you audit to a minimum to reduce performance overhead.
-- Consider running a SQL Server security scanner against your SQL servers to identify security holes.
-- If using SQL Server 2005/2008, enable password policy checking.
-- If running SQL Server 2008, Enterprise Edition, consider implementing Transparent Data Encryption to help protect data stored on disk.

MS SQL Server DBA Checklist - General - Job Maintenance

-- Avoid overlapping jobs on the same SQL Server instance. Ideally, each job should run separately at different times.
-- When creating jobs, be sure to include error trapping, log job activity, and set up alerts so you know instantly when a job fails.
-- Create a special SQL Server login account whose sole purpose is to run jobs, and assign it to all jobs.
-- If your jobs include Transact-SQL code, ensure that it is optimized to run efficiently.
-- Periodically (daily or weekly) run a database rebuild or reorganize job on all the indexes on all the tables in all your database. This will rebuild the indexes so that the data is no longer logically fragmented. Fragmented data can cause SQL Server to perform work, slowing down SQL Server's performance. Rebuilding or reorganizing tables will also update column statistics.
-- . As often as you take full backups, which is probably once a day, run DBCC CHECKDB on your databases to verify database integrity.
-- Avoid running most DBCC commands during busy times of the day. These commands are often I/O intensive and can reduce performance of the SQL Server, negatively affecting users.
-- Script all jobs and store these scripts in a secure area so they can be used if you need to rebuild the servers.



MS SQL Server DBA Checklist - General - SQL Server Configuration Settings

-- SQL Server configuration settings should remain at their default settings. Any changes to these settings should only be made by an experienced DBA who understands the pros and cons of making changes.
-- If you are using the 32-bit version of SQL Server, and if you are using 4 GB or more of RAM, ensure that you have all the AWE settings correctly set.


MS SQL Server DBA Checklist - General - Database Settings

-- Database settings should generally be kept at their default values. Ensure that the following settings are set for overall best performance: These are default settings:
* Auto Create Statistics: On
* Auto Update Statistics: On
* Auto Shrink: Off
* Page Verify: Checksum 
-- Don’t rely on AUTOGROWTH to automatically manage the size of your databases. Instead, proactively monitor and alter database size as circumstances dictate. Only use AUTOGROWTH to deal with unexpected growth.