35
(c) 2015 Independent SAP Technical User Group Annual Conference, 2015 I SUG-TECH 2015 Conference I SUG-TECH 2015 Conference I ndexi ng f or Per f or mance I ndexi ng f or Per f or mance Jef f r ey Gar bus Jef f r ey Gar bus

How To Be a Great DBA

Embed Size (px)

Citation preview

Page 1: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

ISUG-TECH 2015 ConferenceISUG-TECH 2015 Conference

I ndexi ng f or Per f or manceI ndexi ng f or Per f or manceJef f r ey Gar busJef f r ey Gar bus

Page 2: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

AgendaAgenda

Welcome Speaker Introduction Indexing for Performance Q&A

Page 3: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Great DBA Series

Page 4: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Since 1997, Soaring Eagle Consulting has been helping enterprise clients improve their overall system performance at the database tier, arguably the most volatile and critical component of distributed application architecture. Our clients range in size from fledgling startups through Fortune 100 companies and leading financial institutions.

Soaring Eagle has been a leader in managed services, database architecture, performance and tuning databases, while promoting mentoring and training all over the world for over a decade and a half. Many of our employees, and partners have written books, speak at seminars about leading edge technologies. We have expertise in all business tiers, financial; health, manufacturing, government agencies and many ecommerce businesses. Whatever your business needs are we can help improve performance!

Consulting•Performance & Tuning•Data Performance Management•Emergency Triage•Performance & Security Audits•Staff Augmentation•Project management•Database architecture•Scalability assessment and planning

Training•Onsite/Web based

• Microsoft• Sybase• Oracle• APM• Six Sigma

Software•Application Performance Management•Database performance management•Database Security

Managed Services•Remote Database Management•Performance management•Emergency db Service•Proactive mitigation•Problem notification •Problem resolution

Ray Rannala [email protected]

Partners with

Page 5: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Production DBA vs. Development DBA

There are 10 kinds of people in the world; “those who understand binary, and those who don’t.”

There really are 2 basic types of DBA: Production DBAs and Development DBAs.

This presentation focuses on Production

Page 6: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Production DBA

Failure to perform basic maintenance and monitoring can hurt in a variety of ways:Performance issues snowballing

Phases of development becomeincreasingly difficult

Database corruption, system crash, or other

When your production database goes down, your business stops

… or a hundred other scenarios

6 - 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 7: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Preventative Maintenance

When servers and databases are not properly maintained: Performance degrades

Consistency is at risk

Cleanup of ancillary process does not occur

Lack of preventive maintenance is probably the most common omission to sting the new ASE DBA

Accurate statistics are vital for proper execution plan formationFailure to keep statistics up to date are frequent causes of later consternation

Check that storage is being used efficiently

7 - 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 8: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Keeping Statistics up to Date

ASE has a cost-based optimizerIdentifies the distribution of the data

Crucial for determining join orders, index selection,or lack of same

To perform this critical task as often as necessary

Note:

High-volume environments

Statistics - may be observed by:

Querying the systabstats and sysstatistics table

Using the optdiag utility

8- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 9: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Keeping Statistics up to Date

Tips Large tables? Update the system based

on sample not entire table a 10% sampling can be as consistent

as 100% sampling

Update index statistics rather than all statistics

Update statistics as often as you can For max speed: update your stats in

parallel 9- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 10: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Reorganize Data

DOL (Data-Only Locking)

RLL (Row-Level Locking)

ASE has changed the storage mechanism Ads the requirement to clean storage

periodically

10- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 11: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Transaction Log Backups

ASE transaction log is an incremental backup

Make sure you back this up and get it off siteFor incremental and redundant backups

11- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 12: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Validate Database Consistency

DataBase Consistency Checker (dbcc)

Dbcc checkstorage Stops small errors from escalating

12- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 13: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Soft DBCC Faults

Soft Faults An inconsistency in Adaptive Server that has not been

determined to be persistentUsually they are inconsistencies in target database caused by

users updating during the dbcc checkstorageCan be reclassified by:

Comparing the results of the two executions of dbcc checkstorage

Running dbcc tablealloc and dbcc checktable after dbcc checkstorage

13- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 14: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Hard DBCC Faults

Hard Faults A persistent corruption of Adaptive ServerWhat causes a Hard Fault?

A page that is allocated to a nonexistent table minimally reduces the available disk storage

A table with some rows that are unreachable by a scan might return the wrong results

A table that is linked to another table causes the query to stop

14- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 15: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Monitoring

Availability Resources

Storage space should be monitored by: Size of the transaction logs Size of the data Size available for database and

transaction log dumps Errorlog space Are you straining memory? Network? CPU?

sp_monitorconfigsp_countmetadatasp_sysmonsp_object_stats

Continued next slide

15- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 16: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Monitoring

Performance MDA tables

ASE/SAP Errorlog

Any major errors or anomalies from the server will be recorded in the errorlog

Monitor and maintain ErrorlogWe recommend continuous monitoring

of the log

16- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 17: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Configuration

The configuration you choose is critical to performance and stability

Make sure you grant sufficient memory to:The kernel The resources the DBMS kernel needsUsers NetworkData cacheProcedure cacheStatement cache

17- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 18: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Recording Run-Time Data

sp_configureThis stored procedure will list all system configuration

variablesConfiguration settings are also stored in a file under

the $SYBASE directory called <servername>.cfgAdaptive Server

named <servername>.bak Historical configurations <servername>.###

Archive a good copy of the results from a run of sp_configure

18- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 19: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Application Performance

Know how to identify what application components are running slowly?

Common mistake =“throw hardware at the problem”Only masks the problem while it snowballs

19- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 20: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Disaster Recovery

Do you have a disaster recovery plan?

Always ask how each plan could go wrongInclude the location of physical

database dumps and any configuration data that would be used to re-construct the server

Test plans extensively Use least experienced DBA to test it

20- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 21: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Database Dumps

Regularly dump each database

All tempdb databases are cleared whenever the server is started so it is unnecessary to take dumps of these databases

Get a copy of the backups in a secure off-site location

Keep track and maintain a record of the dumps

21- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 22: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Logo Management

Transaction Logs must be watched to prevent them from filling upA full log stops all modification to the database

Only way to “prune” is to dumpUse threshold management to avoid "log segment full" errors

To verify how large the logs have grown, use the sp_spaceused stored procedure or sp_helpsegment logsegment

22- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 23: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Script Maintenance

It may become necessary to attempt a complete rebuild of an Adaptive Server

Have scripts ready that can perform the installation, configuration, and population of the databases

Keep up-to-date scripts

Keep the scripts on a different machine

23- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 24: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Verifying Dumps

"Almost any administrator can perform a backup. A useful administrator can perform a restoration."

Beware of any bad tapes in the stripe setGet a separate server set aside for periodic testingProvides an excellent rehearsal for a real disaster

24- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 25: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Device Management

There are a variety of DBMS resources that require frequent IO

Predictive Analysis Measure and monitor things like database growth or you won’t have a way to plan

25- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 26: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Physical Architecture

Decisions need to be based upon facts, knowledge of your business requirements, and experience

Application architectureDBA’s = good resource when you start to design your application flow

26- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 27: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Software Maintenance

SAP / Sybase maintains its software with releases and point releases – “SWR” (Software RollUp)A common approach to dealing with SWRs:

Wait awhile before installing the upgrade Install it on the development server and test it Then Install it on your production server

Many shops generally adhere to:If it ain't broke, don't fix it

If you put off upgrades long enough, eventually Sybase will not support you

The goal is to not wait too long

27- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 28: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Business Continuity

Over 29% of businesses fail after catastrophic data lossHave a long term plan Hardware PerformanceWhen ordering your server hardware you should know:

What the DBMS performance has beenWhich performance spikes are aberrations and what is

normalHow to maximize the throughput throughout your

bottlenecks

28- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 29: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Developer training

Developers have high aptitude for logical coding, often do not have training in database performance

Often leads to applications passing user test, but with significant performance issues at rollout

An oft-neglected but badly-needed area of DBA work is mentoring

29- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 30: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Personality Attributes of a Great DBA

Curious/ Always LearningThere is always more to learn

Lunch-and-Learns

Meticulous

Constructively ParanoidLook for what can go wrong

Frequently takes backups

Review Your Performance

30- 29 Soaring Eagle Consulting Inc. 08/20/2013

• Technology Savvy (not afraid of automation)

• Communicative o Communicate to

management early and often

o Get involved online • Strives for Perfection

(Continual Improvement)• “How can I do this better?”

Page 31: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Summary

DBA activities requires dedicated support

Part-time DBA’s might not have enough time or training

Make sure you have adequate expertise at hand

31- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 32: How To Be a Great DBA

Annual Conference, 2015 (c) 2015 Independent SAP Technical User Group

Questions and AnswersQuestions and Answers

Page 33: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Questions?

If you are interested in performance tips for beginner through guru programmers and DBAs using Microsoft SQL Server, visit my blog at: http://mssqlperformance.blogspot.com/  

If you are interested in Sybase ASE Performance and Tuning visit my blog: http://aseperformance.blogspot.com/  

Page 34: How To Be a Great DBA

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

Jeff Garbus - [email protected]

SQL Jeff’s SQL Blog- http://mssqlperformance.blogspot.com/

Sign up for our e-calendar at www.soaringeagle.guruFollow us on Facebook, Twitter and Youtube!

@soaringeagleDBA

Contact Ray Rannala to register for your Free SQL Performance Evaluation

[email protected] – 941.981.391334- 29 Soaring Eagle Consulting Inc. 08/20/2013

Page 35: How To Be a Great DBA

Annual Conference, 2015 (c) 2015 Independent SAP Technical User Group

Thank You for AttendingThank You for Attending

Please complete your session feedback Please complete your session feedback formform