Professional Documents
Culture Documents
Introduction
Oracle ACE Director Author Consultant Data Architect Blogger, An Expert's Guide to Oracle Technology
2
My books
Authors
John Beresniewicz, Adrian Billington, Martin Buchi, Melanie Caffery, Ron Crisco, Lewis Cunningham, Dominic Delmolino, Sue Harper, Torben Holm, Connor McDonald, Arup Nanda, Stephan Petit, Michael Rosenblum, Robyn Sands, Riyaj Shamsudeen
Dynamic Analysis
What you learn from running the code
Instrumentation
What you should make your code tell you
When to analyze
2 AM on the day before vacation?
After implementation? After testing?
After coding?
During Coding?
Know Your Code Data Dictionary - Static PL/Scope - Static Profilers - Dynamic Source Code Static Logging - Instrumentation
PL/Scope
Introduced in 11g
Need to turn it on for it to work
SQL Developer turns it on for you
SQL*Plus: ALTER SESSION SET
PL/Scope
Works with identifiers Almost everything is an identifier Data types and subtypes used (including collections) Cursors and ref cursors Procedures Functions Packages and package bodies Triggers Object types and type bodies Parameters Function return values Variables, iterators, constants Exceptions Synonyms
PL/Scope
Data Gathered on every
Declaration procedures, variables, etc Definition the implementation of an identifier
PL/Scope
Can validate naming standards of variables as well as
parameters Identifies scoping issues Change impact analysis Find unused identifiers Validate data types
Dynamic Analysis
DBMS_PROFILER Code Profiling Timing between calls DBMS_TRACE Code Call Context Who called who DBMS_HPROF Code profiling and context
Dynamic Analysis
Run a baseline profile
Save timings Run a new profile after changes are made
Code Coverage
Make sure all executable lines are executed during
testing Doesn't validate the logic, just makes sure the line was run Proves that for a certain scenario, the code will execute successfully Does not prove that the code is correct Does not prove that the code will execute correctly for a different data set
Code Coverage
Combines Static Analysis with Dynamic Analysis
Static analysis (PL/Scope) knows what lines are
executable Dynamic Analysis shows what actually is executed Subtract dynamic from static and whats left are those lines of code not executed
Code Coverage
Code Coverage is not 100%
Doesn't account for all lines of SQL (because
PL/Scope doesn't track SQL) I'm hoping for additional information from PL/Scope in the future
Summary
Create standards
Follow standards