Introduction to the Oracle Database Appliance NYOUG 12/13/2011
Top Ten List - New York Oracle User Group - NYOUG
Transcript of Top Ten List - New York Oracle User Group - NYOUG
![Page 1: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/1.jpg)
Top Ten ListOracle 11g PL/SQL Features and
Enhancements
1
Rick MichaudSenior Sales ConsultantOracle Corporation
1Wednesday, May 5, 2010
![Page 2: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/2.jpg)
Who Am I?
Senior Sales Consultant for Oracle for the last 3 years.
20 years as an architect, developer and DBA.
My last name is pronounced “Me Show”
2Wednesday, May 5, 2010
![Page 3: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/3.jpg)
Complex Agenda
Introduction
Top Ten List
Q&A
3Wednesday, May 5, 2010
![Page 4: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/4.jpg)
Introduction
4Wednesday, May 5, 2010
![Page 5: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/5.jpg)
Oracle Features Added by Release
0
175
350
525
700
Oracle 7Oracle 8i
Oracle 10g
Release 1 Release 2
5Wednesday, May 5, 2010
![Page 6: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/6.jpg)
11g PL/SQL Feature Focus
1. Simplifying database PL/SQL development
2. Improving usability
3. Enhancing performance
4. Providing functionality and tools to do the above!
6Wednesday, May 5, 2010
![Page 7: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/7.jpg)
Top Ten List
7Wednesday, May 5, 2010
![Page 8: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/8.jpg)
#10Simplified Sequence Expressions
8
8Wednesday, May 5, 2010
![Page 9: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/9.jpg)
#10 Simplified Sequence Expressions
Was there any real useful reason for the “Dual” table?Can now use sequence expression whenever there is a numeric expression.Before 11gR1:
After 11gR2:
11gR1
DECLAREv BINARY_INTEGER;w BINARY_INTEGER;
BEGINSELECT MY_SEQ.NEXTVAL INTO v FROM DUAL;SELECT MY_SEQ.CURRVAL INTO w FROM DUAL;
END;
DECLAREv BINARY_INTEGER;
BEGINv := MY_SEQ.NEXTVAL;w := MY_SEQ.CURRVAL;
END;
9
9Wednesday, May 5, 2010
![Page 10: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/10.jpg)
#9Fine-Grained Dependency Tracking
10
10Wednesday, May 5, 2010
![Page 11: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/11.jpg)
#9 Fine-Grained Dependency Tracking
Prior to 11g:
“ORA-4068:Existing State of packages has been discarded or invalidated”
Invalid views until queried
Recompile Loop:
UTL_RECOMP...
SELECT COUNT(*) FROM DBA_OBJECTS WHERE STATUS=‘INVALID’
With 11g:
Dependencies tracked at code level
11gR2 - now adds support for triggers!
Can still get ORA-4068, but has been reduced.
11
11gR1
11Wednesday, May 5, 2010
![Page 12: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/12.jpg)
#8Named and Mixed Notation
12
12Wednesday, May 5, 2010
![Page 13: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/13.jpg)
#8 Named and Mixed Notation User Functions in SQL
Given:
Can now do:
Instead of:
13
11gR1
FUNCTION f(p1 IN INTEGER := 1,p2 IN INTEGER := 2,...pn IN INTEGER := 99)RETURN INTEGER
SELECT f(1, pn=>3) FROM dual
SELECT f(pn=>3, p2=>2, p1=>1) FROM dual
13Wednesday, May 5, 2010
![Page 14: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/14.jpg)
#7DBFS Content API
14
14Wednesday, May 5, 2010
![Page 15: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/15.jpg)
DBFS and the DBFS Content API
DBFS is a posix compliant file system built on top of the database
Why do this?
Allows unstructured content to be managed with relational content
High performance solution for parallel ETL (e.g. Staging Files)
Security and data
Data load for Database Machine (aka “Exadata”)
DBFS Content API allows interaction with filesystem at a PL/SQL programmatic level.
Great for data manufacturing/production.
15
11gR2
15Wednesday, May 5, 2010
![Page 16: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/16.jpg)
DBFS Content API Example
connect foo/****** declare ret integer; b blob; str varchar2(1000) := '' || chr(10) ||'#include <stdio.h>' || chr(10) || '' || chr(10) || 'int main(int argc, char** argv)' || chr(10) ||'{' || chr(10) || ' (void) printf("hello world\n");' || chr(10) || ' return 0;' || chr(10) ||'}' || chr(10) || ''; begin ret := dbms_fuse.fs_mkdir('/mnt1/src'); ret := dbms_fuse.fs_creat('/mnt1/src/hello.c', content => b); dbms_lob.writeappend(b, length(str), utl_raw.cast_to_raw(str)); commit; end; / show errors; -- verify newly created directory and file select pathname, pathtype, length(filedata), utl_raw.cast_to_varchar2(filedata) from dbfs_content where pathname like '/mnt1/src%' order by pathname;
16Wednesday, May 5, 2010
![Page 17: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/17.jpg)
#6PL/SQL Subprogram Inlining
17
17Wednesday, May 5, 2010
![Page 18: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/18.jpg)
#6: PL/SQL Subprogram Inlining
Performance enhancement feature to alleviate overhead of subprogram calls.
Replaces a subprogram invocation with a copy of the invoked subprogram.
Used for “small” frequently-used subprograms.
Similar to inlining in C
Can be enabled with the following:
Automatic: Init.ora parameter: PLSQL_OPTIMIZE_LEVEL = 3)
Manual: PRAGMA INLINE (Must have PLSQL_OPTIMIZE_LEVEL = 2)
Will improve performance in the majority of cases, however:
Remember to test performance to measure impacts
Make sure you use only on small, frequently used subprograms.
Disable when debugging code.
18
11gR1
18Wednesday, May 5, 2010
![Page 19: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/19.jpg)
#5PL/Scope
19
19Wednesday, May 5, 2010
![Page 20: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/20.jpg)
#5 PL/ScopeDeveloper productivity tool that enables navigation of code by named tags
Useful for analyzing:
Impact of code changes beforehand
“Inherited” code from a developer who didn’t believe in documentation.
Similar to c-scope for C Developers
Data For PL/SQL program units generated at compile time and stored in data dictionary
Tooling available in SQL Developer
20
11gR1
20Wednesday, May 5, 2010
![Page 21: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/21.jpg)
#4PL/SQL Hierarchical Profiler
21
21Wednesday, May 5, 2010
![Page 22: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/22.jpg)
#4 PL/SQL Hierarchical Profiler
Identifies bottlenecks and performance issues in PL/SQL applications
Reports the dynamic execution profile of the PL/SQL program organized by subprogram calls.
Requires no special source or compile time preparation.
Stores results in hierarchical profiler tables.
Provides information such as:
Number of calls to subprogram
Time spent in subprogram
Time spent in descendant subprograms
Callers of a given subprogram
All called subprograms of a particular subprogram
22
11gR1
22Wednesday, May 5, 2010
![Page 23: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/23.jpg)
#4 PL/SQL Hierarchical Profiler
How to run manually:
1. Grant execute on DBMS_HPROF.
2. Setup directory for tracefiles via CREATE DIRECTORY
3. Start profiling.
4. Call your subprogram.
5. Stop profiling.
6. Analyze results:
1. Review raw trace file.
2. Using DBMS_HPROF.ANALYZE*
3. Using plshprof utility to generate HTMLReport
4. * Requires Data Dictionary tables to be created with dbmshptab.sql
Tooling available through SQLDeveloper 2.0!
BEGIN /* Start profiling. Write raw profiler output to file test.trc in a directory that is mapped to directory object PLSHPROF_DIR (see note following example). */
DBMS_HPROF.START_PROFILING('PLSHPROF_DIR', 'test.trc');END;/-- Execute procedure to be profiledBEGIN test;END;/BEGIN -- Stop profiling DBMS_HPROF.STOP_PROFILING;END;/
CREATE DIRECTORY PLSHPROF_DIR as '/private/plshprof/results';GRANT READ, WRITE ON DIRECTORY PLSHPROF_DIR TO HR;GRANT EXCUTE on DBMS_HPROF to HR;
23Wednesday, May 5, 2010
![Page 24: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/24.jpg)
#3Edition-based Redefinition
24
24Wednesday, May 5, 2010
![Page 25: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/25.jpg)
11gR2
Synonym ViewFunction ProcedurePackage Specification Package BodyType Specification Type BodyLibrary Trigger
25
#3 Edition-Based Redefinition
Enables application developers to upgrade objects while in use
Reduces system downtime
Enables seamless application upgrades
Data changes are possible through cross-edition triggers.
Supported objects:
25Wednesday, May 5, 2010
![Page 26: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/26.jpg)
Simple ExampleCREATE OR REPLACE FUNCTION NORMALIZED_NAME (FIRST_NAME IN VARCHAR2, LAST_NAME IN VARCHAR2) RETURN VARCHAR2 AS BEGIN RETURN FIRST_NAME || ' ' || LAST_NAME;END NORMALIZED_NAME;/DECLARE v_Return VARCHAR2(200);BEGIN v_Return := NORMALIZED_NAME('john','doe’); DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);END;/>>v_Return = john doe
CREATE EDITION patch_normalized_name_1;ALTER SESSION SET EDITION = patch_normalized_name_1;CREATE OR REPLACE FUNCTION NORMALIZED_NAME (FIRST_NAME IN VARCHAR2, LAST_NAME IN VARCHAR2) RETURN VARCHAR2 AS BEGIN RETURN INITCAP(LAST_NAME) || ', ' || INITCAP(FIRST_NAME);END NORMALIZED_NAME;/DECLARE v_Return VARCHAR2(200);BEGIN v_Return := NORMALIZED_NAME('john','doe'); DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);END;/>>v_Return = Doe, John
ALTER SESSION SET EDITION = ora$base;;DECLARE v_Return VARCHAR2(200);BEGIN v_Return := NORMALIZED_NAME('john','doe’); DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);END;/>>v_Return = john doe
26Wednesday, May 5, 2010
![Page 27: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/27.jpg)
27
# 2Native Database Web Services
27Wednesday, May 5, 2010
![Page 28: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/28.jpg)
28
11gR1
#2 Native Database Web Services
Easily expose functionality in Database as a web service
PL/SQL packages, procedures, functions
SQL Queries
XQuery
No need for app server
Uses a servlet architecture on XDB HTTP Server
Can be secured by integrated with a WS-Security provider
28Wednesday, May 5, 2010
![Page 29: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/29.jpg)
29
# 1PL/SQL Native Compiler
29Wednesday, May 5, 2010
![Page 30: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/30.jpg)
30
PL/SQL Native Compilation
Useful feature for PL/SQL performance improvement
Especially computational code
Great for DW server-side transformations
Released in 9i
Required platform native compiler to be installed.
Was cumbersome to configure and setup
Sometimes this wasn’t allowed -- e.g. PRODUCTION!!
11g compiler is built-in
Doesn’t require a 3rd party compiler
No DLLs generated, compiled code stored in database catalog
Gotchas:
Not available on all platforms
For those 10g Native Compilation option is still available
For debugging processes, stick with interpreted code as compiling takes time11gR1
30Wednesday, May 5, 2010
![Page 31: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/31.jpg)
31
And a few more...Sorry I couldn’t help myself!
31Wednesday, May 5, 2010
![Page 32: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/32.jpg)
32
And a few more...Pipelined Table Functions
Loop CONTINUE Statement
“Simple” Types:
SIMPLE_FLOAT
SIMPLE_INTEGER
SIMPLE_DOUBLE
PL/SQL Function Result Cache
More control over Triggers:
ENABLE
DISABLE
FOLLOWS
IGNORE_ROW_ON_DUPKEY_INDEX hint
Analytic Functions 2.0
DBMS_PARALLEL_EXECUTE package
Scheduler Improvements:
File Watcher
Email Notification
Remote Database Jobs
XStream API
XML DB Improvements
Binary XML
XDB Repository Improvements
XMLIndex Improvements
XMLType Partitioning
32Wednesday, May 5, 2010
![Page 33: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/33.jpg)
33
Burning Questions?
33Wednesday, May 5, 2010
![Page 34: Top Ten List - New York Oracle User Group - NYOUG](https://reader035.fdocuments.in/reader035/viewer/2022071600/613d0f91736caf36b758d943/html5/thumbnails/34.jpg)
For more informationOracle Home Page:http://www.oracle.com
Oracle Technology Network: http://otn.oracle.com
Oracle Search: http://search.oracle.com
Oracle Iron Man 2 Information:http://www.oracle.com/us/ironman2/index.html
34Wednesday, May 5, 2010