You are on page 1of 73

11 things about Oracle Database 11g Release 2 Thomas Kyte http://asktom.oracle.

com/

Do it yourself Parallelism

Incrementally modify a table in parallel

• Used to do this manually all of the time – Search for ‘diy parallel’ on asktom… – Spent part of a chapter on ‘how to’ in Expert Oracle Database Architecture • – e d I split by rowid ranges Split table into N equi-sized, non-overlapping chunks – Create a job passing in th low and high rowids for each range – Job would process “where rowid between :lo an :hi”

• Or by primary key ranges using NTILE() • DBMS_PARALLEL_EXECUTE automates both appr oaches and makes it easy (and more functional)

ops$tkyte%ORA11GR2> exec dbms_stats. ops$tkyte%ORA11GR2> select blocks. PL /SQL procedure successfully completed. blocks /10 from user_tables where table_name = T . T ).gather_table_stats( user. BLOCKS BLOCKS/10 ---------.--------1044 104.Incrementally modify a table in parallel ops$tkyte%ORA11GR2> create table t 2 as 3 select * 4 from all_objects 5 / Table created.4         .

6 etime timestamp 7 ) 8 / Table created. 4 nro ws number. 5 stime timestamp. 3 hi_rowid rowid.Incrementally modify a table in parallel ops$tkyte%ORA11GR2> create table log 2 ( lo_rowid rowid. .

6 begin 7 insert int o log (lo_rowid. 19 end. 5 l_cnt number. 14 1 5 update log 16 set etime = systimestamp. 10 11 update t set object_name = lower(object_name) 12 where rowid between p_lo_rowid and p_hi_rowid. p_hi_rowid in rowid ) 3 as 4 l_rid rowid.hi_rowid. . 17 nrows = l_cnt 18 where rowid = l_ri d.systimestamp) 9 returning rowid into l_rid. 20 / Procedure created.Incrementally modify a table in parallel ops$tkyte%ORA11GR2> create or replace 2 procedure do_update( p_lo_rowid in rowid .stime) 8 values (p_lo_rowid. 13 l_cnt := sql%rowcount.p_hi_rowid.

end_rowid 2 from dba_parallel_execute_chunks 3 where task_name = update t 4 / CHUNK_ID ---------194 193 … STATUS -------------------U NASSIGNED UNASSIGNED START_ROWID -----------------AAASTlAAEAAAAdkAAA AAASTlAAEAA AAcAAAA END_ROWID -----------------AAASTlAAEAAAAd/CcP AAASTlAAEAAAAdjCcP                 .Incrementally modify a table in parallel ops$tkyte%ORA11GR2> begin 2 dbms_parallel_execute. 9 en d. 8 chunk_size => 100).create_task( update t ). status. start_rowid. 5 table_o wner => user. 7 by_row => false.create_chunks_by_rowid 4 ( task_name => update t . 3 dbm s_parallel_execute. 10 / PL/SQL procedure successfully completed. 6 table_name => T . ops$tkyte%ORA11GR2> select chun k_id.

Incrementally modify a table in parallel ops$tkyte%ORA11GR2> begin 2 dbms_parallel_execute. ops$tkyte%ORA11GR2> select chunk_id.NATIVE. 5 language_ flag => DBMS_SQL. 8 / PL/SQL procedure su ccessfully completed. . end_rowid 2 from dba_parallel_execute_chunks 3 where task_name = update t 4 / CHUNK_ID ---------195 196 … STATUS -------------------PROCESSED PROCESSED START_RO WID -----------------AAASTlAAEAAAAeAAAA AAASTlAAEAAAAfkAAA END_ROWID ----------------AAASTlAAEAAAAfjCcP AAASTlAAEAAAAf/CcP             . 4 sql_stmt => begin do_update( :start_id. start_rowid. end. 7 end. status.run_task 3 ( task_name => upd ate t . :end_id ). 6 parallel_level => 2 ).

start_rowid.drop_task( update t ). status. end_rowid 2 from dba_parallel_execute_chunks 3 where task _name = update t 4 / no rows selected         . ops$tkyte%ORA11GR2> select chunk_id .Incrementally modify a table in parallel ops$tkyte%ORA11GR2> begin 2 dbms_parallel_execute. 4 / PL/SQL procedure successfully completed. 3 end.

38.571049 +000000000 00:00:00.38.605693 AM 07-OCT-09 11. .38.38. NROWS --------1950 6747 1911 6662 1952 6920 1999 6997 … 6663 1914 6653 STIME ----------------------------07-OCT-09 11.060847 +000000000 00:00:00.150791 +000000000 0 0:00:00.056220 +000000000 00 :00:00.029193 +000000000 00:00:00.725649 AM 07-OCT-09 11.38.146901 +000000000 00:00:00.635749 AM ELA -------------------------+000000000 00:00:00.057181 +000000000 00:00:00.37. stime.38.38.008060 +000000000 00:00:00.441904 AM 07-OCT-09 11.Incrementally modify a table in parallel ops$tkyte%ORA11GR2> select nrows.499673 AM 07-OCT-09 11.38.152851 +000000000 00:00:00.069751 AM 07-OCT-09 11.38.37.38.39.38 .37.519093 AM 07OCT-09 11. etime-stime ela from log.38.577507 AM 07-OCT-09 11.38.37.37.533909 +000000000 00:00:00.734748 AM 07-OCT-09 11.38.364203 AM 07-OCT-09 11.38.072111 AM 07-OCT-09 11.447706 32 rows selected.38.

Analytics are the coolest thing to happen to SQL since the keyword SELECT .

More Analytics! • Long awaited LISTAGG – First did STRAGG in 9iR2 with user defined aggregates – Oracle Database 10g gave u s a sys_connect_by_path ‘trick’ – Oracle Database 11g Release 2 makes it ‘easy’ .

/ TURNER. MILLER start with rn = 1 20 ADAMS. ename. 3) enames from ( select deptno. MARTIN.Analytics Rock and Roll SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 select deptno. JONES. row_numb er() over (partition by deptno order by ename) rn from emp DEPTNO ENAMES --------. KING. substr( max(sy s_connect_by_path(ename. .-------------------) 10 CLARK. order by deptno JAMES. WARD     . connect by prior deptno = deptno SCOTT. )). FORD . SMITH and prior rn+1 = rn group by deptno 30 ALLEN. BLAKE.

. ) 3 within group 4 (order by ename) e names 5 from emp 6 group by deptno 7 order by deptno 8 / DEPTNO ---------10 20 E NAMES -------------------CLARK. BLAKE. JONES. KING. SCOTT. MILLER ADAMS. WARD     . MARTIN. TURNER.Analytics Rock and Roll SQL> select deptno. 2 listagg( ename. SMITH 30 ALLEN. FORD. JAMES.

ename 19 / . 6 first_value(ename) 7 over (partition by deptno 8 order by ename) "1st ename". 2 ename. 12 last_value(ename) 13 over (partition by deptno 14 order by en ame 15 rows between current row 16 and unbounded following) "last ename" 17 from emp 18 order by deptno.3) 10 over (partition by deptno 11 order by enam e) "3rd ename". 3 row_number() 4 over (partition by deptno 5 order by ename) rn.Analytics Rock and Roll SQL> select deptno. 9 nth_value(ename.

12 last_value(ename) 13 over (partition by deptno 14 order by en ame 15 rows between current row 16 and unbounded following) "last ename" 17 from emp 18 order by deptno. 6 first_value(ename) 7 over (partition by deptno 8 order by ename) "1st ename".Analytics Rock and Roll DEPTNO ENAME RN 1st e 3rd ena ---------.3) 10 over (partition by deptno 11 order by enam e) "3rd ename". 2 ename.-. ename 19 / JAMES JAMES JAMES JAMES .------10 CLARK 1 CLAR K KING 2 CLARK MILLER 3 CLARK MILLER 20 ADAMS FORD JONES SCOTT SMITH 30 ALLEN BL AKE JAMES MARTIN TURNER WARD 1 2 3 4 5 1 2 3 4 5 6 ADAMS ADAMS ADAMS JONES ADAMS JONES ADAMS JONES ALLEN ALLEN ALLEN ALLEN ALLEN ALLEN last en ------MILLER MILL ER MILLER SMITH SMITH SMITH SMITH SMITH WARD WARD WARD WARD WARD WARD SQL> select deptno.-------. 3 row_number() 4 over (partition by deptno 5 order by ename) rn. 9 nth_value(ename.----.

Execute on a directory .

External Tables can run code now • External tables allow for a preprocessor – – – – Program is run when you SELECT from external table The ‘location’ is passed to the s cript/executable The executable does whatever it wants and writes to stdout Stdo ut is treated as the input file • We need a way to control who can do what • GRANT EXECUTE ON DIRECTORY handles that .

EXECUTE and PREPROCESSOR ops$tkyte%ORA11GR2> CREATE or replace DIRECTORY load_dir 2 AS /mnt/hgfs/docs/Pr esentations/Seminar/11gr2 3 / Directory created. ops$tkyte%ORA11GR2> CREATE or replace DIRECTORY exec_dir 2 AS /mnt/hgfs/docs/Presentations/Seminar/11gr2 3 / Directory created.         .

7 "HIREDATE" DATE.2).         .sh 18 FIEL DS TERMINATED BY "|" LDRTRIM 19 ) 20 location ( emp.gz ) 21 ) 22 / Table cr eated. 4 "ENAME" VARCH AR2(10).dat. 5 "JOB" VARCHAR2(9). 10 "DEPTNO" NUMBER(2) 11 ) 12 ORGANIZATION extern al 13 ( TYPE oracle_loader 14 DEFAULT DIRECTORY load_dir 15 ACCESS PARAMETERS 16 ( RECORDS DELIMITED BY NEWLINE 17 preprocessor exec_dir: run_gunzip. 8 "SAL" NUMB ER(7.2). 6 "MGR" NUMBER(4).EXECUTE and PREPROCESSOR ops$tkyte%ORA11GR2> CREATE TABLE EMP_ET 2 ( 3 "EMPNO" NUMBER(4). 9 "COMM" NUMBER(7.

was "emp.sh #!/bin/bash /usr/bin/gunzip -c $* ops$tkyte%ORA11GR2> select empn o. from Unix. EMPNO ---------7369 7499 7521 7566 7654 ENAME ---------SMITH ALLEN WARD JONES MARTIN . ename from emp_et where rownum <= 5. dat".dat.gz emp. last modified: Wed Oct 7 12:48:53 2009 ops$tkyte%ORA11GR2> !cat run_gunzip.gz: gzip compressed data.EXECUTE and PREPROCESSOR ops$tkyte%ORA11GR2> !file emp.dat.

EXECUTE and PREPROCESSOR.sh 11 FIELDS TERMINATED BY "|" LDRTRIM 12 ) 13 location ( run_ls. interesting idea… ops$tkyte%ORA11GR2> CREATE TABLE ls 2 ( 3 line varchar2(255) 4 ) 5 ORGANIZATION external 6 ( TYPE oracle_loader 7 DEFAULT DIRECTORY load_dir 8 ACCESS PARAMETERS 9 ( RECORDS DELIMITED BY NEWLINE 10 preprocessor exec_dir: run_ls.sh ) 14 ) 15 / Table creat ed.         .

sql LS_26122.sql ebr.log run_gunzip.log emp_et.gz EMP_ET_26122. LINE -------------------------------------------------------------11 things about 11gr2.ppt diyp.ctl emp.sh run_ls .sh 11 rows selected.EXECUTE and PREPROCESSOR. interesting idea… ops$tkyte%ORA11GR2> select * from ls.old.sql ebr.dat.sql emp. .

Recursive Subquery Factoring .

you have been using conne ct by for 22 years – in which case it looks confusing .Recursive Subquery Factoring • ANSI SQL replacement for connect by • Can be – Easier to understand than connect by – Unless of course.

Recursive Subquery Factoring ops$tkyte%ORA11GR2> with emp_data(ename,empno,mgr,l) 2 as 3 (select ename, empno , mgr, 1 lvl from emp where mgr is null 4 union all 5 select emp.ename, emp.empn o, emp.mgr, ed.l+1 6 from emp, emp_data ed 7 where emp.mgr = ed.empno 8 ) 9 SEAR CH DEPTH FIRST BY ename SET order_by 10 select l, 11 lpad( * ,2*l, * )||ename nm 12 from emp_data 13 order by order_by 14 /

   

   

Recursive Subquery Factoring L ---------1 2 3 3 3 3 3 2 3 2 3 4 3 4 NM -------------------**KING ****BLAKE ******ALLEN ******JAMES ******MARTIN **** **TURNER ******WARD ****CLARK ******MILLER ****JONES ******FORD ********SMITH ** ****SCOTT ********ADAMS 14 rows selected.

Recursive Subquery Factoring ops$tkyte%ORA11GR2> with data(r) 2 as 3 (select 1 r from dual 4 union all 5 sele ct r+1 from data where r < 5 6 ) 7 select r, sysdate+r 8 from data; R ---------1 2 3 4 5 SYSDATE+R --------08-OCT-09 09-OCT-09 10-OCT-09 11-OCT-09 12-OCT-09

Improved Time Travel .

html • Article by Jon athan Gennick on this feature for more info • How does it work… .Improved Time Travel • Flashback Data Archive – Query data as of 5 days. 5 weeks.com/technology/oramag/oracle/08jul/o48totalrecall. 5 months. 5 years – whatever – in the past – http:// www.oracle.

How Does Flashback Data Archive Work? • Primary source for history is the undo data • History is stored in automatically c reated history tables inside the archive • Transactions and its undo records on tr acked tables marked for archival – Undo records not recycled until history is archived • History is captured asynchronously by new background process (fbda) – Default capture interval is 5 minutes – Capture interval is self-tuned based on sy stem activities – Process tries to maximize undo data reads from buffer cache for better performance – INSERTs do not generate history records .

g. Modify Column – Drop.Oracle Database 11g Release Total Recall Schema Evolution Support • Alter base table – history table automatically adjusts – Drop. Rename. Truncate Table • Flashback query supported across DDL changes Drop Column Add Column Add Column • Complex DDL changes (e. Truncate Partition – Rename. table split) accommodated time Flashback Version Query – Associate/Diassociate history table via DBMS_FLASHBACK_ARCHIVE package .

You’ve got Mail .

File Watchers • As files arrive in some directory – An event is generated – And your code can be invoked to deal with it… .

create_credential( 3 credential_name => watch_credential . 6 end.           . 5 password => ‘foobar ). 7 / PL/SQL procedure successfully completed.File Watchers ops$tkyte%ORA11GR2> begin 2 dbms_scheduler. 4 username => tkyte .

5 contents clob 6 ).File Watchers ops$tkyte%ORA11GR2> create or replace directory MY_FILES as /home/tkyte/files 2 / Directory created. 4 loaded timestamp. ops$tkyte%ORA11GR2> create table files 2 ( 3 file_name va rchar2(100). Table created.     .

fileopen( l_bfile ).         . 13 14 l_bfile := bfilename( MY_FIL ES .directory_path || / || p_payload.file_times tamp.actual_file_name ). 10 p_payload.actual_file_name. dbms_lob. 19 / Procedure created. loadfromfile( l_clob.getlength(l_bfile) ). 17 dbms_lob.scheduler_filewatcher_result) 3 is 4 l_clob clob.File Watchers ops$tkyte%ORA11GR2> create or replace procedure process_files 2 (p_payload in sy s. file_name. 6 begin 7 i nsert into files 8 (loaded. 11 empty _clob() 12 ) returning contents into l_clob. 5 l_bfile bfile. 18 end. contents ) 9 values (p_payload. l_bfile. 16 dbms_lob. p_payload. 15 dbms_lob.filecl ose( l_bfile ).

6 number_of_arguments => 1.create_program( 3 program_name => fi le_watcher . 11 argument_position => 1). 5 program_action => Process_ Files . 14 / PL/SQL procedure successfully completed. 8 dbms_scheduler.define _metadata_argument( 9 program_name => file_watcher . 13 end.                         .enable( file_watch er ).File Watchers ops$tkyte%ORA11GR2> begin 2 dbms_scheduler. 12 dbms_scheduler. 10 metadata_attribute => event_message . 7 enabled => false). 4 program_type => stored_procedure .

                .File Watchers ops$tkyte%ORA11GR2> begin 2 dbms_scheduler. 5 file_name = > * . 8 enabled => false). 7 destination => null. 6 credential_name => watch_credential . 4 directory_path => /home/tkyte/files . 9 end.create_file_watcher( 3 file_watcher_n ame => my_file_watcher . 10 / PL/SQL procedure successfully completed.

create_job( 3 job_name => my_file_jo b . 7 auto_drop => false. PL/SQL procedure s uccessfully completed. ops$tkyte%ORA11GR 2> exec dbms_scheduler. 5 event_condition => tab.file_s ize > 10 . 10 end.my_file_job ).File Watchers ops$tkyte%ORA11GR2> begin 2 dbms_scheduler.enable( my_file_watcher. 4 program_name => file_watcher .                     . 6 queue_spec => my_file_watcher . 8 enabled => false).user_data. 11 / PL/SQL procedure successfully completed.

37.--------------/home/tkyte/files /file4.22. ho w are you . ho w are you hello world. ho w are you hello world. h o w are you hello world.000000 PM hello world.-----------------------------.txt 07-OCT-09 07.File Watchers ops$tkyte%ORA11GR2> select * from files. FILE_NAME LOADED CONTENTS ----------------------------.

Deferred Segment Creation .

etc) normally allocate an initial extent • They might b e small. .Deferred Segment Creation • Segments (tables. indexes. but they exist • If you do something “small” (or fast) over and over a lot – it gets “big” (or slow) • Many third party applications create thousands of tables – And then use 100 of them • Deferred segment creation allows us to put off initial extent allocation until t he first row is put into a segment.

Session altered.---------T1 0 655 36 T1_PK 0 65536 T1_Y 0 65536 T1_Z_LOB 0 65536 T1_Z_LOBIDX 0 65536 . 8 z clob 9 ) 10 lob( z ) 11 store as t1_z_lob 12 (index t1_z_lob idx). SQL> select segment_name.Deferred Segment Creation SQL> alter session set 2 deferred_segment_creation=false. Table created.---------. SEGMENT_NAM EXTENT_ID BYTES ----------. SQL> create table t1 2 ( x int 3 constraint t1_pk 4 primary key. 5 y int 6 constraint t1_y 7 unique. 2 extent_id. 3 bytes 4 from user_extents 5 order by se gment_name.

Table created. 8 z clob 9 ) 10 lob( z ) 11 store as t2_z_lob 12 (index t2_z_lobi dx).Deferred Segment Creation SQL> alter session set 2 deferred_segment_creation=true.---------T1 0 655 36 T1_PK 0 65536 T1_Y 0 65536 T1_Z_LOB 0 65536 T1_Z_LOBIDX 0 65536 . 5 y int 6 constraint t2_y 7 unique. Session altered.---------. SQL> c reate table t2 2 ( x int 3 constraint t2_pk 4 primary key. SEGMENT_NAM EXTENT_ID BYTES ----------. 3 bytes 4 from user_extents 5 order by se gment_name. 2 extent_id. No Change! SQL> select segment_name.

hello world ). 3 bytes 4 from user_extents 5 order by segment_name. SQL> select s egment_name.---------.---------T1 0 65536 T1_PK 0 65 536 T1_Y 0 65536 T1_Z_LOB 0 65536 T1_Z_LOBIDX 0 65536 T2 0 65536 T2_PK 0 65536 T 2_Y 0 65536 T2_Z_LOB 0 65536 T2_Z_LOBIDX 0 65536 10 rows selected. 2.     . S EGMENT_NAM EXTENT_ID BYTES ----------. 1 row created. 2 extent_id.Deferred Segment Creation SQL> insert into t2 values ( 1.

Flash Cache .

users often use hundreds of drives today – Flash enables I/O t hroughput without all the drives – Large jobs complete faster .Oracle Database 11g Release 2 Reduce I/O bandwidth requirement with Flash Cache • A transparent extension of the database buffer cache using solid-state disk (SSD ) technology – SSD acts as a Level 2 cache (SGA is Level 1) • Faster than disk (100x faster for r eads) • Cheaper than memory ($50 per gigabyte) • Large capacity (hundreds of gigabyt es per flash disk) • Fewer drives and better performance – For I/O throughput.

ora parameters: • db_flash_cache_file = <filename> • Specifies the path to the flash disk • db_flash_cache_size=<size> • Specifies the amount of flash disk to use 360 GB Magnetic Disks .Flash Cache How it works Extended Buffer Cache 16 GB SGA Memory 120 GB Flash Cache Install Flash Drive in the Host Server • Set two init.

Blocks read into buffer cache 2. Dirty blocks flushed to disk Cold Data 360 GB Magnetic Disks .Flash Cache How it works Extended Buffer Cache Hot Data 16 GB SGA Memory 120 GB Flash Cache 1.

Clean blocks moved to Flash Cache based on LRU* (once SGA is full) 120 GB Flash Cache Warm Data 1.Flash Cache How it works Extended Buffer Cache Hot Data 16 GB SGA Memory 3. Dirty blocks flushed to disk Cold Data 360 GB Magnetic Disks * Headers for Flash Cached blocks kept in SGA . Blocks read into buffer cache 2.

Dirty blocks flushed to disk Cold Data 360 GB Magnetic Disks * Headers for Flash Cached blocks kept in SGA . Clean blocks moved to Flash Cache based on LRU* 120 GB Flash Cache Warm Data 1.Flash Cache 4. User Process reads blocks from SGA (copied from Flash Cache if not in SGA) Extended Buffer Cache Hot Data 16 GB SGA Memory 3. Blocks read into buffer cache 2.

Parallel Improved .

Automated Degree of Parallelism How it works Statement is hard parsed And optimizer determines the execution plan SQL statement If estimated time greater than threshold Optimizer determines ideal DOP PARALLEL_MIN_TIME_THRESHOLD If estimated time less than threshold Actual DOP = MIN(default DOP. ideal DOP) Statement executes serially Statement executes in parallel .

Parallel Statement Queuing How it works Statement is parsed and Oracle automatically determines DOP SQL statements If not enough parallel servers available queue 64 64 32 32 16 128 16 FIFO Queue If enough parallel servers available execute immediately When the required number of parallel servers become available the first stmt on the queue is dequeued and executed 8 128 .

In-Memory Parallel Execution How it works Determine the size of the table being looked at Table is a good candidate for In -Memory Parallel Execution SQL statement Fragments of Table are read into each node’s buffer cache Table is extremely small Table is extremely Large Read into the buffer cache on any node Only parallel server on the same RAC node will access each fragment Always use d irect read from disk .

Edition-based Redefinition .

Yes. this is here twice But only because It is the killer feature Of Oracle Data base 11g Release 2 It is worth 2 features Edition-based Redefinition! .

or (in hot-rollov er) vice-versa .Online Application Upgrade Edition-based redefinition • Code changes are installed in the privacy of a new edition • Data changes are made safely by writing only to new columns or new tables not seen by the old edition • An editioning view exposes a different projection of a table into each edition to allow each to see just its own columns • A crossedition trigger propagates data changes made by the old edition into the new edition’s columns.

ops$tk yte%ORA11GR2> grant create session. create procedure to demo 2 / Grant succeeded . .Online Application Upgrade Edition-based redefinition ops$tkyte%ORA11GR2> create user demo identified by demo 2 / User created. ops$tkyte%ORA11GR2> create edition version2 as child of ora$base 2 / Edition c reated.

5 end. 6 / Procedure created. demo%ORA11GR2> demo%ORA11GR2> c reate or replace procedure my_procedure 2 as 3 begin 4 dbms_output. 6 / P rocedure created.0 ).Online Application Upgrade Edition-based redefinition ops$tkyte%ORA11GR2> connect demo/demo Connected.put_line( He llo World. demo%ORA11GR2> cre ate or replace procedure my_procedure2 2 as 3 begin 4 my_procedure.     . 5 end. I am version 1.

0 PL/SQL procedure successfully completed. . I am version 1.Online Application Upgrade Edition-based redefinition demo%ORA11GR2> exec my_procedure2 Hello World.

.Online Application Upgrade Edition-based redefinition demo%ORA11GR2> connect / Connected. ops$tkyte%ORA11GR2> alter user demo enable e ditions 2 / User altered. ops$tkyte%ORA11GR2> grant use on edition version2 to d emo 2 / Grant succeeded.

demo%ORA11GR2> alter session se t edition = version2 2 / Session altered.Online Application Upgrade Edition-based redefinition ops$tkyte%ORA11GR2> connect demo/demo Connected. status. demo%ORA11GR2> set linesize 150 demo%O RA11GR2> select object_name. object_type. edition_name from user_objects 2 / OBJECT_NAME ---------------MY_PROCEDURE MY_PROCEDURE2 OBJECT_TYPE ------------PROCEDURE PROCEDURE STATUS ------VALID VALID EDITION_NAME --------------ORA$ BASE ORA$BASE .

de mo%ORA11GR2> select object_name. status. 6 / Procedure created. edition_name from user_obj ects 2 / OBJECT_NAME --------------MY_PROCEDURE2 MY_PROCEDURE OBJECT_TYPE -----------------PROCEDURE PROCEDURE STATUS ------VALID VALID EDITION_NAME ------------ORA$BASE VERSION2     .put_line( Hello World.0 ). 5 end. object_type. I am version 2.Online Application Upgrade Edition-based redefinition demo%ORA11GR2> create or replace procedure my_procedure 2 as 3 begin 4 dbms_outp ut.

CURRENT_EDITION_NAME ) ------------------------------------------------VERSION2 demo%ORA11GR2> exec my_procedure2 Hello World. current_edition_name ) FROM DUAL.Online Application Upgrade Edition-based redefinition demo%ORA11GR2> SELECT SYS_CONTEXT( userenv .0 PL/SQL procedure successfully completed.                 . I am vers ion 2. SYS_CONTEXT( USERENV .

current_edition_name ) FROM DUAL. SYS_CONTEXT( USERENV . demo%ORA11GR2> SELECT SYS_CONTEXT( u serenv . I am version 1.0 PL/SQL procedure successfully co mpleted.Online Application Upgrade Edition-based redefinition demo%ORA11GR2> connect demo/demo Connected. CURRENT_EDITI ON_NAME ) ---------------------------------------------ORA$BASE demo%ORA11GR2> e xec my_procedure2 Hello World.                 .

Online Application Upgrade Edition-based redefinition demo%ORA11GR2> alter session set edition = version2. current_edition_name ) FROM DUAL. Session altered. demo%ORA11 GR2> SELECT SYS_CONTEXT( userenv . SYS_CONTEX T( USERENV . I am version 2.                 .0 PL/SQ L procedure successfully completed. CURRENT_EDITION_NAME ) ---------------------------------------------VERSION2 demo%ORA11GR2> exec my_procedure2 Hello World.

<Insert Picture Here> How to get there .

8 10.6 .2 SQL Plan Management Automated SQL tuning ≥ 11.2.1.2 11.0.2.What are my upgrade paths? Predictable performance post-upgrade 9.0.0.1.5 ≥ 10.0.

com .oracle.For More Information search.com or oracle.