©2010 softwareonz the return of the db2 top ten lists craig s. mullins...

30
©2010 SoftwareOnZ ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins [email protected] [email protected]

Upload: winfred-carter

Post on 31-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

The Return of The DB2 Top Ten Lists

Craig S. [email protected]@CraigSMullins.com

Page 2: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

The Top Ten Lists

And now, from the home office inSugar Land, Texas… a series ofDB2 Top Ten lists about varioustopics ranging across the following subjects:• Performance • Coding • Design• Administration• Management• Features• Tools

Page 3: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

The Ten Database Management Commandments

1. Thou shalt always design databases from a logical data model.2. Thou shalt always document thy database design.3. (There are many important aspects of database administration,

but of them all,) data integrity shalt always remain the most important.4. Thou shalt encrypt personal and sensitive information, both at rest and in transit.5. Thou shalt implement appropriate security within thy database and between thy

DBMS and thy operating systems.6. Thou shalt always maintain the recoverability of thy databases with sufficient

backups to meet the availability requirements of the business supported by the data.7. Thou shalt implement a consistent and documented workflow process for

implementing database change that assures data integrity while minimizing downtime.

8. Thou shalt always consider transaction performance and data availability in thy database design.

9. Thou shalt also work with application developers to ensure efficient code is written to access thy databases.

10. Thou shalt not download thy database to thy laptop.

Page 4: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten DB2 Database Design Guidelines

1. Always start with a logical data model2. Follow relational database design rules - normalization3. Create and follow consistent naming standards for all DB2

objects (including columns)4. Favor declarative referential integrity (RI)5. Don’t forget the free space6. Always fully document the database design including all

implementation decisions7. Plan for data purging and archiving8. Design for sharing data… instead of copying it all over the

place!9. Plan for performance (or availability) at design time10. Plan for backup and recovery before implementation

Page 5: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Benefits of Using DB2 CDC for DW/ETL

1. Why move all of your data every night when just a fraction of the data actually changed?

2. Near-real-time data delivery vs. daily extracts - downstream users have access to most current information

3. Significant reduction in CPU cycles by eliminating costly ETL processes

4. Identify certain business events as soon as they occur(i.e. claim submitted over $1M)

5. High availability with active/active replication between data centers

6. Optimize existing ETL processes by supplying only the data that has changed

7. Real-time integration with newer applications(i.e. send a text message if account balance goes negative)

8. No need to modify existing applications to track data changes or publish specific business events

9. Extend the life of your legacy DB2 applications by integrating data changes with newer applications

10. Allows for auditing by tracking all data changes to important tables

Page 6: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Development Best Practices

1. Minimize network calls2. Minimize passes through the data3. Put the work into the SQL, not the program4. Unlearn the “flat file” mentality5. Be sure data type and length match in predicates6. Know your Stage 1, Stage 2, and Indexable predicates7. Document your code8. Always check the SQLCODE or SQLSTATE9. Analyze your access paths

(and tune your SQL in test)

10. Avoid Bachelor Programming Syndrome

Page 7: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Common SQL Mistakes

1. Assuming an ORDER BY is not necessary for ordered results2. Forgetting the NULL indicator3. Incorrect expectations when using the NOT IN predicate with

NULLs*4. Coding predicates appropriately in Outer Joins5. Not coding a cursor for a multi-row result6. Recompiling but not rebinding7. Forgetting to use single quotes around strings (instead of double

quotes)8. Trying to modify a Primary Key column9. Forcing dynamic SQL into static SQL (sometimes hundreds of

static SQL statements)10. Asking for more data than you need (columns and/or rows)

SELECT C.colorFROM Colors AS C WHERE C.color NOT IN (SELECT P.color                        FROM Products AS P);

*

Sometimes (erroneously) referred to as the SELECT * problem

Page 8: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Compliance Concerns

1. Data Quality• “Poor data quality costs the typical company at least ten percent (10%) of

revenue; twenty percent (20%) is probably a better estimate.”

2. Data Retention3. Database Security

• Authentication (Who is it?)• Authorization (Who can do it?)• Encryption (Who can see it?)• Audit (Who did it?)

4. Data Masking and Obfuscation5. Database and Data Access Auditing6. DBA Procedures (e.g. change management)

• “Unauthorized change is one of the best (and worst) ways to get your auditor’s attention.”

7. Data Movement Tracking8. Master Data Management9. Data Definition and Categorization10. Metadata Management

Page 9: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Biggest Data Breaches

1. Jan. 20, 2009 Heartland Payment Systems ~130 million2. Oct. 2, 2009 U.S. Military Veterans 76 million3. Jan. 17, 2007 TJ stores (TJX) 45.7 million4. June 16, 2005 CardSystems over 40 million5. Dec. 15, 2009 RockYou 32 million (SQL injection)6. May 22, 2006 U.S. Dept. of Veteran's Affairs 28.6 million7. Mar. 8, 2006 iBill 17,781,462 8. Mar. 26, 2008 Bank of New York Mellon 12.5 million9. July 3, 2007 Fidelity National Information Services (Certegy

Check Services Inc.) 8.5 million10. Sept. 14, 2007 TD Ameritrade Holding Corp. 6.3 million

http://www.privacyrights.org/ar/ChronDataBreaches.htm

As of Feb 17, 2010, total records breached: 345,724,373 (since January 2005)

Page 10: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Non-Technical Security Steps

1. Buy and use a good shredder2. Don’t wear your ID badge outside of the office3. Be vigilant when using your laptop in public4. Buy and use a screen “shade”5. Don’t put identification on your laptop (e.g. ID tags)6. Company should invest in an anonymous PO box 7. Be careful about company logo clothing8. Don’t leave unencrypted disks/USB sticks/etc. laying

around9. Invest in a laptop lock and use it whenever possible10. Never put any disk you do not know into your

computer (salaries)

Page 11: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Under-Utilized Features

1. Table Expressions2. CASE statements3. REOPT (other than NONE)4. Triggers5. Auto expand buffer pools6. Real Time Stats7. User-Defined Functions8. DISTINCT Types9. LOBs10. Date/Time Arithmetic

XML?

Page 12: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Specialty Processor Workloads

1. IFL: Linux “stuff”2. zIIP: distributed SQL requests3. zIIP: parallel SQL requests4. zIIP: data warehousing/star schema 5. zIIP: native SQL stored procedures run via DDF (V9)6. zIIP: index maintenance during LOAD, REORG, and

REBUILD7. zAAP: Java8. zAAP: XML9. (zAAP on) zIIP: Java and XML 10. zIIP: non-DB2 stuff including:

• z/OS Communcation Server encryption, z/OS XML System Services, and System Data Mover processing associated with zGM/XRC (z/OS Global Mirror)

Page 13: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten A-Ha! Moments1. Changing the SQL terminator for triggers2. Truly understanding locking3. When you can predict access paths by looking at SQL (and statistics)4. Being a human compiler (or JCL checker)5. When your first reaction is to look it up in the manual instead of

asking the DBA6. When you take responsibility for your professional development7. When you start thinking about the business problems your programs

and database solve before thinking about a “neat” technical issue8. When you stop thinking of fetching from a cursor like reading from a

file9. When you stop blaming DB2 before your own code10. When you look at this list and say “that all makes sense”

Page 14: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten DB2 Myths

1. Use Views to Insulate Programs from Change2. Locking Problems Indicate a Database Problem3. Primary Key is Usually a Good Choice for Clustering4. Just Using the Defaults Should Work Out Well5. Programmers Don’t Need to Know How to Tune SQL6. Black Boxes Work Well for Performance7. Using NULLs Can Save Space8. RUNSTATS Aren’t That Important9. DB2 is a Hog10. It Depends!

Page 15: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Outdated Standards

1. Limiting indexes per table to 3… or 5… or…2. Requring base table views3. Forbidding dynamic SQL4. Limiting number of tables per join (typically for online

txns)5. Avoiding NULLs6. Arcane table naming standards (e.g. TXR0031)7. Just about any buffer pool standard (e.g. BP0 only)8. Almost any standard using the words “always” or

“never”9. GRANT…WITH GRANT OPTION10. Putting standards in a binder instead of online

Page 16: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Things to Do Before You Visit the DBA

1. Try to Figure It Out Yourself, Please2. RTFM3. Figure out what you are going to say to him/her4. Be sure it is the truth!5. Don’t assume you (or your code) are innocent6. Have a drink (coffee?)7. Bring the DBA a drink (your choice!)8. Never say “But IBM said it should work this way.”9. Never say “But it worked that way yesterday.”10. Always say “Thank you.”

Page 17: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Ten Eleven Rules of the Road for DBAs

1. Write Down Everything2. Keep Everything3. Automate4. Share Your Knowledge5. Focus Your Efforts6. Don’t Panic!7. Measure Twice, Cut Once8. Understand the Business9. Don’t Be a Hermit10. Use All of the Resources at Your Disposal11. Keep Up-to-Date

From zJournal article available at: http://www.craigsmullins.com/zjdp_042.htm

Page 18: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Weasel-Speak Interpretations (Part 1)

1. We will look into it(We will forget all about it the moment you leave)

2. It is in process(The bureaucracy involved has rendered it hopeless)

3. I didn’t get your e-mail(I was too busy updating my Facebook status to read your e-mail)

4. The entire project is being abandoned [or reorganized](The only guy who understood it just left or retired)

5. A number of different approaches are being tried(We are all just guessing at this point)

Page 19: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Weasel-Speak Interpretations (Part 2)6. Preliminary tests were inconclusive

(We can’t get the dang thing to run)

7. Test results are very promising(Amazing, it actually works)

8. What do you think about this…(I only want your opinion so you can share the blame later)

9. Robust(We want you to buy this thing but have no Earthly idea how to convince you, so we call it robust)*

10. Low maintenance(Almost impossible to fix) * See also, “Best of Breed”

Page 20: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten, err, Twelve DB2-Related• SG24-7330 DB2 9 for z/OS Technical Overview• SG24-6763 The Business Value of DB2

• SG24-6300 DB2 for z/OS Application Programming Topics• SG24-6289 DB2 9 for z/OS: Using the Utilities Suite

• SG24-7322 DB2 for z/OS: Data Sharing in a Nutshell• SG24-7720 Securing and Auditing Data on DB2 for z/OS• SG24-7688 DB2 9 for z/OS: Packages Revisited

• SG24-7473 DB2 9 for z/OS Performance Topics• SG24-7134 DB2 UDB for z/OS: Design Guidelines for High Performance and Availability

• SG24-7604 DB2 9 for z/OS Stored Procedures: Through the CALL and Beyond• SG24-7663 DB2 9 for z/OS: Deploying SOA Solutions • SG24-6319 DB2 for z/OS and WebSphere: The Perfect Couple

http://www.redbooks.ibm.com/

Page 21: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten DB2 Twitter-ers

Page 22: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten LUW vs. z/OS Differences1. Memory: EDM Pool, RID Pool, Sort Pool, Buffer Pools versus Catalog Cache,

Package Cache, Sort Heap, Buffer Pool, Locklist2. Table Spaces: Simple (obsolete), Segmented, Partitioned, Universal (V9), LOB

versus Regular, Temporary, Large, Automatic (V9.5)3. Optimizer: 7 levels of optimization in LUW (0,1,2,3,5,7,8)4. Monitoring: Traces and Instrumentation Facility versus Event Monitor, Snapshot

Monitor5. XML: XPath versus XPath, XQuery6. Index Compression: z/OS only7. Oracle syntax suport: LUW only8. Multi-row INSERT, FETCH & multi-row cursor UPDATE: z/OS only9. SET CURRENT ISOLATION: LUW only10. Bottom Line: amazingly similar but different enough to make transitioning from

one to the other non-trivial

z/OS

LUW

Page 23: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten DB2 9 for z/OS Application Developer Features

1. Plan Management: Package Stability2. MERGE3. SELECT FROM UPDATE, DELETE, & MERGE4. Index on Expressions 5. Native SQL Procedure Language6. FETCH FIRST and ORDER BY in subselect

and fullselect7. INTERSECT and EXCEPT8. INSTEAD OF TRIGGER9. TRUNCATE10. LOB Improvements

Page 24: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten DB2 9 for z/OS DBA Features

1. Universal Table Spaces- PBG and range-partitioned

2. Reordered Row Format3. Index Compression4. CLONE Tables5. BUILD2 Phase Eliminated in Online REORG 6. APPEND YES

– ignoring clustering during INSERT and LOAD

7. The promise of REOPT(AUTO)8. IMPLICITLY HIDDEN columns9. New Data Types: BIGINT, DECFLOAT, BINARY/VARBINARY10. Database Definition on Demand

- renaming a table’s column; renaming an index

Page 25: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten DB2 10 Features1. “…best reduction in CPU for transactions, queries, and batch since V2.1…

most customers to reduce CPU times between 5% and 10% as soon as DB2 10 is out of the box.”

2. Improved Security (e.g. data masking, smaller granularity for admin privileges)

3. Index Include Columns4. Temporal (Versioned) Data5. Hashing6. Buffer Pool Improvements

(e.g.use of the System z10 1 megabyte, page size, buffer pools in memory)

7. 80% to 90% of Virtual Storage Moved “Above the Bar”8. No More Links in the DB2 Catalog9. Efficient Caching of Dynamic SQL Statements That Use Literals10. LOB Improvements

(e.g. inline LOBS, improved large object streaming)

Page 26: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Trends

1. Industry Consolidation2. Cloud Computing3. SaaS4. Virtualization5. Server Consolidation6. Open Source7. Social Media8. Complexity9. Autonomic, Self-Managing Databases10. Commoditization

Page 27: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Best Practices for DB2 Professional Development

1. Join your local DB2 user group (and participate!)2. Join IDUG and attend the annual conference in your geography3. Lobby for relevant annual training4. Purchase and read DB2 and database books5. Subscribe to relevant magazines and read them regularly (e.g. IBM

Database Magazine, Database Trends & Applications, zJournal)6. Subscribe to RSS feeds for DB2-related blogs (mine [DB2 Portal and

Data Technology Today], Willie Favero, Troy Coleman, Dave Beulke, Robert Catterall, etc.)

7. Subscribe to the DB2 mailing list (daily DIGEST perhaps)8. Visit IBM DeveloperWorks frequently (

http://www.ibm.com/developerworks/data/)9. Download the DB2 manuals in PDF form 10. Be business savvy, not just tech savvy! Learn about your business.

Page 28: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten DB2 Related Blogs

1. Start with: Planet DB2 (DB2 blog aggregator) – http://www.planetdb2.com

2. DB2 Portal Blog - http://www.db2portal.com/blog.html3. Getting the Most Out of DB2 for z/OS (Willie Favero) -

http://it.toolbox.com/blogs/db2zos4. DB2 News & Tips - http://db2news.blogspot.com/5. DB2 USA - http://db2usa.blogspot.com/6. Dave Beulke’s Blog - http://davebeulke.com/7. DB2utor (Troy Coleman) -

http://ibmsystemsmag.blogs.com/db2utor/8. Thoughts on DB2 (Triton) - http://www.triton.co.uk/blog/9. SAP on DB2 for z/OS (Omer Brandeis) -

http://it.toolbox.com/blogs/sap-on-db210. Robert Catterrall - http://catterallconsulting.blogspot.com/

Page 29: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

Top Ten Books for DB2 Professionals

1. DB2 Developer’s Guide2. DB2 Developer’s Guide3. DB2 Developer’s Guide4. DB2 Developer’s Guide 5. DB2 Developer’s Guide6. DB2 Developer’s Guide7. DB2 Developer’s Guide 8. DB2 Developer’s Guide9. DB2 Developer’s Guide10. DB2 Developer’s Guide

Page 30: ©2010 SoftwareOnZ The Return of The DB2 Top Ten Lists Craig S. Mullins craig.mullins@softwareonz.com craig@CraigSMullins.com

©2010 SoftwareOnZ©2010 SoftwareOnZ

The Return of the DB2 Top Ten Lists

Craig S. Mullins

[email protected]://www.CraigSMullins.com

[email protected]://www.softwareonz.com