Vous êtes un administrateur, un DBA , un exploitant : bref vous travaillez sur SQL Server, cette session est pour vous. Vous y verrez les Best Practices d’installation, de configuration, d’administration, d’exploitation, de performance et de maintenance. Un condensé du Top 10 à connaitre et qui vous sera utile et pratique pour votre gestion SQL Server au quotidien.
2. SQL Server Best Practices
Le top 10…N
07/02/2012
Nadia Ben El Kadi
Technology Specialist – SQL Server/BI
Microsoft France
3. Agenda
Introduction
Sizing SQL Server
Best Practice Before Installation
Best Practice Installation
Best Practice Post Installation
Database Best Practices
Maintenance Best Practices
Performance Best Practices
Monitoring Best Practices
DBA Administration Tasks /DBA
ToolBox
Consolidation Best Practices
4. Choose the right HW & Server
Server choice depends on many factors
Olap / Oltp / BI
Transactions/sec needs
DB size / Cube size
Concurent users
Network bandwidth
HA / Virtu / Conso
Storage type
Ask your HW vendor : They have sizers for SQL
Dell : SQL Advisor
HP Sizer for SQL Server
Etc…
SQL Server Appliance now available
FastTrack (HP Bull, Emc, IBM, Cisco, Dell)
,
PDW (HP Dell)
,
Business Decision Appliance (HP BI Appliance)
DB Consolidation Appliance (HP) --- based on hyperV/SystemCenter
OLTP Appliance : coming soon
5. IO Best Practices for SQL Server
Basics for SQL - Types of IO :
Read vs Write
Sequential vs random
For OLTP: write-intensive & Random access
Generally random for both reads & writes against data
files.
Log writes are sequential in nature
For OLAP : mostly reads operation & sequential access
Reads and writes tend to be sequential in nature
6. Summarized I/O Activity of RAID Levels and Their Recommended Use
http://technet.microsoft.com/en-us/library/cc966414.aspx
RAID Levels RAID0 RAID1 RAID5 RAID10
Reliability Lowest. Very good. Good. Excellent.
Lack of fault tolerance results in data loss. Even better with duplexing. Can tolerate single machine fault.
Storage Efficiency 100% 50% >50%, <100% 50%
(#drives -1/#drives)
Random Read Excellent Fair Excellent. Excellent.
Worst of the RAID levels but better than a single drive.
Random Write Excellent. Fair. Fair. Very good.
Worse than a single drive but better than some RAID levels. Generally better with larger stripe sizes.
Sequential Read Excellent. Fair. Very good. Excellent.
Comparable to a single drive. Generally, better with smaller stripe sizes
Sequential Write Excellent. Good. Fair. Very good.
Better than other RAID levels.
Cost Lowest. Moderate. Moderate. High.
Relatively high cost due to redundant drives; however, no
expensive controller required
Recommended use Good for non-critical data or stagnantly updated data that gets Good for data that requires high fault tolerance at relatively low Very good for Read only data. Data requiring high performance for both read and write and
backed up regularly or any data requiring fast write performance hardware cost (redundancy using parity requires more expensive excellent reliability while trading off storage efficiency and cost.
at very low cost. Great for testing. hardware). Best for log files.
7. Installation - SQL Setup
Choose the right Edition depending on your needs
Standard
Enterprise
BI Edition (new in SQL2012)
Install only features/components you need !
Preferred Install is unattended
Especially for cluster Add node
8. Service Pack
Recommended to install
For Clusters : Rolling Upgrades supported since SQL2008
«Slipstream» new installations : Since SQL2008 , the slipstream
functionality performs a single installs that is quicker when
compared to installing the original release and then applying
the service pack.
Cumulative Updates : CU install only when you address a
problem or if there is a security fix
9. SQL Post Setup Configuration 1/2
Traceflag 1117
This Traceflag equally grows all datafiles together
Best Practice for SharePoint and Dynamics AX
Configure SQL Server Memory
Set max server memory to leave Memory to OS
1 GB for OS if Ram < 8 GB
2 GB for OS if Ram > 8 GB
4 GB for OS if Ram > 128 GB)
Tune this according to other SQL Server instances/ applications running on the
system
Advanced options
Set MAXDOP to 1 for OLTP like workload
Best Practice for MS ERP Dynamics AX/ MS CRM/SharePoint …
For OLAP like workload, MAXDOP should be at least on 2 (star join query
optimization)
10. Database Design Recommendations
Take care to initial size and file growth options.
Monitor growth : Configure Autogrow but try to make sure it’s not used
Use instant file initialization for performance optimization
Use partitioning for better large database manageability.
Transaction log : Isolate log from data at the physical level
TEMPDB : as See White paper
Best Practice SQL & Antivirus : http://support.microsoft.com/kb/309422/en-us
11. Databases Options Best Practices
SET RECOVERY Model : Depend of your DRP
Full for production OLTP app
Bulk-Logged for OLAP app
Simple on your Dev servers
Auto Shrink set to OFF
Auto Close set to OFF
Autogrow set with « Mb » and not « % »
Page Verify set to « Checksum »
12. Maintenance : Best Practices
Backup Databases / Log
Integrity Checks : DBCC CHECKDB
Optimization
Purge History Tables
13. Performance – Best Practices
Most common Performance issues came from
Wrong server configuration (io, config…)
But if you have followed BestPractices, it should be OK
DB DESIGN ISSUES
Missing Indexes or non-optimal index choices
Bad statistics / Fragmentation
QUERIES ISSUES
Queries using functions on Indexed columns (Implicit
conversion)
Ex : Select …From …Where Upper (nom) = …
Quering that generate Scan operations
Ex : operator « like ‘%’ » : You should use FTS indexes
14. Monitoring – Best Practices
HOW
WHAT
Monitor Services Use a Monitoring/supervision tool
Instances
when possible (exple : SCOM)
HA mecanisms
SQL Agent Alert mecanism
Monitor Windows Performance Configure Database Mail (SMTP
Memory, Cpu, IO support with SQL Server) to recieve
automatic alerts
Monitor SQL Performance
Top counters in BOL Standard Reports / DMV
Monitor File sizes UCP : CPU usage & Disk Usage
Monitor SQL Server Errorlogs PDC : more rich
Filter with Error Severity Automate as many of these day-to-day
Verify SQL Server Agent Jobs tasks as possible
To rack failure
15. Basic Tasks for a DBA
SQL server components installation
SQL Server daily Administration
Manage Production servers
Create /update DBs, Configure HA, Support , etc…
Manage Security access
Monitor SQL Instances Check Supervision results
Try to automate via emails
Maintenances Tasks
Create / Maintain / test DRP procedures
Optimize performances
Document changes
More & more : BI component administration
SSIS / SSAS / SSRS / MDS /DQS
Sharepoint Integration (Powerpivot)
… and probably much more…
16. DBA ToolBOX
Best Practice Configuration Tools
MAP Toolkit (included now in Steup tools)
MBSA : MS Baseline Security
BPA : Best Practices Analyzer
PBP – Policies management
SQL Upgrade Advisor for upgrade
Best Practice Troubleshooting/Performance/Tunning Tools
DMV
SQL Profiler
SQL DTA
PSSDIAG
RML utilities
PAL
17. Consolidation – Best Practices
Why Consolidate:
Lack of space in the data center Check White papers :
Better utilization of hardware resources, either of BestPractices for SQL server Consolidation
existing servers or in conjunction with the http://msdn.microsoft.com/en-
acquisition of new, more powerful servers
us/library/ee819082(v=sql.100).aspx
Standardization and centralization of
Administration & Maintenance BestPractices for SSAS Consolidation
Green-IT http://sqlcat.com/sqlcat/b/technicalnotes/archive/2010/0
Scénarios 2/08/microsoft-sql-server-2008-analysis-services-
Consolidate many DBs in 1 instance : reduce consolidation-best-practices.aspx
number of instances
Consolidate different instances on 1 server :
reduce number of servers
Virtualisation : consolidate many servers on a
Host
20. Pour aller plus loin…
Venez nous voir sur le stand SQL Server
Retrouvez les experts Microsoft et MVP
Assistez à des présentations des offres de nos partenaires
Inscrivez-vous au « Virtual Launch Event » du 8 mars :
http://aka.ms/vlefrance
Visitez notre nouveau site : http://www.microsoft.fr/sql
Evaluez dès aujourd’hui SQL Server 2012
En téléchargeant la RC0 : http://aka.ms/sql2012
En suivant nos « Virtual Labs » : http://aka.ms/sqllabs