SlideShare uma empresa Scribd logo
1 de 57
11 things about Oracle Database 11g Release 2
Thomas Kyte
http://asktom.oracle.com/
1 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
• I split by rowid ranges
  – Split table into N equi-sized, non-overlapping chunks
  – Create a job passing in the low and high rowids for each
    range
  – Job would process “where rowid between :lo and :hi”
• Or by primary key ranges using NTILE()
• DBMS_PARALLEL_EXECUTE automates both
  approaches and makes it easy (and more functional)
                                                               Diyp.sql
Do It Yourself Parallelism
ops$tkyte%ORA11GR2> create table t
  2 as
  3 select *
  4    from stage
  5 /

Table created.

ops$tkyte%ORA11GR2> exec dbms_stats.gather_table_stats( user, 'T' );

PL/SQL procedure successfully completed.

ops$tkyte%ORA11GR2> select blocks, blocks/10
                      from user_tables where table_name = 'T';

    BLOCKS BLOCKS/10
---------- ----------
      1054      105.4
Do It Yourself Parallelism
ops$tkyte%ORA11GR2> begin
  2      dbms_parallel_execute.create_task('update t');
  3      dbms_parallel_execute.create_chunks_by_rowid
  4      ( task_name   => 'update t',
  5        table_owner => user,
  6        table_name => 'T',
  7        by_row      => false,
  8        chunk_size => 100);
  9 end;
 10 /

PL/SQL procedure successfully completed.
Do It Yourself Parallelism
ops$tkyte%ORA11GR2> select chunk_id, status, start_rowid, end_rowid
  2    from dba_parallel_execute_chunks
  3   where task_name = 'update t'
  4     and rownum <= 5
  5 /

  CHUNK_ID   STATUS                 START_ROWID          END_ROWID
----------   --------------------   ------------------   ------------------
       302   UNASSIGNED             AAAVplAAEAAAASIAAA   AAAVplAAEAAAASPCcP
       301   UNASSIGNED             AAAVplAAEAAAASAAAA   AAAVplAAEAAAASHCcP
       332   UNASSIGNED             AAAVplAAEAAATR4AAA   AAAVplAAEAAATR/CcP
       331   UNASSIGNED             AAAVplAAEAAATRwAAA   AAAVplAAEAAATR3CcP
       330   UNASSIGNED             AAAVplAAEAAATRoAAA   AAAVplAAEAAATRvCcP
Do It Yourself Parallelism
ops$tkyte%ORA11GR2> begin
  2      dbms_parallel_execute.run_task
  3      ( task_name      => 'update t',
  4        sql_stmt       => 'update t
  5                               set object_name = lower(object_name)
  6                            where rowid between :start_id
  7                                             and :end_id',
  8        language_flag => DBMS_SQL.NATIVE,
  9        parallel_level => 2 );
 10 end;
 11 /

PL/SQL procedure successfully completed.
Do It Yourself Parallelism
ops$tkyte%ORA11GR2> select chunk_id, status, start_rowid, end_rowid
  2    from dba_parallel_execute_chunks
  3   where task_name = 'update t'
  4     and rownum <= 5
  5 /

  CHUNK_ID   STATUS                 START_ROWID          END_ROWID
----------   --------------------   ------------------   ------------------
       303   PROCESSED              AAAVplAAEAAAASQAAA   AAAVplAAEAAAASXCcP
       304   PROCESSED              AAAVplAAEAAAASYAAA   AAAVplAAEAAAASfCcP
       305   PROCESSED              AAAVplAAEAAAASgAAA   AAAVplAAEAAAASnCcP
       306   PROCESSED              AAAVplAAEAAAASoAAA   AAAVplAAEAAAASvCcP
       307   PROCESSED              AAAVplAAEAAAASwAAA   AAAVplAAEAAAAS3CcP
2 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 us a sys_connect_by_path ‘trick’
  – Oracle Database 11g Release 2 makes it ‘easy’
Analytics Rock and Roll
SQL> select deptno,
  2         listagg( ename, '; ' )
  3         within group
  4         (order by ename) enames
  5    from emp
  6   group by deptno
  7   order by deptno
  8 /

    DEPTNO   ENAMES
----------   --------------------
        10   CLARK; KING; MILLER
        20   ADAMS; FORD; JONES;
             SCOTT; SMITH

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

                                                           14 rows selected.
3 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 script/executable
  –   The executable does whatever it wants and writes to stdout
  –   Stdout 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/Presentations/Seminar/11gr2'
  3 /

Directory created.

ops$tkyte%ORA11GR2> CREATE or replace DIRECTORY exec_dir
  2 AS '/mnt/hgfs/docs/Presentations/Seminar/programs'
  3 /

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


ops$tkyte%ORA11GR2> !file emp.dat.gz
emp.dat.gz: gzip compressed data, was "emp.dat", from Unix, last
  modified: Wed Oct 7 12:48:53 2009

ops$tkyte%ORA11GR2> !cat run_gunzip.sh
#!/bin/bash

/usr/bin/gunzip -c $*

ops$tkyte%ORA11GR2> select empno, ename from emp_et where rownum <= 5;

     EMPNO   ENAME
----------   ----------
      7369   SMITH
      7499   ALLEN
      7521   WARD
      7566   JONES
      7654   MARTIN
EXECUTE and PREPROCESSOR, 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'
 11      FIELDS TERMINATED BY "|" LDRTRIM
 12    )
 13    location ( 'run_ls.sh')
 14 )
 15 /

Table created.
EXECUTE and PREPROCESSOR, interesting idea…


ops$tkyte%ORA11GR2> select * from ls;

LINE
---------------------------------------------------------------
11 things about 11gr2.ppt
diyp.sql
ebr.old.sql
ebr.sql
emp.ctl
emp.dat.gz
EMP_ET_26122.log
emp_et.sql
LS_26122.log
run_gunzip.sh
run_ls.sh

11 rows selected.
4 Recursive Subquery Factoring
Recursive Subquery Factoring


• ANSI SQL replacement for connect by
• Can be
  – Easier to understand than connect by
  – Unless of course, you have been using connect by for 22
    years – in which case it looks confusing
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.empno, emp.mgr, ed.l+1
  6     from emp, emp_data ed
  7    where emp.mgr = ed.empno
  8 )
  9 SEARCH 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   NM
----------   --------------------
         1   **KING
         2   ****BLAKE
         3   ******ALLEN
         3   ******JAMES
         3   ******MARTIN
         3   ******TURNER
         3   ******WARD
         2   ****CLARK
         3   ******MILLER
         2   ****JONES
         3   ******FORD
         4   ********SMITH
         3   ******SCOTT
         4   ********ADAMS

14 rows selected.
Recursive Subquery Factoring


• ANSI SQL replacement for connect by
• Can be
  – Easier to understand than connect by
  – Unless of course, you have been using connect by for 22
    years – in which case it looks confusing
  – Used to solve Sudoku puzzles!
5 Improved Time Travel
How Does Flashback Data Archive Work?
• Primary source for history is the undo
  data
• History is stored in automatically created
  history tables inside the archive
• Transactions and its undo records on
  tracked 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 system
     activities
   – Process tries to maximize undo data reads from
     buffer cache for better performance
   – INSERTs do not generate history records
Oracle Database 11g Release
Total Recall Schema Evolution Support




                                
                                       Flashback Version Query
• Alter base table – history table automatically adjusts




                          
   – Drop, Rename, Modify Column




                            
   – Drop, Truncate Partition
   – Rename, Truncate Table
• Flashback query supported across DDL changes
                        




                              Column
                               Add

• Complex DDL changes (e.g. table split) accommodated
                              Column
                               Add

   – Associate/Diassociate history table via DBMS_FLASHBACK_ARCHIVE
                        



                                             time
                                             time




     package
                              Column
                               Drop
6 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…
7 Deferred Segment Creation
Deferred Segment Creation


• Segments (tables, indexes, etc) normally allocate an
  initial extent
• They might be small, 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 the first row is put into a
  segment.
Deferred Segment Creation


SQL> alter session set
  2 deferred_segment_creation=false;
Session altered.

SQL> create table t1                   SQL> select segment_name,
  2 ( x int                              2         extent_id,
  3    constraint t1_pk                  3         bytes
  4    primary key,                      4    from user_extents
  5    y int                             5   order by segment_name;
  6    constraint t1_y
  7    unique,                         SEGMENT_NAM EXTENT_ID       BYTES
  8    z clob                          ----------- ---------- ----------
  9 )                                  T1                   0      65536
 10 lob( z )                           T1_PK                0      65536
 11 store as t1_z_lob                  T1_Y                 0      65536
 12 (index t1_z_lobidx);               T1_Z_LOB             0      65536
Table created.                         T1_Z_LOBIDX          0      65536
Deferred Segment Creation


SQL> alter session set
  2 deferred_segment_creation=true;            No Change!
Session altered.

SQL> create table t2                  SQL> select segment_name,
  2 ( x int                             2         extent_id,
  3    constraint t2_pk                 3         bytes
  4    primary key,                     4    from user_extents
  5    y int                            5   order by segment_name;
  6    constraint t2_y
  7    unique,                        SEGMENT_NAM EXTENT_ID       BYTES
  8    z clob                         ----------- ---------- ----------
  9 )                                 T1                   0      65536
 10 lob( z )                          T1_PK                0      65536
 11 store as t2_z_lob                 T1_Y                 0      65536
 12 (index t2_z_lobidx);              T1_Z_LOB             0      65536
Table created.                        T1_Z_LOBIDX          0      65536
Deferred Segment Creation
SQL> insert into t2 values ( 1, 2, 'hello world' );
1 row created.

SQL> select segment_name,
  2         extent_id,
  3         bytes
  4    from user_extents
  5   order by segment_name;

SEGMENT_NAM EXTENT_ID       BYTES
----------- ---------- ----------
T1                   0      65536
T1_PK                0      65536
T1_Y                 0      65536
T1_Z_LOB             0      65536
T1_Z_LOBIDX          0      65536
T2                   0      65536
T2_PK                0      65536
T2_Y                 0      65536
T2_Z_LOB             0      65536
T2_Z_LOBIDX          0      65536
10 rows selected.
8 Flash Cache
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 reads)
      • Cheaper than memory ($50 per gigabyte)
      • Large capacity (hundreds of gigabytes per flash disk)
• Fewer drives and better performance
   – For I/O throughput, users often use hundreds of drives today
   – Flash enables I/O throughput without all the drives
   – Large jobs complete faster
9 Parallel Improved
Automated Degree of Parallelism
     How it works


   SQL               Statement is hard parsed
                     And optimizer determines      If estimated time          Optimizer determines
statement                                       greater than threshold             ideal DOP
                        the execution plan




                                                           Actual DOP = MIN(default DOP, ideal DOP)
       If estimated time
     less than threshold
    PARALLEL_MIN_TIME_THRESHOLD




                                                                               Statement
                                                                           executes in parallel
                        Statement
                     executes serially
Parallel Statement Queuing
     How it works


   SQL             Statement is parsed       If not enough parallel
statements       and Oracle automatically   servers available queue
                     determines DOP


                                             64        64
                                                       32     32
                                                              16      128
                                                                       16

                                                     FIFO Queue

                                                      When the required
                                                  number of parallel servers
           If enough parallel                     become available the first
           servers available                         stmt on the queue is
         execute immediately                       dequeued and executed


                                8
                                                                               128
In-Memory Parallel Execution
     How it works


   SQL           Determine the size of the           Table is a good candidate   Fragments of Table are
statement         table being looked at               for In-Memory Parallel      read into each node’s
                                                             Execution                buffer cache




                                              Table is
Table is extremely small                  extremely Large
                   Read into the buffer
                   cache on any node




                                                                                 Only parallel server on
                                                                                  the same RAC node
                                                                                    will access each
                                                       Always use direct read           fragment
                                                             from disk
10 Edition-based
Redefinition
Yes, this is here twice
       But only because
      It is the killer feature
Of Oracle Database 11g Release 2
      It is worth 2 features




    10+Edition-based
    Redefinition!
DEMONSTRATION

Edition-based
 Redefinition
      ebr.sql
Online Application Upgrade
Edition-based redefinition



ops$tkyte%ORA11GR2> create user demo identified by demo
  2 /

User created.

ops$tkyte%ORA11GR2> grant create session, create procedure to demo
  2 /

Grant succeeded.

ops$tkyte%ORA11GR2> create edition version2 as child of ora$base
  2 /

Edition created.
Online Application Upgrade
Edition-based redefinition


ops$tkyte%ORA11GR2> connect demo/demo
Connected.
demo%ORA11GR2>
demo%ORA11GR2> create or replace procedure my_procedure
  2 as
  3 begin
  4     dbms_output.put_line( 'Hello World, I am version 1.0' );
  5 end;
  6 /
Procedure created.

demo%ORA11GR2> create or replace procedure my_procedure2
  2 as
  3 begin
  4     my_procedure;
  5 end;
  6 /
Procedure created.
Online Application Upgrade
Edition-based redefinition


demo%ORA11GR2> exec my_procedure2
Hello World, I am version 1.0

PL/SQL procedure successfully completed.
Online Application Upgrade
Edition-based redefinition


demo%ORA11GR2> connect /
Connected.
ops$tkyte%ORA11GR2> alter user demo enable editions
  2 /

User altered.

ops$tkyte%ORA11GR2> grant use on edition version2 to demo
  2 /

Grant succeeded.
Online Application Upgrade
Edition-based redefinition


ops$tkyte%ORA11GR2> connect demo/demo
Connected.
demo%ORA11GR2> alter session set edition = version2
  2 /

Session altered.

demo%ORA11GR2> set linesize 150
demo%ORA11GR2> select object_name, object_type, status,
  edition_name from user_objects
  2 /

OBJECT_NAME        OBJECT_TYPE      STATUS    EDITION_NAME
----------------   --------------   -------   ---------------
MY_PROCEDURE       PROCEDURE        VALID     ORA$BASE
MY_PROCEDURE2      PROCEDURE        VALID     ORA$BASE
Online Application Upgrade
Edition-based redefinition


demo%ORA11GR2> create or replace procedure my_procedure
  2 as
  3 begin
  4     dbms_output.put_line( 'Hello World, I am version 2.0' );
  5 end;
  6 /
Procedure created.

demo%ORA11GR2> select object_name, object_type, status, edition_name
  from user_objects
  2 /

OBJECT_NAME       OBJECT_TYPE           STATUS    EDITION_NAME
---------------   -------------------   -------   --------------
MY_PROCEDURE2     PROCEDURE             VALID     ORA$BASE
MY_PROCEDURE      PROCEDURE             VALID     VERSION2
Online Application Upgrade
Edition-based redefinition


demo%ORA11GR2> SELECT SYS_CONTEXT('userenv',
  'current_edition_name') FROM DUAL;

SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME')
--------------------------------------------------
VERSION2

demo%ORA11GR2> exec my_procedure2
Hello World, I am version 2.0

PL/SQL procedure successfully completed.
Online Application Upgrade
Edition-based redefinition


demo%ORA11GR2> connect demo/demo
Connected.
demo%ORA11GR2> SELECT SYS_CONTEXT('userenv',
  'current_edition_name') FROM DUAL;

SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME')
----------------------------------------------
ORA$BASE

demo%ORA11GR2> exec my_procedure2
Hello World, I am version 1.0

PL/SQL procedure successfully completed.
Online Application Upgrade
Edition-based redefinition


demo%ORA11GR2> alter session set edition = version2;

Session altered.

demo%ORA11GR2> SELECT SYS_CONTEXT('userenv',
  'current_edition_name') FROM DUAL;

SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME')
-----------------------------------------------
VERSION2

demo%ORA11GR2> exec my_procedure2
Hello World, I am version 2.0

PL/SQL procedure successfully completed.
<Insert Picture Here>



How to get there
What are my upgrade paths?
Predictable performance post-upgrade




                    9.2.0.8
                    9.2.0.8




                    10.1.0.5
                    10.1.0.5


                       ≥
                       ≥
                    10.2.0.2
                    10.2.0.2                  11.2
                                              11.2

                                       SQL Plan Management
                                       Automated SQL tuning
                       ≥
                       ≥
                    11.1.0.6
                    11.1.0.6
For More Information




             search.oracle.com




                       or
                 oracle.com
11 things about 11gr2

Mais conteúdo relacionado

Mais procurados

MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorialGiuseppe Maxia
 
SQL techniques for faster applications
SQL techniques for faster applicationsSQL techniques for faster applications
SQL techniques for faster applicationsConnor McDonald
 
Connor McDonald Partitioning
Connor McDonald PartitioningConnor McDonald Partitioning
Connor McDonald PartitioningInSync Conference
 
Database Management System
Database Management SystemDatabase Management System
Database Management SystemHitesh Mohapatra
 
SQL WORKSHOP::Lecture 11
SQL WORKSHOP::Lecture 11SQL WORKSHOP::Lecture 11
SQL WORKSHOP::Lecture 11Umair Amjad
 
Boost performance with MySQL 5.1 partitions
Boost performance with MySQL 5.1 partitionsBoost performance with MySQL 5.1 partitions
Boost performance with MySQL 5.1 partitionsGiuseppe Maxia
 
Oracle SQL AND PL/SQL
Oracle SQL AND PL/SQLOracle SQL AND PL/SQL
Oracle SQL AND PL/SQLsuriyae1
 

Mais procurados (20)

MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorial
 
Les01 Writing Basic Sql Statements
Les01 Writing Basic Sql StatementsLes01 Writing Basic Sql Statements
Les01 Writing Basic Sql Statements
 
Les12
Les12Les12
Les12
 
Les04 Displaying Data From Multiple Table
Les04 Displaying Data From Multiple TableLes04 Displaying Data From Multiple Table
Les04 Displaying Data From Multiple Table
 
Les02 Restricting And Sorting Data
Les02 Restricting And Sorting DataLes02 Restricting And Sorting Data
Les02 Restricting And Sorting Data
 
Les03
Les03Les03
Les03
 
SQL techniques for faster applications
SQL techniques for faster applicationsSQL techniques for faster applications
SQL techniques for faster applications
 
Connor McDonald Partitioning
Connor McDonald PartitioningConnor McDonald Partitioning
Connor McDonald Partitioning
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
SQL WORKSHOP::Lecture 11
SQL WORKSHOP::Lecture 11SQL WORKSHOP::Lecture 11
SQL WORKSHOP::Lecture 11
 
Les10 Creating And Managing Tables
Les10 Creating And Managing TablesLes10 Creating And Managing Tables
Les10 Creating And Managing Tables
 
Boost performance with MySQL 5.1 partitions
Boost performance with MySQL 5.1 partitionsBoost performance with MySQL 5.1 partitions
Boost performance with MySQL 5.1 partitions
 
Dbmsmanual
DbmsmanualDbmsmanual
Dbmsmanual
 
Les05 Aggregating Data Using Group Function
Les05 Aggregating Data Using Group FunctionLes05 Aggregating Data Using Group Function
Les05 Aggregating Data Using Group Function
 
Les10
Les10Les10
Les10
 
Oracle SQL AND PL/SQL
Oracle SQL AND PL/SQLOracle SQL AND PL/SQL
Oracle SQL AND PL/SQL
 
Les09
Les09Les09
Les09
 
Les00 Intoduction
Les00 IntoductionLes00 Intoduction
Les00 Intoduction
 
Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1
 
Oracle
OracleOracle
Oracle
 

Destaque

Fostering Continuous Improvement Through Retrospectives
Fostering Continuous Improvement Through RetrospectivesFostering Continuous Improvement Through Retrospectives
Fostering Continuous Improvement Through RetrospectivesNick Oostvogels
 
FCAT 2.0 reading presentation
FCAT 2.0 reading presentationFCAT 2.0 reading presentation
FCAT 2.0 reading presentationmelitoj
 
PRIV: Get the Most Out of Your New BlackBerry Smartphone
PRIV: Get the Most Out of Your New BlackBerry SmartphonePRIV: Get the Most Out of Your New BlackBerry Smartphone
PRIV: Get the Most Out of Your New BlackBerry SmartphoneBlackBerry
 
Agile product backlog for the gov project
Agile product backlog for the gov projectAgile product backlog for the gov project
Agile product backlog for the gov projectAlexey Kovalyov
 
Trazos de filosofia minima
Trazos de filosofia minimaTrazos de filosofia minima
Trazos de filosofia minimaalvmontoya
 
Delitos contra el servicio pm
Delitos contra el servicio pmDelitos contra el servicio pm
Delitos contra el servicio pmAireth Amaya
 
Resolucion cd. 390 Reglamento del Seguro General de Riesgos del Trabajo
Resolucion cd. 390 Reglamento del Seguro General de Riesgos del TrabajoResolucion cd. 390 Reglamento del Seguro General de Riesgos del Trabajo
Resolucion cd. 390 Reglamento del Seguro General de Riesgos del TrabajoOmar Suárez Oquendo
 
Lembaga Negara Pasca Amandemen UUD 1945
Lembaga Negara Pasca Amandemen UUD 1945Lembaga Negara Pasca Amandemen UUD 1945
Lembaga Negara Pasca Amandemen UUD 1945Muhamad Yogi
 
Can systematic reviews help identify what works and why?
Can systematic reviews help identify what works and why?Can systematic reviews help identify what works and why?
Can systematic reviews help identify what works and why?Carina van Rooyen
 
CORPORATE SOCIAL IRRESPONSIBILITY IN INDIA
CORPORATE SOCIAL IRRESPONSIBILITY IN INDIACORPORATE SOCIAL IRRESPONSIBILITY IN INDIA
CORPORATE SOCIAL IRRESPONSIBILITY IN INDIAAnkit Dabral
 
Echo 3 green module 1 vocabulary
Echo 3 green  module 1 vocabularyEcho 3 green  module 1 vocabulary
Echo 3 green module 1 vocabularyHelen Myers
 
Presentation or kuwait green building forum
Presentation or kuwait green building forum Presentation or kuwait green building forum
Presentation or kuwait green building forum greenbuilding
 
Introduction to Decision Science
Introduction to Decision ScienceIntroduction to Decision Science
Introduction to Decision Sciencekirwin3192
 
Top 10 function interview questions with answers
Top 10 function interview questions with answersTop 10 function interview questions with answers
Top 10 function interview questions with answersbrownmichael917
 
Manajemen sdm dalam konteks global
Manajemen sdm dalam konteks globalManajemen sdm dalam konteks global
Manajemen sdm dalam konteks globalSigit Sanjaya
 
DECRETO N° 1.257 FECHA: 13 de marzo de 1996 NORMAS SOBRE EVALUACION AMBIENTA...
DECRETO N° 1.257 FECHA: 13 de marzo de 1996  NORMAS SOBRE EVALUACION AMBIENTA...DECRETO N° 1.257 FECHA: 13 de marzo de 1996  NORMAS SOBRE EVALUACION AMBIENTA...
DECRETO N° 1.257 FECHA: 13 de marzo de 1996 NORMAS SOBRE EVALUACION AMBIENTA...Cartones 3D Grafic Art, C.A.
 

Destaque (20)

Fostering Continuous Improvement Through Retrospectives
Fostering Continuous Improvement Through RetrospectivesFostering Continuous Improvement Through Retrospectives
Fostering Continuous Improvement Through Retrospectives
 
FCAT 2.0 reading presentation
FCAT 2.0 reading presentationFCAT 2.0 reading presentation
FCAT 2.0 reading presentation
 
PRIV: Get the Most Out of Your New BlackBerry Smartphone
PRIV: Get the Most Out of Your New BlackBerry SmartphonePRIV: Get the Most Out of Your New BlackBerry Smartphone
PRIV: Get the Most Out of Your New BlackBerry Smartphone
 
Agile product backlog for the gov project
Agile product backlog for the gov projectAgile product backlog for the gov project
Agile product backlog for the gov project
 
Trazos de filosofia minima
Trazos de filosofia minimaTrazos de filosofia minima
Trazos de filosofia minima
 
NVQ Level 4 Results
NVQ Level 4 ResultsNVQ Level 4 Results
NVQ Level 4 Results
 
Delitos contra el servicio pm
Delitos contra el servicio pmDelitos contra el servicio pm
Delitos contra el servicio pm
 
Resolucion cd. 390 Reglamento del Seguro General de Riesgos del Trabajo
Resolucion cd. 390 Reglamento del Seguro General de Riesgos del TrabajoResolucion cd. 390 Reglamento del Seguro General de Riesgos del Trabajo
Resolucion cd. 390 Reglamento del Seguro General de Riesgos del Trabajo
 
Retie 2013
Retie 2013Retie 2013
Retie 2013
 
Trombocitosis esencial primaria
Trombocitosis esencial primariaTrombocitosis esencial primaria
Trombocitosis esencial primaria
 
Lembaga Negara Pasca Amandemen UUD 1945
Lembaga Negara Pasca Amandemen UUD 1945Lembaga Negara Pasca Amandemen UUD 1945
Lembaga Negara Pasca Amandemen UUD 1945
 
Can systematic reviews help identify what works and why?
Can systematic reviews help identify what works and why?Can systematic reviews help identify what works and why?
Can systematic reviews help identify what works and why?
 
CORPORATE SOCIAL IRRESPONSIBILITY IN INDIA
CORPORATE SOCIAL IRRESPONSIBILITY IN INDIACORPORATE SOCIAL IRRESPONSIBILITY IN INDIA
CORPORATE SOCIAL IRRESPONSIBILITY IN INDIA
 
Echo 3 green module 1 vocabulary
Echo 3 green  module 1 vocabularyEcho 3 green  module 1 vocabulary
Echo 3 green module 1 vocabulary
 
Presentation or kuwait green building forum
Presentation or kuwait green building forum Presentation or kuwait green building forum
Presentation or kuwait green building forum
 
Salud ocupacional
Salud ocupacionalSalud ocupacional
Salud ocupacional
 
Introduction to Decision Science
Introduction to Decision ScienceIntroduction to Decision Science
Introduction to Decision Science
 
Top 10 function interview questions with answers
Top 10 function interview questions with answersTop 10 function interview questions with answers
Top 10 function interview questions with answers
 
Manajemen sdm dalam konteks global
Manajemen sdm dalam konteks globalManajemen sdm dalam konteks global
Manajemen sdm dalam konteks global
 
DECRETO N° 1.257 FECHA: 13 de marzo de 1996 NORMAS SOBRE EVALUACION AMBIENTA...
DECRETO N° 1.257 FECHA: 13 de marzo de 1996  NORMAS SOBRE EVALUACION AMBIENTA...DECRETO N° 1.257 FECHA: 13 de marzo de 1996  NORMAS SOBRE EVALUACION AMBIENTA...
DECRETO N° 1.257 FECHA: 13 de marzo de 1996 NORMAS SOBRE EVALUACION AMBIENTA...
 

Semelhante a 11 things about 11gr2

The Five Best Things To Happen To SQL
The Five Best Things To Happen To SQLThe Five Best Things To Happen To SQL
The Five Best Things To Happen To SQLConnor McDonald
 
Using SQL to process hierarchies
Using SQL to process hierarchiesUsing SQL to process hierarchies
Using SQL to process hierarchiesConnor McDonald
 
MERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsMERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsAndrej Pashchenko
 
COIS 420 - Practice02
COIS 420 - Practice02COIS 420 - Practice02
COIS 420 - Practice02Angel G Diaz
 
SQL WORKSHOP::Lecture 2
SQL WORKSHOP::Lecture 2SQL WORKSHOP::Lecture 2
SQL WORKSHOP::Lecture 2Umair Amjad
 
SQL WORKSHOP::Lecture 4
SQL WORKSHOP::Lecture 4SQL WORKSHOP::Lecture 4
SQL WORKSHOP::Lecture 4Umair Amjad
 
SQL and PLSQL features for APEX Developers
SQL and PLSQL features for APEX DevelopersSQL and PLSQL features for APEX Developers
SQL and PLSQL features for APEX DevelopersConnor McDonald
 
Oracle12c For Developers
Oracle12c For DevelopersOracle12c For Developers
Oracle12c For DevelopersAlex Nuijten
 
Restricting and sorting data
Restricting and sorting data Restricting and sorting data
Restricting and sorting data HuzaifaMushtaq3
 
Les02[1]Restricting and Sorting Data
Les02[1]Restricting and Sorting DataLes02[1]Restricting and Sorting Data
Les02[1]Restricting and Sorting Datasiavosh kaviani
 
12c for Developers - Feb 2014
12c for Developers - Feb 201412c for Developers - Feb 2014
12c for Developers - Feb 2014Connor McDonald
 
COIS 420 - Practice04
COIS 420 - Practice04COIS 420 - Practice04
COIS 420 - Practice04Angel G Diaz
 
Les09[1]Manipulating Data
Les09[1]Manipulating DataLes09[1]Manipulating Data
Les09[1]Manipulating Datasiavosh kaviani
 

Semelhante a 11 things about 11gr2 (20)

The Five Best Things To Happen To SQL
The Five Best Things To Happen To SQLThe Five Best Things To Happen To SQL
The Five Best Things To Happen To SQL
 
Using SQL to process hierarchies
Using SQL to process hierarchiesUsing SQL to process hierarchies
Using SQL to process hierarchies
 
Sql2
Sql2Sql2
Sql2
 
MERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsMERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known Facets
 
COIS 420 - Practice02
COIS 420 - Practice02COIS 420 - Practice02
COIS 420 - Practice02
 
SQL WORKSHOP::Lecture 2
SQL WORKSHOP::Lecture 2SQL WORKSHOP::Lecture 2
SQL WORKSHOP::Lecture 2
 
SQL WORKSHOP::Lecture 4
SQL WORKSHOP::Lecture 4SQL WORKSHOP::Lecture 4
SQL WORKSHOP::Lecture 4
 
SQL and PLSQL features for APEX Developers
SQL and PLSQL features for APEX DevelopersSQL and PLSQL features for APEX Developers
SQL and PLSQL features for APEX Developers
 
Oracle12c For Developers
Oracle12c For DevelopersOracle12c For Developers
Oracle12c For Developers
 
Oracle12 for Developers - Oracle OpenWorld Preview AMIS
Oracle12 for Developers - Oracle OpenWorld Preview AMISOracle12 for Developers - Oracle OpenWorld Preview AMIS
Oracle12 for Developers - Oracle OpenWorld Preview AMIS
 
Restricting and sorting data
Restricting and sorting data Restricting and sorting data
Restricting and sorting data
 
chap2 (3).ppt
chap2 (3).pptchap2 (3).ppt
chap2 (3).ppt
 
Oracle
OracleOracle
Oracle
 
Les02[1]Restricting and Sorting Data
Les02[1]Restricting and Sorting DataLes02[1]Restricting and Sorting Data
Les02[1]Restricting and Sorting Data
 
Les02.pptx
Les02.pptxLes02.pptx
Les02.pptx
 
12c for Developers - Feb 2014
12c for Developers - Feb 201412c for Developers - Feb 2014
12c for Developers - Feb 2014
 
Les02
Les02Les02
Les02
 
SQLQueries
SQLQueriesSQLQueries
SQLQueries
 
COIS 420 - Practice04
COIS 420 - Practice04COIS 420 - Practice04
COIS 420 - Practice04
 
Les09[1]Manipulating Data
Les09[1]Manipulating DataLes09[1]Manipulating Data
Les09[1]Manipulating Data
 

Último

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...DrVipulVKapoor
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Unit :1 Basics of Professional Intelligence
Unit :1 Basics of Professional IntelligenceUnit :1 Basics of Professional Intelligence
Unit :1 Basics of Professional IntelligenceDr Vijay Vishwakarma
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
Employablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxEmployablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxryandux83rd
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfChristalin Nelson
 
physiotherapy in Acne condition.....pptx
physiotherapy in Acne condition.....pptxphysiotherapy in Acne condition.....pptx
physiotherapy in Acne condition.....pptxAneriPatwari
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 

Último (20)

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
Unit :1 Basics of Professional Intelligence
Unit :1 Basics of Professional IntelligenceUnit :1 Basics of Professional Intelligence
Unit :1 Basics of Professional Intelligence
 
Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,
 
Chi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical VariableChi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical Variable
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
Employablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxEmployablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptx
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdf
 
Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...
 
physiotherapy in Acne condition.....pptx
physiotherapy in Acne condition.....pptxphysiotherapy in Acne condition.....pptx
physiotherapy in Acne condition.....pptx
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 

11 things about 11gr2

  • 1. 11 things about Oracle Database 11g Release 2 Thomas Kyte http://asktom.oracle.com/
  • 2. 1 Do it yourself Parallelism
  • 3. 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 • I split by rowid ranges – Split table into N equi-sized, non-overlapping chunks – Create a job passing in the low and high rowids for each range – Job would process “where rowid between :lo and :hi” • Or by primary key ranges using NTILE() • DBMS_PARALLEL_EXECUTE automates both approaches and makes it easy (and more functional) Diyp.sql
  • 4. Do It Yourself Parallelism ops$tkyte%ORA11GR2> create table t 2 as 3 select * 4 from stage 5 / Table created. ops$tkyte%ORA11GR2> exec dbms_stats.gather_table_stats( user, 'T' ); PL/SQL procedure successfully completed. ops$tkyte%ORA11GR2> select blocks, blocks/10 from user_tables where table_name = 'T'; BLOCKS BLOCKS/10 ---------- ---------- 1054 105.4
  • 5. Do It Yourself Parallelism ops$tkyte%ORA11GR2> begin 2 dbms_parallel_execute.create_task('update t'); 3 dbms_parallel_execute.create_chunks_by_rowid 4 ( task_name => 'update t', 5 table_owner => user, 6 table_name => 'T', 7 by_row => false, 8 chunk_size => 100); 9 end; 10 / PL/SQL procedure successfully completed.
  • 6. Do It Yourself Parallelism ops$tkyte%ORA11GR2> select chunk_id, status, start_rowid, end_rowid 2 from dba_parallel_execute_chunks 3 where task_name = 'update t' 4 and rownum <= 5 5 / CHUNK_ID STATUS START_ROWID END_ROWID ---------- -------------------- ------------------ ------------------ 302 UNASSIGNED AAAVplAAEAAAASIAAA AAAVplAAEAAAASPCcP 301 UNASSIGNED AAAVplAAEAAAASAAAA AAAVplAAEAAAASHCcP 332 UNASSIGNED AAAVplAAEAAATR4AAA AAAVplAAEAAATR/CcP 331 UNASSIGNED AAAVplAAEAAATRwAAA AAAVplAAEAAATR3CcP 330 UNASSIGNED AAAVplAAEAAATRoAAA AAAVplAAEAAATRvCcP
  • 7. Do It Yourself Parallelism ops$tkyte%ORA11GR2> begin 2 dbms_parallel_execute.run_task 3 ( task_name => 'update t', 4 sql_stmt => 'update t 5 set object_name = lower(object_name) 6 where rowid between :start_id 7 and :end_id', 8 language_flag => DBMS_SQL.NATIVE, 9 parallel_level => 2 ); 10 end; 11 / PL/SQL procedure successfully completed.
  • 8. Do It Yourself Parallelism ops$tkyte%ORA11GR2> select chunk_id, status, start_rowid, end_rowid 2 from dba_parallel_execute_chunks 3 where task_name = 'update t' 4 and rownum <= 5 5 / CHUNK_ID STATUS START_ROWID END_ROWID ---------- -------------------- ------------------ ------------------ 303 PROCESSED AAAVplAAEAAAASQAAA AAAVplAAEAAAASXCcP 304 PROCESSED AAAVplAAEAAAASYAAA AAAVplAAEAAAASfCcP 305 PROCESSED AAAVplAAEAAAASgAAA AAAVplAAEAAAASnCcP 306 PROCESSED AAAVplAAEAAAASoAAA AAAVplAAEAAAASvCcP 307 PROCESSED AAAVplAAEAAAASwAAA AAAVplAAEAAAAS3CcP
  • 9. 2 Analytics are the coolest thing to happen to SQL since the keyword SELECT
  • 10. More Analytics! • Long awaited LISTAGG – First did STRAGG in 9iR2 with user defined aggregates – Oracle Database 10g gave us a sys_connect_by_path ‘trick’ – Oracle Database 11g Release 2 makes it ‘easy’
  • 11. Analytics Rock and Roll SQL> select deptno, 2 listagg( ename, '; ' ) 3 within group 4 (order by ename) enames 5 from emp 6 group by deptno 7 order by deptno 8 / DEPTNO ENAMES ---------- -------------------- 10 CLARK; KING; MILLER 20 ADAMS; FORD; JONES; SCOTT; SMITH 30 ALLEN; BLAKE; JAMES; MARTIN; TURNER; WARD
  • 12. Analytics Rock and Roll SQL> select deptno, 2 ename, 3 row_number() 4 over (partition by deptno 5 order by ename) rn, 6 first_value(ename) 7 over (partition by deptno 8 order by ename) "1st ename", 9 nth_value(ename,3) 10 over (partition by deptno 11 order by ename 12 rows between unbounded preceding 13 and unbounded following) "3rd ename", 14 last_value(ename) 15 over (partition by deptno 16 order by ename 17 rows between current row 18 and unbounded following) "last ename" 19 from emp 20 order by deptno, ename 21 /
  • 13. Analytics Rock and Roll DEPTNO ENAME RN 1st e 3rd en last e ------ ------ -- ----- ------ ------ 10 CLARK 1 CLARK MILLER MILLER SQL> select deptno, 10 KING 2 CLARK MILLER MILLER 2 ename, 3 row_number() 10 MILLER 3 CLARK MILLER MILLER 4 over (partition by deptno 5 order by ename) rn, 20 ADAMS 1 ADAMS JONES SMITH 6 first_value(ename) 20 FORD 2 ADAMS JONES SMITH 7 over (partition by deptno 8 order by ename) "1st ename", 20 JONES 3 ADAMS JONES SMITH 9 nth_value(ename,3) 10 over (partition by deptno 20 SCOTT 4 ADAMS JONES SMITH 11 order by ename 12 rows between unbounded preceding 20 SMITH 5 ADAMS JONES SMITH 13 and unbounded following) "3rd ename", 30 ALLEN 1 ALLEN JAMES WARD 14 last_value(ename) 15 over (partition by deptno 30 BLAKE 2 ALLEN JAMES WARD 16 order by ename 17 rows between current row 30 JAMES 3 ALLEN JAMES WARD 18 and unbounded following) "last ename" 19 from emp 30 MARTIN 4 ALLEN JAMES WARD 20 order by deptno, ename 21 / 30 TURNER 5 ALLEN JAMES WARD 30 WARD 6 ALLEN JAMES WARD 14 rows selected.
  • 14. 3 Execute on a directory
  • 15. 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 script/executable – The executable does whatever it wants and writes to stdout – Stdout is treated as the input file • We need a way to control who can do what • GRANT EXECUTE ON DIRECTORY handles that
  • 16. EXECUTE and PREPROCESSOR ops$tkyte%ORA11GR2> CREATE or replace DIRECTORY load_dir 2 AS '/mnt/hgfs/docs/Presentations/Seminar/11gr2' 3 / Directory created. ops$tkyte%ORA11GR2> CREATE or replace DIRECTORY exec_dir 2 AS '/mnt/hgfs/docs/Presentations/Seminar/programs' 3 / Directory created.
  • 17. EXECUTE and PREPROCESSOR ops$tkyte%ORA11GR2> CREATE TABLE EMP_ET 2 ( 3 "EMPNO" NUMBER(4), 4 "ENAME" VARCHAR2(10), 5 "JOB" VARCHAR2(9), 6 "MGR" NUMBER(4), 7 "HIREDATE" DATE, 8 "SAL" NUMBER(7,2), 9 "COMM" NUMBER(7,2), 10 "DEPTNO" NUMBER(2) 11 ) 12 ORGANIZATION external 13 ( TYPE oracle_loader 14 DEFAULT DIRECTORY load_dir 15 ACCESS PARAMETERS 16 ( RECORDS DELIMITED BY NEWLINE 17 preprocessor exec_dir:'run_gunzip.sh' 18 FIELDS TERMINATED BY "|" LDRTRIM 19 ) 20 location ( 'emp.dat.gz') 21 ) 22 / Table created.
  • 18. EXECUTE and PREPROCESSOR ops$tkyte%ORA11GR2> !file emp.dat.gz emp.dat.gz: gzip compressed data, was "emp.dat", from Unix, last modified: Wed Oct 7 12:48:53 2009 ops$tkyte%ORA11GR2> !cat run_gunzip.sh #!/bin/bash /usr/bin/gunzip -c $* ops$tkyte%ORA11GR2> select empno, ename from emp_et where rownum <= 5; EMPNO ENAME ---------- ---------- 7369 SMITH 7499 ALLEN 7521 WARD 7566 JONES 7654 MARTIN
  • 19. EXECUTE and PREPROCESSOR, 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' 11 FIELDS TERMINATED BY "|" LDRTRIM 12 ) 13 location ( 'run_ls.sh') 14 ) 15 / Table created.
  • 20. EXECUTE and PREPROCESSOR, interesting idea… ops$tkyte%ORA11GR2> select * from ls; LINE --------------------------------------------------------------- 11 things about 11gr2.ppt diyp.sql ebr.old.sql ebr.sql emp.ctl emp.dat.gz EMP_ET_26122.log emp_et.sql LS_26122.log run_gunzip.sh run_ls.sh 11 rows selected.
  • 21. 4 Recursive Subquery Factoring
  • 22. Recursive Subquery Factoring • ANSI SQL replacement for connect by • Can be – Easier to understand than connect by – Unless of course, you have been using connect by for 22 years – in which case it looks confusing
  • 23. 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.empno, emp.mgr, ed.l+1 6 from emp, emp_data ed 7 where emp.mgr = ed.empno 8 ) 9 SEARCH 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 /
  • 24. Recursive Subquery Factoring L NM ---------- -------------------- 1 **KING 2 ****BLAKE 3 ******ALLEN 3 ******JAMES 3 ******MARTIN 3 ******TURNER 3 ******WARD 2 ****CLARK 3 ******MILLER 2 ****JONES 3 ******FORD 4 ********SMITH 3 ******SCOTT 4 ********ADAMS 14 rows selected.
  • 25. Recursive Subquery Factoring • ANSI SQL replacement for connect by • Can be – Easier to understand than connect by – Unless of course, you have been using connect by for 22 years – in which case it looks confusing – Used to solve Sudoku puzzles!
  • 26. 5 Improved Time Travel
  • 27. How Does Flashback Data Archive Work? • Primary source for history is the undo data • History is stored in automatically created history tables inside the archive • Transactions and its undo records on tracked 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 system activities – Process tries to maximize undo data reads from buffer cache for better performance – INSERTs do not generate history records
  • 28. Oracle Database 11g Release Total Recall Schema Evolution Support  Flashback Version Query • Alter base table – history table automatically adjusts  – Drop, Rename, Modify Column  – Drop, Truncate Partition – Rename, Truncate Table • Flashback query supported across DDL changes  Column Add • Complex DDL changes (e.g. table split) accommodated Column Add – Associate/Diassociate history table via DBMS_FLASHBACK_ARCHIVE  time time package Column Drop
  • 30. File Watchers • As files arrive in some directory – An event is generated – And your code can be invoked to deal with it…
  • 31. 7 Deferred Segment Creation
  • 32. Deferred Segment Creation • Segments (tables, indexes, etc) normally allocate an initial extent • They might be small, 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 the first row is put into a segment.
  • 33. Deferred Segment Creation SQL> alter session set 2 deferred_segment_creation=false; Session altered. SQL> create table t1 SQL> select segment_name, 2 ( x int 2 extent_id, 3 constraint t1_pk 3 bytes 4 primary key, 4 from user_extents 5 y int 5 order by segment_name; 6 constraint t1_y 7 unique, SEGMENT_NAM EXTENT_ID BYTES 8 z clob ----------- ---------- ---------- 9 ) T1 0 65536 10 lob( z ) T1_PK 0 65536 11 store as t1_z_lob T1_Y 0 65536 12 (index t1_z_lobidx); T1_Z_LOB 0 65536 Table created. T1_Z_LOBIDX 0 65536
  • 34. Deferred Segment Creation SQL> alter session set 2 deferred_segment_creation=true; No Change! Session altered. SQL> create table t2 SQL> select segment_name, 2 ( x int 2 extent_id, 3 constraint t2_pk 3 bytes 4 primary key, 4 from user_extents 5 y int 5 order by segment_name; 6 constraint t2_y 7 unique, SEGMENT_NAM EXTENT_ID BYTES 8 z clob ----------- ---------- ---------- 9 ) T1 0 65536 10 lob( z ) T1_PK 0 65536 11 store as t2_z_lob T1_Y 0 65536 12 (index t2_z_lobidx); T1_Z_LOB 0 65536 Table created. T1_Z_LOBIDX 0 65536
  • 35. Deferred Segment Creation SQL> insert into t2 values ( 1, 2, 'hello world' ); 1 row created. SQL> select segment_name, 2 extent_id, 3 bytes 4 from user_extents 5 order by segment_name; SEGMENT_NAM EXTENT_ID BYTES ----------- ---------- ---------- T1 0 65536 T1_PK 0 65536 T1_Y 0 65536 T1_Z_LOB 0 65536 T1_Z_LOBIDX 0 65536 T2 0 65536 T2_PK 0 65536 T2_Y 0 65536 T2_Z_LOB 0 65536 T2_Z_LOBIDX 0 65536 10 rows selected.
  • 37. 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 reads) • Cheaper than memory ($50 per gigabyte) • Large capacity (hundreds of gigabytes per flash disk) • Fewer drives and better performance – For I/O throughput, users often use hundreds of drives today – Flash enables I/O throughput without all the drives – Large jobs complete faster
  • 39. Automated Degree of Parallelism How it works SQL Statement is hard parsed And optimizer determines If estimated time Optimizer determines statement greater than threshold ideal DOP the execution plan Actual DOP = MIN(default DOP, ideal DOP) If estimated time less than threshold PARALLEL_MIN_TIME_THRESHOLD Statement executes in parallel Statement executes serially
  • 40. Parallel Statement Queuing How it works SQL Statement is parsed If not enough parallel statements and Oracle automatically servers available queue determines DOP 64 64 32 32 16 128 16 FIFO Queue When the required number of parallel servers If enough parallel become available the first servers available stmt on the queue is execute immediately dequeued and executed 8 128
  • 41. In-Memory Parallel Execution How it works SQL Determine the size of the Table is a good candidate Fragments of Table are statement table being looked at for In-Memory Parallel read into each node’s Execution buffer cache Table is Table is extremely small extremely Large Read into the buffer cache on any node Only parallel server on the same RAC node will access each Always use direct read fragment from disk
  • 43. Yes, this is here twice But only because It is the killer feature Of Oracle Database 11g Release 2 It is worth 2 features 10+Edition-based Redefinition!
  • 45. Online Application Upgrade Edition-based redefinition ops$tkyte%ORA11GR2> create user demo identified by demo 2 / User created. ops$tkyte%ORA11GR2> grant create session, create procedure to demo 2 / Grant succeeded. ops$tkyte%ORA11GR2> create edition version2 as child of ora$base 2 / Edition created.
  • 46. Online Application Upgrade Edition-based redefinition ops$tkyte%ORA11GR2> connect demo/demo Connected. demo%ORA11GR2> demo%ORA11GR2> create or replace procedure my_procedure 2 as 3 begin 4 dbms_output.put_line( 'Hello World, I am version 1.0' ); 5 end; 6 / Procedure created. demo%ORA11GR2> create or replace procedure my_procedure2 2 as 3 begin 4 my_procedure; 5 end; 6 / Procedure created.
  • 47. Online Application Upgrade Edition-based redefinition demo%ORA11GR2> exec my_procedure2 Hello World, I am version 1.0 PL/SQL procedure successfully completed.
  • 48. Online Application Upgrade Edition-based redefinition demo%ORA11GR2> connect / Connected. ops$tkyte%ORA11GR2> alter user demo enable editions 2 / User altered. ops$tkyte%ORA11GR2> grant use on edition version2 to demo 2 / Grant succeeded.
  • 49. Online Application Upgrade Edition-based redefinition ops$tkyte%ORA11GR2> connect demo/demo Connected. demo%ORA11GR2> alter session set edition = version2 2 / Session altered. demo%ORA11GR2> set linesize 150 demo%ORA11GR2> select object_name, object_type, status, edition_name from user_objects 2 / OBJECT_NAME OBJECT_TYPE STATUS EDITION_NAME ---------------- -------------- ------- --------------- MY_PROCEDURE PROCEDURE VALID ORA$BASE MY_PROCEDURE2 PROCEDURE VALID ORA$BASE
  • 50. Online Application Upgrade Edition-based redefinition demo%ORA11GR2> create or replace procedure my_procedure 2 as 3 begin 4 dbms_output.put_line( 'Hello World, I am version 2.0' ); 5 end; 6 / Procedure created. demo%ORA11GR2> select object_name, object_type, status, edition_name from user_objects 2 / OBJECT_NAME OBJECT_TYPE STATUS EDITION_NAME --------------- ------------------- ------- -------------- MY_PROCEDURE2 PROCEDURE VALID ORA$BASE MY_PROCEDURE PROCEDURE VALID VERSION2
  • 51. Online Application Upgrade Edition-based redefinition demo%ORA11GR2> SELECT SYS_CONTEXT('userenv', 'current_edition_name') FROM DUAL; SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME') -------------------------------------------------- VERSION2 demo%ORA11GR2> exec my_procedure2 Hello World, I am version 2.0 PL/SQL procedure successfully completed.
  • 52. Online Application Upgrade Edition-based redefinition demo%ORA11GR2> connect demo/demo Connected. demo%ORA11GR2> SELECT SYS_CONTEXT('userenv', 'current_edition_name') FROM DUAL; SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME') ---------------------------------------------- ORA$BASE demo%ORA11GR2> exec my_procedure2 Hello World, I am version 1.0 PL/SQL procedure successfully completed.
  • 53. Online Application Upgrade Edition-based redefinition demo%ORA11GR2> alter session set edition = version2; Session altered. demo%ORA11GR2> SELECT SYS_CONTEXT('userenv', 'current_edition_name') FROM DUAL; SYS_CONTEXT('USERENV','CURRENT_EDITION_NAME') ----------------------------------------------- VERSION2 demo%ORA11GR2> exec my_procedure2 Hello World, I am version 2.0 PL/SQL procedure successfully completed.
  • 55. What are my upgrade paths? Predictable performance post-upgrade 9.2.0.8 9.2.0.8 10.1.0.5 10.1.0.5 ≥ ≥ 10.2.0.2 10.2.0.2 11.2 11.2 SQL Plan Management Automated SQL tuning ≥ ≥ 11.1.0.6 11.1.0.6
  • 56. For More Information search.oracle.com or oracle.com

Notas do Editor

  1. When a SQL statement is executed it will be hard parsed and a serial plan will be developed The expected elapse time of that plan will be examined. If the expected Elapse time is Less than PARALLEL_MIN_TIME_THRESHOLD then the query will execute serially. If the expected Elapse time is greater than PARALLEL_MIN_TIME_THRESHOLD then the plan Will be re-evaluated to run in parallel and the optimizer will determine the ideal DOP. The Optimizer automatically determines the DOP based on the resource required for all scan operations (full table scan, index fast full scan and so on) However, the optimizer will cap the actual DOP for a statement with the default DOP (parallel_threads_per_cpu X CPU_COUNT X INSTANCE_COUNT), to ensure parallel Processes do not flood the system.
  2. Step 1: SQL Statement is issued and Oracle automatically determines if It will run in parallel and if so what DOP it will get. Step 2: Oracle checks to see if there are enough PQ servers to execute The query. If there are it will execute immediately if there are not then The query will be queued in a FIFO Step 3: Everyone waits in the queue for the statement at the top of the Queue to get all of his requested PQ servers even if there are enough PQ servers available for one of the other statements to run ?????? Step 4: When enough PQ servers are available the statement is De-queued and allowed to execute.