SlideShare a Scribd company logo
Oracle 9i is fully SQL:1999 join compliant.

CROSS JOIN (Cartesian Product).

SELECT
            E.ENAME, D.DNAME
     FROM
         EMP E CROSS JOIN DEPT D;

NATURAL JOIN (Equijoin on All Identically Named Columns).

SELECT
            E.ENAME, D.DNAME
     FROM
            EMP E NATURAL JOIN DEPT D;


USING clause (Similar to a Natural Join, but allows for the designation of which
column(s) to use in the equijoin).

SELECT
            E.ENAME, D.DNAME
     FROM
            EMP E JOIN DEPT D USING (DEPTNO);

ON clause (Used to define columns to join on)

SELECT
            E.ENAME, D.DNAME
     FROM
            EMP E JOIN DEPT D ON (E.DEPTNO = D.DEPTNO);


LEFT OUTER JOIN (All records from first table with matching rows from second)

SELECT
            E.ENAME, D.DNAME
     FROM
            EMP E LEFT OUTER JOIN DEPT D ON (E.DEPTNO = D.DEPTNO);


RIGHT OUTER JOIN (All records from second table with matching rows from first)

SELECT
            E.ENAME, D.DNAME
     FROM
            EMP E RIGHT OUTER JOIN DEPT D ON (E.DEPTNO = D.DEPTNO);


FULL OUTER JOIN (All records from both tables—Identical to a union of left outer
join and right outer join)

SELECT
            E.ENAME, D.DNAME
     FROM
            EMP E FULL OUTER JOIN DEPT D ON (E.DEPTNO = D.DEPTNO);

Keyword OUTER is optional with RIGHT,LEFT or FULL.

--------------------------------------------------------------------------------
--


Oracle 9i has also introduced several new functions:
NULLIF(expr1, expr2) —Returns NULL if the first argument is equal to the second,
otherwise returns the first argument.

COALESCE(expr1, expr2, expr3, ...) —Returns the first non-null argument.


CASE Statement

SELECT ENAME, EXTRACT(YEAR FROM HIREDATE) AS YEAR_OF_HIRE,
  (CASE EXTRACT(YEAR FROM HIREDATE)
      WHEN 2002 THEN 'NEW HIRE'
      WHEN 1997 THEN 'FIVE YEARS SERVICE'
      WHEN 1992 THEN 'TEN YEARS SERVICE'
      ELSE 'NO AWARD THIS YEAR'
   END ) AS AWARD
FROM EMP;

CASE Expression

SELECT ENAME, SAL,
         (CASE
              WHEN JOB = —DBA— THEN SAL * 1.5
              WHEN HIREDATE < SYSDATE - TO_YMINTERVAL(—05-00—) THEN SAL * 1.25
              WHEN DEPTNO IN (40,30,10) THEN SAL * 1.1
              ELSE SAL * .9
            END ) AS NEW_SAL
      FROM EMP;



Explicit Defaults —Oracle 9i now allows for the keyword DEFAULT to be used in
INSERT or UPDATE statements:

INSERT INTO EMP (EMPNO, ENAME, DEPTNO)
      VALUES (8000,—MIKE—,DEFAULT);

UPDATE EMP SET COMM = DEFAULT;


MERGE Statement. —This excellent feature also known as an UPSERT will either do
an insert or an update depending on the existence of the record in the target
table.

MERGE INTO T1
      USING T2 ON (T1.C9=T2.C9)
      WHEN MATCHED THEN UPDATE SET T1.C1=T2.C2, T1.C2=T2.C2 ...
      WHEN NOT MATCHED THEN INSERT (C1,C2, ...) VALUES (C1,C2, ...);



Multiple Table Inserts Statement. —Allows for insertion into multiple tables as
part of a single DML statement.

UNCONDITIONAL
INSERT ALL
INTO T1 (C1, C2, ...) VALUES (C1, C2, ...)
INTO T2 (C1, C2, ...) VALUES (C1, C2, ...)
...
SELECT C1, C2, ... FROM T9;

CONDITIONAL —FIRST will only insert into the first statement that returns true,
ALL will insert into each statement that returns true.
INSERT [ALL|FIRST]
WHEN c1 = 1 THEN INTO T1 (C1, C2, ...) VALUES (C1, C2, ...)
WHEN c1 = 2 THEN INTO T2 (C1, C2, ...) VALUES (C1, C2, ...)
WHEN c2 = 3 THEN INTO T3 (C1, C2, ...) VALUES (C1, C2, ...)
...
SELECT C1, C2, ... FROM T9;



We also have several new conversion functions:

TO_TIMESTAMP —From String to Timestamp.
TO_TIMESTAMP_TZ —From String to Timestamp with Time Zone.

TO_DSINTERVAL —From String to Interval Day to Second.
TO_YMINTERVAL —From String to Interval Year to Month

TO_CHAR —Extended to accept the new format characters.

EXTRACT —Returns the requested value (as a number) from a datetime or interval
datatype. Options are Year, Month, Day, Hour, Minute, Second, Timezone_Hour,
Timezone_Minute, Timezone_Region, or Timezone_ABBR.
SELECT EXTRACT(YEAR FROM SYSDATE) FROM DUAL;



DBMS_METADATA is a package that allows for object DDL to be retrieved from the
database.
This package will work for tables, indexes, views, packages, functions,
procedures, triggers, synonyms, and types.

DBMS_METADATA has functions for casual use:
DBMS_METADATA.GET_DDL(object_type, name, schema)
DBMS_METADATA.GET_XML(object_type, name, schema)

--

SELECT DBMS_METADATA.GET_DDL(—TABLE—, —EMP—, —SCOTT—) from dual;
  CREATE TABLE "SCOTT"."EMP"
   (    "EMPNO" NUMBER(4,0),
        "ENAME" VARCHAR2(10),
        "JOB" VARCHAR2(9),
        "MGR" NUMBER(4,0),
        "HIREDATE" DATE,
        "SAL" NUMBER(7,2),
        "COMM" NUMBER(7,2),
        "DEPTNO" NUMBER(2,0),
         CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0
  FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS"   ENABLE,
         CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
  REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE NOVALIDATE
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0
  FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS"

--

External tables are flat files stored outside of the database that Oracle treats
as a table.
The data is read-only and no indexes can be created.

Object rights are controlled through —SELECT TABLE— and —READ DIRECTORY—
privileges.

UTL_FILE_DIR must be set appropriately.



CREATE DIRECTORY external_tables AS —c:oracleoradataexternal—;

CREATE TABLE EMP_EXT (EMPNO NUMBER(4,0), ENAME VARCHAR2(10), JOB VARCHAR2(9),
MGR NUMBER(4,0), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO
NUMBER(2,0))
   ORGANIZATION EXTERNAL
   (TYPE oracle_loader
   DEFAULT DIRECTORY external_tables
   ACCESS PARAMETERS
     (RECORDS DELIMITED BY NEWLINE
      BADFILE external_tables:—bad_emp_ext.txt—
      LOGFILE external_tables:—log_emp_ext.txt—
      FIELDS TERMINATED BY —,—
      MISSING FIELD VALUES ARE NULL)
      LOCATION (—emp.txt—))
   REJECT LIMIT UNLIMITED

     --

Once the table metadata has been created (as in the previous slide) , then this
table can be queried just like any other table. This includes functions, joins,
etc.


Two new views help in the administration of these external tables:
DBA_EXTERNAL_TABLES lists the attributes of each external table in the database.
DBA_EXTERNAL_LOCATIONS lists the specific flat files and their associated
directories.

--

Flashback Query allows users to see a consistent view of the database at a point
in time in the past.

This view of the data is read-only.

This view of the data is re-created by undo and is only available if the undo
blocks are still available.

PL/SQL cursors opened in flashback mode are available for DML after flashback
mode is disabled.

Flashback Query is also supported by EXP.

--

EXEC DBMS_FLASHBACK.ENABLE_AT_TIME(
    TO_DATE(—03-20-2002 14:00:00—,—MM-DD-YYYY HH24:MI:SS—));

Oracle uses a new table, SMON_SCN_TIME to translate timestamps to SCNs.
Documentation states that it only tracks the last five days and is only in five
minute increments.

SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;
This is a excellent new feature for capturing the current SCN.

EXEC DBMS_FLASHBACK.DISABLE;

--

Automatic Undo Management

UNDO_MANAGEMENT (MANUAL or AUTO)
Specifies whether or not to use AUM.   Default = MANUAL

UNDO_TABLESPACE (valid tablespace)
Specifies which undo tablespace to use.

UNDO_RETENTION (in seconds default=30)
Specifies how long to keep committed undo.

UNDO_SUPPRESS_ERRORS (TRUE or FALSE)
Specifies whether or not to return an exception when —SET TRANSACTION USE
ROLLBACK SEGMENT— is issued. Default = TRUE

--

DBA_ROLLBACK_SEGS, V$TRANSACTION, V$ROLLSTAT, are V$ROLLNAME are still
available.


DBA_UNDO_EXTENTS shows when each extent in the undo tablespace was committed.
#
V$UNDOSTAT shows the undo usage for the last 24 hours. Each row records a ten
minute interval defined by START_TIME and END_TIME. The key field is
UNDO_BLOCKS.

--

Things You Can Do With Online Redefinition

Move a table or index to a new tablespace
Change a table—s organization (partitioning, index-organized, etc.)
Add, remove, or rename columns in a table
Change the data type of a column in a table
Add new indexes to a table
Change constraint definitions on a table

--

The dbms_redefinition Package

Use the five procedures in this package to redefine an object online.
CAN_REDEF_TABLE
START_REDEF_TABLE
FINISH_REDEF_TABLE
ABORT_REDEF_TABLE
SYNC_INTERIM_TABLE

--

Other Enhancements

Index Monitoring Usage.
ALTER INDEX INDEX_NAME MONOITORING USAGE;
V$OBJECT_USAGE
Skip Scanning of Indexes.
Real Application Clusters (RAC).
Cache Fusion Block Transfer.
Oracle Managed Files (OMF)
DROP TABLESPACE TBS_01 INCLUDING CONTENTS AND DATAFILES;
Default temporary tablespace.
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP;
Constraints on Views.
Log Miner Enhancements.
CURSOR_SHARING=SIMILAR

--

More Enhancements

EXP TABLESPACES=()
DBMS_STATS.GATHER_SYSTEM_STATS.
RMAN Enhancements.
Data Guard (formerly Standby Database).
Log Transport Services.
 LOG_ARCHIVE_DEST_n where n = 1-10.
 ARCHIVE_LAG_TARGET
Workspace Manager.
Data versioning.
SVRMGR is Deprecated.
CONNECT INTERNAL

--

More Related Content

PPT
Les10[1]Creating and Managing Tables
PPT
Oracle training in hyderabad
DOC
ORACLE NOTES
PPT
PPT
Les05[1]Aggregating Data Using Group Functions
PPT
Les12[1]Creating Views
PDF
Data Definition Language (DDL)
Les10[1]Creating and Managing Tables
Oracle training in hyderabad
ORACLE NOTES
Les05[1]Aggregating Data Using Group Functions
Les12[1]Creating Views
Data Definition Language (DDL)

What's hot (20)

PPT
Les03[1] Single-Row Functions
PPT
PPT
Les09[1]Manipulating Data
ODP
Mysqlppt
PPT
PPT
PDF
SQL Macros - Game Changing Feature for SQL Developers?
PPTX
Oracle: DML
DOC
SQLQueries
PPT
Les22[1]Advanced Explicit Cursor Concepts
PDF
MERGE SQL Statement: Lesser Known Facets
PPT
PPT
Les13[1]Other Database Objects
PPT
PDF
Database Oracle Basic
PPT
Les07[1]Multiple-Column Subqueries
ODP
Les03[1] Single-Row Functions
Les09[1]Manipulating Data
Mysqlppt
SQL Macros - Game Changing Feature for SQL Developers?
Oracle: DML
SQLQueries
Les22[1]Advanced Explicit Cursor Concepts
MERGE SQL Statement: Lesser Known Facets
Les13[1]Other Database Objects
Database Oracle Basic
Les07[1]Multiple-Column Subqueries
Ad

Similar to Oracle 9i notes(kamal.love@gmail.com) (20)

PPT
PDF
12c for Developers - Feb 2014
PPT
PPTX
Interacting with Oracle Database
PDF
Flashback ITOUG
PPTX
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
PPTX
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
PPT
Oracle tips and tricks
PPTX
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
PPTX
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
PPTX
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
PPT
PDF
OOW19 - Flashback, not just for DBAs
PPTX
OpenWorld Sep14 12c for_developers
PPTX
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
PPTX
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
PPT
plsql les06
PDF
OG Yatra - Flashback, not just for developers
PPTX
Everything That Is Really Useful in Oracle Database 12c for Application Devel...
PPTX
The Five Best Things To Happen To SQL
12c for Developers - Feb 2014
Interacting with Oracle Database
Flashback ITOUG
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
Oracle tips and tricks
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
OOW19 - Flashback, not just for DBAs
OpenWorld Sep14 12c for_developers
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
plsql les06
OG Yatra - Flashback, not just for developers
Everything That Is Really Useful in Oracle Database 12c for Application Devel...
The Five Best Things To Happen To SQL
Ad

Recently uploaded (20)

PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
RMMM.pdf make it easy to upload and study
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Sports Quiz easy sports quiz sports quiz
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
master seminar digital applications in india
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
RMMM.pdf make it easy to upload and study
Pharmacology of Heart Failure /Pharmacotherapy of CHF
O7-L3 Supply Chain Operations - ICLT Program
Module 4: Burden of Disease Tutorial Slides S2 2025
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Cell Types and Its function , kingdom of life
Sports Quiz easy sports quiz sports quiz
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Microbial disease of the cardiovascular and lymphatic systems
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
VCE English Exam - Section C Student Revision Booklet
master seminar digital applications in india
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
school management -TNTEU- B.Ed., Semester II Unit 1.pptx

Oracle 9i notes(kamal.love@gmail.com)

  • 1. Oracle 9i is fully SQL:1999 join compliant. CROSS JOIN (Cartesian Product). SELECT E.ENAME, D.DNAME FROM EMP E CROSS JOIN DEPT D; NATURAL JOIN (Equijoin on All Identically Named Columns). SELECT E.ENAME, D.DNAME FROM EMP E NATURAL JOIN DEPT D; USING clause (Similar to a Natural Join, but allows for the designation of which column(s) to use in the equijoin). SELECT E.ENAME, D.DNAME FROM EMP E JOIN DEPT D USING (DEPTNO); ON clause (Used to define columns to join on) SELECT E.ENAME, D.DNAME FROM EMP E JOIN DEPT D ON (E.DEPTNO = D.DEPTNO); LEFT OUTER JOIN (All records from first table with matching rows from second) SELECT E.ENAME, D.DNAME FROM EMP E LEFT OUTER JOIN DEPT D ON (E.DEPTNO = D.DEPTNO); RIGHT OUTER JOIN (All records from second table with matching rows from first) SELECT E.ENAME, D.DNAME FROM EMP E RIGHT OUTER JOIN DEPT D ON (E.DEPTNO = D.DEPTNO); FULL OUTER JOIN (All records from both tables—Identical to a union of left outer join and right outer join) SELECT E.ENAME, D.DNAME FROM EMP E FULL OUTER JOIN DEPT D ON (E.DEPTNO = D.DEPTNO); Keyword OUTER is optional with RIGHT,LEFT or FULL. -------------------------------------------------------------------------------- -- Oracle 9i has also introduced several new functions:
  • 2. NULLIF(expr1, expr2) —Returns NULL if the first argument is equal to the second, otherwise returns the first argument. COALESCE(expr1, expr2, expr3, ...) —Returns the first non-null argument. CASE Statement SELECT ENAME, EXTRACT(YEAR FROM HIREDATE) AS YEAR_OF_HIRE, (CASE EXTRACT(YEAR FROM HIREDATE) WHEN 2002 THEN 'NEW HIRE' WHEN 1997 THEN 'FIVE YEARS SERVICE' WHEN 1992 THEN 'TEN YEARS SERVICE' ELSE 'NO AWARD THIS YEAR' END ) AS AWARD FROM EMP; CASE Expression SELECT ENAME, SAL, (CASE WHEN JOB = —DBA— THEN SAL * 1.5 WHEN HIREDATE < SYSDATE - TO_YMINTERVAL(—05-00—) THEN SAL * 1.25 WHEN DEPTNO IN (40,30,10) THEN SAL * 1.1 ELSE SAL * .9 END ) AS NEW_SAL FROM EMP; Explicit Defaults —Oracle 9i now allows for the keyword DEFAULT to be used in INSERT or UPDATE statements: INSERT INTO EMP (EMPNO, ENAME, DEPTNO) VALUES (8000,—MIKE—,DEFAULT); UPDATE EMP SET COMM = DEFAULT; MERGE Statement. —This excellent feature also known as an UPSERT will either do an insert or an update depending on the existence of the record in the target table. MERGE INTO T1 USING T2 ON (T1.C9=T2.C9) WHEN MATCHED THEN UPDATE SET T1.C1=T2.C2, T1.C2=T2.C2 ... WHEN NOT MATCHED THEN INSERT (C1,C2, ...) VALUES (C1,C2, ...); Multiple Table Inserts Statement. —Allows for insertion into multiple tables as part of a single DML statement. UNCONDITIONAL INSERT ALL INTO T1 (C1, C2, ...) VALUES (C1, C2, ...) INTO T2 (C1, C2, ...) VALUES (C1, C2, ...) ... SELECT C1, C2, ... FROM T9; CONDITIONAL —FIRST will only insert into the first statement that returns true, ALL will insert into each statement that returns true.
  • 3. INSERT [ALL|FIRST] WHEN c1 = 1 THEN INTO T1 (C1, C2, ...) VALUES (C1, C2, ...) WHEN c1 = 2 THEN INTO T2 (C1, C2, ...) VALUES (C1, C2, ...) WHEN c2 = 3 THEN INTO T3 (C1, C2, ...) VALUES (C1, C2, ...) ... SELECT C1, C2, ... FROM T9; We also have several new conversion functions: TO_TIMESTAMP —From String to Timestamp. TO_TIMESTAMP_TZ —From String to Timestamp with Time Zone. TO_DSINTERVAL —From String to Interval Day to Second. TO_YMINTERVAL —From String to Interval Year to Month TO_CHAR —Extended to accept the new format characters. EXTRACT —Returns the requested value (as a number) from a datetime or interval datatype. Options are Year, Month, Day, Hour, Minute, Second, Timezone_Hour, Timezone_Minute, Timezone_Region, or Timezone_ABBR. SELECT EXTRACT(YEAR FROM SYSDATE) FROM DUAL; DBMS_METADATA is a package that allows for object DDL to be retrieved from the database. This package will work for tables, indexes, views, packages, functions, procedures, triggers, synonyms, and types. DBMS_METADATA has functions for casual use: DBMS_METADATA.GET_DDL(object_type, name, schema) DBMS_METADATA.GET_XML(object_type, name, schema) -- SELECT DBMS_METADATA.GET_DDL(—TABLE—, —EMP—, —SCOTT—) from dual; CREATE TABLE "SCOTT"."EMP" ( "EMPNO" NUMBER(4,0), "ENAME" VARCHAR2(10), "JOB" VARCHAR2(9), "MGR" NUMBER(4,0), "HIREDATE" DATE, "SAL" NUMBER(7,2), "COMM" NUMBER(7,2), "DEPTNO" NUMBER(2,0), CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" ENABLE, CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO") REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE NOVALIDATE ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" -- External tables are flat files stored outside of the database that Oracle treats as a table.
  • 4. The data is read-only and no indexes can be created. Object rights are controlled through —SELECT TABLE— and —READ DIRECTORY— privileges. UTL_FILE_DIR must be set appropriately. CREATE DIRECTORY external_tables AS —c:oracleoradataexternal—; CREATE TABLE EMP_EXT (EMPNO NUMBER(4,0), ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4,0), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2,0)) ORGANIZATION EXTERNAL (TYPE oracle_loader DEFAULT DIRECTORY external_tables ACCESS PARAMETERS (RECORDS DELIMITED BY NEWLINE BADFILE external_tables:—bad_emp_ext.txt— LOGFILE external_tables:—log_emp_ext.txt— FIELDS TERMINATED BY —,— MISSING FIELD VALUES ARE NULL) LOCATION (—emp.txt—)) REJECT LIMIT UNLIMITED -- Once the table metadata has been created (as in the previous slide) , then this table can be queried just like any other table. This includes functions, joins, etc. Two new views help in the administration of these external tables: DBA_EXTERNAL_TABLES lists the attributes of each external table in the database. DBA_EXTERNAL_LOCATIONS lists the specific flat files and their associated directories. -- Flashback Query allows users to see a consistent view of the database at a point in time in the past. This view of the data is read-only. This view of the data is re-created by undo and is only available if the undo blocks are still available. PL/SQL cursors opened in flashback mode are available for DML after flashback mode is disabled. Flashback Query is also supported by EXP. -- EXEC DBMS_FLASHBACK.ENABLE_AT_TIME( TO_DATE(—03-20-2002 14:00:00—,—MM-DD-YYYY HH24:MI:SS—)); Oracle uses a new table, SMON_SCN_TIME to translate timestamps to SCNs. Documentation states that it only tracks the last five days and is only in five minute increments. SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;
  • 5. This is a excellent new feature for capturing the current SCN. EXEC DBMS_FLASHBACK.DISABLE; -- Automatic Undo Management UNDO_MANAGEMENT (MANUAL or AUTO) Specifies whether or not to use AUM. Default = MANUAL UNDO_TABLESPACE (valid tablespace) Specifies which undo tablespace to use. UNDO_RETENTION (in seconds default=30) Specifies how long to keep committed undo. UNDO_SUPPRESS_ERRORS (TRUE or FALSE) Specifies whether or not to return an exception when —SET TRANSACTION USE ROLLBACK SEGMENT— is issued. Default = TRUE -- DBA_ROLLBACK_SEGS, V$TRANSACTION, V$ROLLSTAT, are V$ROLLNAME are still available. DBA_UNDO_EXTENTS shows when each extent in the undo tablespace was committed. # V$UNDOSTAT shows the undo usage for the last 24 hours. Each row records a ten minute interval defined by START_TIME and END_TIME. The key field is UNDO_BLOCKS. -- Things You Can Do With Online Redefinition Move a table or index to a new tablespace Change a table—s organization (partitioning, index-organized, etc.) Add, remove, or rename columns in a table Change the data type of a column in a table Add new indexes to a table Change constraint definitions on a table -- The dbms_redefinition Package Use the five procedures in this package to redefine an object online. CAN_REDEF_TABLE START_REDEF_TABLE FINISH_REDEF_TABLE ABORT_REDEF_TABLE SYNC_INTERIM_TABLE -- Other Enhancements Index Monitoring Usage. ALTER INDEX INDEX_NAME MONOITORING USAGE; V$OBJECT_USAGE Skip Scanning of Indexes. Real Application Clusters (RAC).
  • 6. Cache Fusion Block Transfer. Oracle Managed Files (OMF) DROP TABLESPACE TBS_01 INCLUDING CONTENTS AND DATAFILES; Default temporary tablespace. ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP; Constraints on Views. Log Miner Enhancements. CURSOR_SHARING=SIMILAR -- More Enhancements EXP TABLESPACES=() DBMS_STATS.GATHER_SYSTEM_STATS. RMAN Enhancements. Data Guard (formerly Standby Database). Log Transport Services. LOG_ARCHIVE_DEST_n where n = 1-10. ARCHIVE_LAG_TARGET Workspace Manager. Data versioning. SVRMGR is Deprecated. CONNECT INTERNAL --