MS SQL - Server Best Practices and Guidelines
-
Upload
er-snehashis-paul -
Category
Documents
-
view
220 -
download
0
Transcript of MS SQL - Server Best Practices and Guidelines
-
7/25/2019 MS SQL - Server Best Practices and Guidelines
1/8
SQL Server Best Practices and
GuidelinesSQL Server Database Operations
Document ID IMS-DBA-SQL-TD-019-1.0
Document Name SQL Server Best Practices and Guidelines
Document Version Version 1.0
Purpose
Te docu!ents outline te standard "est #ractices and $uidelines %or
!ana$in$ SQL Server Data"ases.
Document Owner IMS Data"ase Practice
Last Updated By &onda#all' (arasi!arao
Last Updated On 10tA#ril) *01+
Reviewed By ,a Gartia
-
7/25/2019 MS SQL - Server Best Practices and Guidelines
2/8
IMS Data"ase Services and Solutions
Document Contro ! C"an#e $istory
Version Date Comment %dited by Reviewed By
1.0 100/*01+ Initial Docu!ent (arasi!arao ,a Gartia
&erms and 'bbreviations
&erm ! 'bbreviations De(inition
)* Instaation and Up#radin# SQL Server
Copyright 2015 Tech Mahindra. All rights reserved.2|P a g e
-
7/25/2019 MS SQL - Server Best Practices and Guidelines
3/8
IMS Data"ase Services and Solutions
en installin$ a ne SQL Server instance2-
3se te latest ardare drivers.
3se te latest 4S version it latest SP tat is su##orted.
3se te latest SQL Server version it latest SP 5 6ot 7i8es reco!!ended:
Test and Validate De#lo'!ent. 4nce sta"ili;ed) "e ar' o% !a
-
7/25/2019 MS SQL - Server Best Practices and Guidelines
4/8
IMS Data"ase Services and Solutions
,* -enera Server Con(i#uration
Ideall') SQL Server instances sould run on a stand-alone server #'sical or virtual: it
no oter a##s runnin$ on it.
Multi#le instances !ust "e installed #ost #ro#er ca#acit' and resource #lannin$. I% tere is a
resource intensive data"ase) ostin$ !ulti#le instances on te ost !ust "e avoided.
Virtuali;ation could "e considered as an o#tion o% ostin$ !ulti#le Servers
3nnecessar' SQL Server services sould "e uninstalled or turned o%%.
,e%er to te docu!entation on te %iles to "e e8cluded %ro! antivirus scannin$ as
reco!!ended "' Microso%t Generall' te !d%) nd%) ld% %iles etc.:. on%i$ure te e8ce#tions
%or tis in te Antivirus So%tare.
.* SQL Server Property Settin#
Don=t can$e an' o% te de%ault SQL Server instance-ide con%i$uration #ro#ert' settin$s unless
'ou torou$l' understand te i!#lication o% !aLoc< Pa$es in Me!or')? and let te instance d'na!icall'
!ana$e its on !e!or' es#eciall' *00E:
I% usin$ te F*-"it version o% SQL Server) and i% usin$ / GB or !ore o% ,AM) ensuretat FGB sitc and A !e!or' are correctl' con%i$ured. orrect settin$s de#end on
availa"le ,AM.
Do not li!it te MI( and MA !e!or' con%i$urations. Let SQL decide tis at runti!e. Tese
!ust "e set onl' i% e deserve to s#eci%icall' dedicate li!it !e!or' allocation %or a SQL
Instance.
nsure tat te #a$e %ile set is a##ro#riate as #er te Server on%i$urations.
Copyright 2015 Tech Mahindra. All rights reserved.4|P a g e
-
7/25/2019 MS SQL - Server Best Practices and Guidelines
5/8
IMS Data"ase Services and Solutions
1* Data and Lo# 2ie 0ana#ement
,e!ove #'sical %ile %ra$!entation "e%ore creatin$ ne MD7 or LD7 %iles.
en creatin$ ne MD7s and LD7s) #re-si;e te! to !ini!i;e auto $rot events. MD7 %iles sould "e located on teir on dis
-
7/25/2019 MS SQL - Server Best Practices and Guidelines
6/8
IMS Data"ase Services and Solutions
5* Con(i#urin# 6obs7-enera
I% 'our server doesn=t ave an' o"s) ten tere is a #ro"le!) as all servers need o"s.
Tr' to scedule o"s so te' don=t inter%ere it #roduction. Tr' to #revent o"s %ro! overla##in$.
Set alerts on o"s so 'ou are noti%ied i% te' %ail.
ec< o"s dail' to veri%' tat te' ave run correctl' not un$) not run a"nor!all' lon$)
etc:.
I% 'ou use te Maintenance Plan i;ard) "e care%ul to use it #ro#erl'. I% not created #ro#erl'
it can cause #er%or!ance issues.
)8* Don9t S"rin: 2ies
I% 'ou #ro#erl' si;e 'our MD7s) (D7=s and LD7s and ave #ro#er "ac
-
7/25/2019 MS SQL - Server Best Practices and Guidelines
7/8
IMS Data"ase Services and Solutions
onsider reor$ani;in$ an inde8 i% it is not eavil' %ra$!ented +H and JK F0H:. Tis is an
online o#eration and doesn=t use a lot o% resources. ou !ust u#date statistics a%terards)
as tis is not auto!aticall' done %or 'ou.
Ideall') 'ou sould onl' re"uild or reor$ani;e inde8es tat need it. 3se
s's.d!d"inde8#'sicalstats to identi%' at ta"lesinde8es need to "e re"uilt
reor$ani;ed.
)+* Create Data Corruption Detection 6ob
Ideall') run DB 6&DB as %re@uentl' as #ractical.
reate an a##ro#riate o" to run tis or si!ilar: co!!and2
DB 6&DB NDATABAS(AMN: IT6
(4I(74MSGS) ALL,,4,MSGSO
(ote2 onsider usin$ P6SIAL4(L o#tion %or lar$e or "us' #roduction servers to
reduce run ti!e.
I% 'ou ave a #ro"le!) 'ou ant to %ind it as soon as #ossi"le to reduce te ris< o% data loss.
Don=t use te DB 6&DB re#air o#tion unless 'ou %ull' understand its i!#lications.
I% te si;e o% data"ase is ver' lar$e) consider runnin$ DB cec
-
7/25/2019 MS SQL - Server Best Practices and Guidelines
8/8
IMS Data"ase Services and Solutions
).* Set Up 'erts (or Critica %rrors
reate a SQL Server vent Alert %or all events it a severit' o% 19 %atal and i$er.
6ave alerts sent to 'ou or oever is res#onsi"le %or da'-to-da' !onitorin$.
onsider usin$ a !onitorin$ tool %or alertin$ and #roactive !onitorin$ i% SQL Server Alertsdoesn=t !eet all o% 'our needs.
)/* Create a Disaster Recovery Pan
ou !ust create a docu!ent tat #rovides a ste#-"'-ste# details on) o to recover SQL
Servers in te case o% an' #ro"le!) s!all or lar$e.
Si!ulate and run te D, tests at %re@uent intervals and u#date te docu!entation it
i!#rove!ent areas i% an': to "e %a!iliari;ed it te #rocess. Tis ill ensure !ini!u!
donti!e and ena"le !eetin$ ,T4 criteria in a realti!e scenario.
&ee# Microso%t SQL Server=s Product Su##ort #one nu!"er and'. Paste it near 'our
co!#uter.
,e!e!"er2 Most >disasters? are s!all) suc as a corru#ted data"ase. Bi$ >disasters?
occur ver' rarel') i% ever. But 'ou need to "e #re#ared %or "ot.
)1* &est %veryt"in#
Be%ore 'ou !a