Stephan Hurni Consultant Trivadis AG, [email protected] SQL Server notes from the field.

18
Stephan Hurni Consultant Trivadis AG, www.trivadis.com [email protected] SQL Server notes from the field

Transcript of Stephan Hurni Consultant Trivadis AG, [email protected] SQL Server notes from the field.

Page 1: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

Stephan HurniConsultantTrivadis AG, www.trivadis.com [email protected]

SQL Servernotes from the field

Page 2: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

… keep flexible

Connect to SQL Server

Page 3: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

SQL Server Browser serviceIs listening on port 1434Responds with the ports of SQL instances to client requestsJust holds instance names + ports of the local serverRefreshes on every SQL Server instance startupDisable in secure envirionments

SQL Server Browser service

Page 4: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

SQL Server instance portsDynamic or fixed but uniqueBound to TCP/IP addressOnly one default instance or rather one 1433

What if applications can’t connect to dynamic portsYou want to consolidate instances with default ports to a cluster or central SQL Server

SQL Server instance port

Page 5: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

Configure a fixed SQL Server portUse default port 1433 multiple times on same server

If … every instance has a dedicated TCP/IP addressEasy on a cluster every instance must have a dedicated TCP/IP address

For example (expected configuration)Server: sqlprod01–172.20.20.201SQL instance: sql01 –172.20.20.211/1433SQL instance: sql02 –172.20.20.212/1433

SQL Server fixed port – 1/2

Page 6: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

SQL Browser list – if not configured correctsqlprod01\sql01 172.20.20.201\1433sqlprod01\sql02 172.20.20.201\1433 uups!Use configuration manager

Set port to 1433 and dedicated TCP/IP address to listen on

Use DNS names to publish SQL instanceseven on clustered instancesLet clients and applications connect to the DNS names

SQL Server fixed port – 2/2

Page 7: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

SQL Server connections are easy and flexible using DNS names

No “server\instance” combination must be set on clients or applicationsMultiple instances with “default behaviour” can exist on same server Instance migrations from one to another server are then easier no client or application customizing Upcoming SQL Server Denali will use a similar behaviour on availability groups

Configure SQL connections

Page 8: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

SQL Server connections configuration

demo…

Page 9: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

… keep performance

Windows Server …

Page 10: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

Configure Windows accordingly for SQL Server

Power options – neat behind ;-) Disk alignment – almost forgottenStorage throughput and waits long-lasting discussionPolicieslock pages in memoryperform volume maintenance tasksAntivirus

Windows/System power

Page 11: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

Windows Serverperformance

demo…

Page 12: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

… keep control

Databases are growing …

Page 13: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

Configure autogrowth butSet correct values beware of latches + timeoutsTo maintain proper and parallel growing on data files use traceflag 1117

For TXLog onlyCheck for VLFs on Txlog files periodically to optimize Txlog growthSet max autogrowth to 1024MBBetter: growth manually to achieveas less VLFs as possible but a single VLF not > 512MB

… and never use autoshrink

DB Setting autogrowth

Page 14: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

Lots of TXLogs …Substantial performance reduction

on data changes SQL Server must search for empty TXLog extentsBackups will last longerDatabase startup will take much more timeRecovery will last “for ever”

Create database mirror ends in timeouts and mirroring can not establish

TXLog penalties

Page 15: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

Maintain your databasesBackup Txlog to …

Keep control on Txlog size what about recovery modesAllow point in time recoveryDisaster prevention

IndexesReorg / RebuildCreate missing and maybe remove unused

StatisticsUpdate regularly and planned

Keep performance …

Page 16: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

SQL Serverfile growing and VLFs

demo…

Page 17: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

Please help us make TechDays even better by Evaluating this Session. Thank you!

Give us your feedback!

Page 18: Stephan Hurni Consultant Trivadis AG,  stephan.hurni@trivadis.com SQL Server notes from the field.

© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after

the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.