|
Top 10
SQL Server Do's and Don'ts
Do’s
1. DO perform database maintenance regularly.
2. DO monitor processor, memory, disk performance and free space,
network and key SQL Server performance and log performance counters.
3. DO place tempdb data files, all user database files and all
transaction logs on separate physical disks from each other.
4. DO allocate adequate memory for SQL Server and monitor Page Life
Expectancy to detect memory pressure.
5. DO have a backup plan and practice disaster recovery. Understand
the different types of recovery models and regularly back up
databases and transaction logs.
6. DO allocate enough free space within data and log files to
prevent autogrowth.
7. DO monitor and log long running queries.
8. DO place a clustered index on all tables in a database.
9. DO monitor for failed logins.
10. DO configure failed job alerts to send e-mail messages to
support staff.
Honorable mention:
11. DO archive or remove old data from production databases.
12. DO index temporary tables.
13. DO use fully qualified naming when referring to objects (db.owner.object
and owner.object) in code.
14. DO use SET NOCOUNT ON in each stored procedure.
15. DO substitute EXISTS for IN in code.
Don’ts
1. DON’T allow users or application to access the databases or
server as sa.
2. DON’T allow untested changes in the production environment.
3. DON’T allow test or development databases in the production
environment.
4. DON’T backup databases to the logical disks where the data files
are stored.
5. DON’T apply hotfixes unless necessary. Make sure to test any
hotfixes if they must be applied.
6. DON’T create stored procedures with “sp_” as the prefix of the
name.
7. DON’T turn on the AUTOSHRINK option on production databases.
8. DON’T allow overlapping or duplicate indexes.
9. DON’T allow index hints unless absolutely necessary or table
hints unless properly tested.
10. DON’T over-normalize databases.
Honorable mention:
11. DON’T allow cursors in code when a set based operation would do
as well.
12. DON’T disable AUTOSTATS for a database unless absolutely
necessary.
13. DON’T allow SELECT * in code.
14. DON’T allow code that creates fragmentation (such as creating a
table with blank VARCHAR or NVARCHAR columns then populate with an
UPDATE statement).
|
|
|