Documente Academic
Documente Profesional
Documente Cultură
Guidelines
SQL Server Database Operations
Document ID
IMS-DBA-SQL-TD-019-1.0
Document Name
Document Version
Version 1.0
Purpose
The documents outline the standard best practices and guidelines for
managing SQL Server Databases.
Document Owner
Last Updated By
Kondapally Narasimharao
Last Updated On
Reviewed By
Raj Gartia
Date
Comment
Edited by
Reviewed By
1.0
10/04/2015
Initial Document
Narasimharao
Raj Gartia
Definition
Use the latest SQL Server version with latest SP & Hot Fixes (recommended)
Dont upgrade unless you have a good reason to upgrade. If your instance is working well,
dont mess with it.
For example, upgrade if you need new features, or have problems with an old installation, or
need to upgrade hardware.
Dont give users more permissions than they need to perform their job.
If the SQL server is in domain and domain accounts are provisioned, disable the SA
account. Assign the domain account sysadmin role for complete server administration.
If SQL server is not in domain, assign it a complex password for the SA account. Share the
password with the Server Administrators only and keep it handy just in case required.
Most of the applications required only DB Owner permissions for full functionality. Hence
dont allow an application to use the SA or a sysadmin account to access SQL Server unless
its a mandatory requirement. Create security exceptions and logging enabled for such
application accessing SQL Server
Ensure that right access to perform the required action as per the role and responsibility is
assigned to the users. The default rule minimum privileges are to be granted which are just
sufficient to carry out the task"
Log off or lock your SQL Server (or workstation) when done.
Ideally, SQL Server instances should run on a stand-alone server (physical or virtual) with
no other apps running on it.
Multiple instances must be installed post proper capacity and resource planning. If there is a
resource intensive database, hosting multiple instances on the host must be avoided.
Virtualization could be considered as an option of hosting multiple Servers
Memory
Processors
Security
Connections
Database Settings
Advanced
Permissions
5. Memory Configuration
Wherever possible, use 64-bit hardware and the 64-bit version of the OS and SQL Server.
If using 64-bit memory, turn on Lock Pages in Memory, and let the instance dynamically
manage its own memory (especially 2008)
Do not limit the MIN and MAX memory configurations. Let SQL decide this at runtime. These
must be set only if we deserve to specifically dedicate / limit memory allocation for a SQL
Instance.
Ensure that the page file set is appropriate as per the Server Configurations.
Remove physical file fragmentation before creating new MDF or LDF files.
When creating new MDFs and LDFs, pre-size them to minimize auto growth events.
BAK and TRN backup files should be located on their own disks i.e. Ensure that the data,
log and backups are located on the separate disks.
7. Tempdb Management
Pre-size tempdb, so auto growth doesnt have to happen often (8MB is default, which is very
low).
Set auto growth to avoid many growth spurts, use a fixed amount that minimizes auto
growth use. (10% is default, which causes lots of auto growth).
If very active, consider dividing the tempdb into multiple physical files. Multiple temp db files
can be created. The maximum numbere is determined by the number of CPU cores. While
creating multiple tempdb files, it must be ensured that all the files are of same size.
Auto growth: Leave on. Use mainly for catching mistakes. File growth should be managed
manually. Use fixed amount that minimizes auto growth occurrences.
Recovery Mode: Set to full for all production databases so transaction log backups can be
made.
Compatibility Level: Should be set to match current server version, unless there are
compatibility problems.
9. Configuring JobsGeneral
If your server doesnt have any jobs, then there is a problem, as all servers need jobs.
Check jobs daily to verify that they have run correctly (not hung, not run abnormally long,
etc).
If you use the Maintenance Plan Wizard, be careful to use it properly. If not created properly
it can cause performance issues.
If you properly size your MDFs, NDFs and LDFs and have proper backup strategy, then you
should never have to shrink a file.
Do so manually
Reduces resources used for these operations, allowing more important tasks to use
them
Consider reorganizing an index if it is not heavily fragmented (>5% and <= 30%). This is an
online operation and doesnt use a lot of resources. You must update statistics afterwards,
as this is not automatically done for you.
Ideally, you should only rebuild or reorganize indexes that need it. Use
sys.dm_db_index_physical_stats to identify what tables/indexes need to be rebuilt
/reorganized.
If you have a problem, you want to find it as soon as possible to reduce the risk of data loss.
Dont use the DBCC CHECKDB repair option unless you fully understand its implications.
If the size of database is very large, consider running DBCC checkdb on a backup server by
restorig the database. This will minimize the impact on the production database and
operations.
Create a job to perform full backups daily on all system and user production databases, plus
log backups hourly (or smaller intervals as required).
If a database uses the bulk or full recovery model, you must back up the transaction log to
keep in from growing uncontrollably.
Backup using RESTORE WITH VERIFYONLY to help verify backup integrity. (Does not
guarantee good backups.)
Store backups securely and off-site (not on same disk array or SAN).
If you have a limited backup window, or have limited disk space, use backup compression.
Can be a big time saver.
Create a SQL Server Event Alert for all events with a severity of 19 [fatal] and higher.
Consider using a monitoring tool for alerting and proactive monitoring if SQL Server Alerts
doesnt meet all of your needs.
You must create a document that provides a step-by-step details on, how to recover SQL
Servers in the case of any problem, small or large.
Simulate and run the DR tests at frequent intervals and update the documentation with
improvement areas (if any) to be familiarized with the process. This will ensure minimum
downtime and enable meeting RTO criteria in a realtime scenario.
Keep Microsoft SQL Servers Product Support phone number handy. Paste it near your
computer.
disasters
Before you make any change on a production SQL Server, be sure you test it first in a test
environment.
The installation and configuration of any application that uses SQL Server as its back
end (as related to SQL Server).
Troubleshooting tasks, as the same problem may reoccur, and you dont want to
reinvent the wheel.
Any time any change is made to any instance for any reason.
Be sure that documentation is easily available to everyone who needs access to it.