OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The...

86
OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176

Transcript of OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The...

Page 1: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

OracleWorld 2002

Catapult to the Next Version:Oracle9i New Features

OverviewJoe TrezzoThe Ultimate Software Consultants (TUSC)

Abstract Number 32176

Page 2: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 2

Audience Knowledge

• Oracle Experience• Developer Experience• DBA Experience• Oracle8i Experience• Oracle9i Experience

Page 3: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 3

Presentation Goals/Non-Goals

• Goals– Highlight New Oracle9i Features– Add to your Arsenal of Knowledge

• Non-Goals– Detail Every New Oracle9i Feature

Page 4: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 4

Presentation Outline

Oracle9i Overview Oracle9i Data Dictionary Oracle9i V$ Views New Data Types New Built-In Functions New SQL Commands Expanded Oracle Supplied Packages Suspending the Database Additional Oracle9i New Features

Page 5: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 5

Oracle9i Overview

Page 6: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 6

Oracle9i Overview

• Oracle9i Databases– Oracle9i Standard Edition– Oracle9i Enterprise Edition– Oracle9i Personal Edition

• Oracle9i Documentation– Over 100 Manuals– Oracle9i Database New Features– Interspersed Throughout Oracle9i Documentation– $ORACLE_HOME/rdbms/doc/

README_rdbms.htm

Page 7: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 7

Oracle9i Overview

• Table 44-1 Oracle9i Release 9.0.1 OptionsOption Oracle9i

Standard

Edition

Oracle9i

Enterprise

Edition

Oracle9i

Personal

Edition

Notes

OracleAdvancedSecurity

N Y Y Oracle Advanced Security provides a single sourceof integration with network encryption, single sign-on services, smartcard, token and biometric userauthentication.

Oracle ChangeManagementPack

N Y Y Oracle Change Management Pack eliminates errorsand loss of data when upgrading databases tosupport new applications. The pack analyzes theimpact and complex dependencies associated withapplication change and automatically performsdatabase upgrades.

Oracle DataMining

N Y Y Oracle Data Mining embeds data miningfunctionality for making classifications, predictionsand associations. All model building and scoringfunctions are accessible through a Java-based API.

Page 8: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 8

Oracle9i Overview

• Table 44-2 Oracle9i Release 9.0.1 FeaturesFeature Oracle9i

Standard

Edition

Oracle9i

Enterprise

Edition

Oracle9i

Personal

Edition

Notes

Flashback Query Y Y Y Allows data to be queried from a point in thepast.

Online table re-organization

N Y Y Redefines the logical and physical structuresof tables while the user is online.

Quiesce database Y Y Y Allows execution plans for SQL to be storedso that the plan remains consistentthroughout schema changes, databasereorganizations, and data volume changes.

Plan Stability N Y Y Allows for database maintenance without itforcing a shutdown.

Page 9: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 9

Oracle9i Overview

• Oracle8i (Release 3)

• Oracle9i

SELECT bannerFROM v$version;

BANNER--------------------------------------------------------------Oracle8i Enterprise Edition Release 8.1.7.0.0 - ProductionPL/SQL Release 8.1.7.0.0 - Production

BANNER--------------------------------------------------------------Oracle9i Enterprise Edition Release 9.0.1.2.0 - ProductionPL/SQL Release 9.0.1.2.0 - Production

Page 10: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 10

• Oracle9i Options Detail on Your SystemSELECT *FROM v$option;

PARAMETER VALUE ------------------------- --------------- Partitioning TRUE Objects TRUE Real Application Clusters FALSE Advanced replication TRUE Bit-mapped indexes TRUE Connection multiplexing TRUE Connection pooling TRUE Database queuing TRUE

Oracle9i Overview

Page 11: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 11

Oracle9i Data Dictionary

Page 12: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 12

Oracle9i Data Dictionary

• Files to Review for Changes/Enhancements– sql.bsq ($ORACLE_HOME/rdbms/admin)– catalog.sql ($ORACLE_HOME/rdbms/admin)

• sql.bsq File– Executed Upon Database Creation– Undocumented init.ora _init_sql_files– Creates

• Underlying Data Dictionary Tables and Indexes• Initial Users SYS and SYSTEM• Initial Roles CONNECT, RESOURCE, and DBA• Variety of Other Base Data Dictionary Setup

Page 13: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 13

Oracle9i Data Dictionary

• sql.bsq Filecreate tablespace SYSTEM datafile "D_DBFN" "D_DSTG" online/create rollback segment SYSTEM tablespace SYSTEM storage (initial 50K next 50K)/create cluster c_obj# (obj# number) pctfree 5 size 800 /* don't waste too much space */ /* A table of 32 cols, 2 index, 2 col per index requires about 2K. * A table of 10 cols, 2 index, 2 col per index requires about 750. */ storage (initial 130K next 200k maxextents unlimited pctincrease 0)

. . . . . . . . .

. . . . . . .

. . . . . . . . create profile "DEFAULT" limit /* default value, always present */ composite_limit unlimited /* service units */ sessions_per_user unlimited /* logins per user id */ cpu_per_session unlimited /* cpu usage in minutes */ cpu_per_call unlimited /* max cpu minutes per call */ logical_reads_per_session unlimited logical_reads_per_call unlimited idle_time unlimited connect_time unlimited private_sga unlimited /* valid only with TP-monitor */ failed_login_attempts unlimited password_life_time unlimited password_reuse_time unlimited password_reuse_max unlimited password_verify_function null password_lock_time unlimited password_grace_time unlimited/

Page 14: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 14

Oracle9i Data Dictionary

• sql.bsq File (continued). . . . . . . .. . . . . . . .. . . . . . . .

create role public/create role connect/grant create session,alter session,create synonym,create view, create database link,create table,create cluster,create sequence to connect/create role resource/grant create table,create cluster,create sequence,create trigger, create procedure, create type, create indextype, create operator to resource/create role dba/grant all privileges, select any dictionary to dba with admin option/create user system identified by manager/grant dba to system with admin option/

. . . . . . . .

. . . . . . . .

. . . . . . . .

Page 15: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 15

Oracle9i Data Dictionary

• sql.bsq File (continued)create table dual /* pl/sql's standard pckg requires dual. */ (dummy varchar2(1)) /* note, the optimizer knows sys.dual is single row */ storage (initial 1)/insert into dual values('X')/create public synonym dual for dual/grant select on dual to public with grant option/

. . . . . . . .

. . . . . . . .

. . . . . . . .create role select_catalog_role/create role execute_catalog_role/create role delete_catalog_role/grant select_catalog_role to dba with admin option/grant execute_catalog_role to dba with admin option/grant delete_catalog_role to dba with admin option/

. . . . . . . .

. . . . . . . .

. . . . . . . .

Page 16: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 16

Oracle9i Data Dictionary

• Fundamental Changes as Seen in sql.bsq– New SELECT ANY DICTIONARY Privilege

• Granted to DBA Role• Access to Underlying Data Dictionary Table (SYS

Schema)– 3 New Roles

• SELECT_CATALOG_ROLE• EXECUTE_CATALOG_ROLE• DELETE_CATALOG_ROLE• Data Dictionary Views and Supplied Packages Use these

Roles Extensively• Granted to DBA Role• Other Creation Scripts (catalog.sql), Access Granted to

the 1st 2 Roles• Provides More Control Over Internal Oracle Structures

Page 17: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 17

Oracle9i Data Dictionary

• catalog.sql File– Executed Upon Initial Database Creation– If Manually Created, Need to Execute– Creates

• Underlying Data Dictionary Views and Grants• Executes Several Dependent Catalog Scripts• V$ Views on V$ Views, Public Synonyms and

Grants

Page 18: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 18

Oracle9i Data Dictionary

• catalog.sql Filerem Load PL/SQL Package STANDARD first, so views can depend upon it@@standard

. . . . . . . .

. . . . . . . .

. . . . . . . .create or replace view v_$sql_plan as select * from v$sql_plan;create or replace public synonym v$sql_plan for v_$sql_plan;grant select on v_$sql_plan to select_catalog_role;

. . . . . . . .

. . . . . . . .

. . . . . . . .create or replace view gv_$sql_plan as select * from gv$sql_plan;create or replace public synonym gv$sql_plan for gv_$sql_plan;grant select on gv_$sql_plan to select_catalog_role;

. . . . . . . .

. . . . . . . .

. . . . . . . .REMREM This view enables the user to see his own profile limitsREMcreate or replace view USER_RESOURCE_LIMITS (RESOURCE_NAME, LIMIT)as select m.name, decode (u.limit#, 2147483647, 'UNLIMITED', 0, decode (p.limit#, 2147483647, 'UNLIMITED', p.limit#), u.limit#) from sys.profile$ u, sys.profile$ p, sys.resource_map m, user$ s where u.resource# = m.resource#

Page 19: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 19

Oracle9i Data Dictionary

• catalog.sql File (continued)and p.profile# = 0 and p.resource# = u.resource# and u.type# = p.type# and p.type# = 0 and m.type# = 0 and s.resource$ = u.profile# and s.user# = userenv('SCHEMAID')/comment on table USER_RESOURCE_LIMITS is'Display resource limit of the user'/comment on column USER_RESOURCE_LIMITS.RESOURCE_NAME is'Resource name'/comment on column USER_RESOURCE_LIMITS.LIMIT is'Limit placed on this resource'/create or replace public synonym USER_RESOURCE_LIMITS for USER_RESOURCE_LIMITS/grant select on USER_RESOURCE_LIMITS to PUBLIC with grant option/

. . . . . . . .

. . . . . . . .

. . . . . . . .Rem Import/export views@@catexp

Rem Loader views@@catldr

Page 20: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 20

Oracle9i Data Dictionary

• catalog.sql File (continued)Rem Partitioning views@@catpart

Rem Object views@@catadt

Rem Summary views@@catsum

Rem Logical Standby tables & viewsRem @@catlsby

Rem External Table views@@catxtb

. . . . . . . .

. . . . . . . .

. . . . . . . .

Page 21: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 21

Oracle9i Data Dictionary

• Helpful Dictionary View– Several New and Enhanced Views (Some

Highlighted Throughout Presentation)– Over 1,000 Data Dictionary Views

• Use DICTIONARY View

– Dictionary View• All Dictionary Views and Comment for Each• Can Limit with WHERE Clause

COLUMN comments FORMAT A50 WORD_WRAPPEDSELECT * FROM dictionary;

Page 22: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 22

Oracle9i Data Dictionary

• Helpful Dictionary View– Dictionary View

TABLE_NAME COMMENTS--------------------- -----------------------------------------ALL_ALL_TABLES Description of all object and relational

tables accessible to the userALL_ARGUMENTS Arguments in object accessible to the

userALL_ASSOCIATIONS All associations available to the userALL_AUDIT_POLICIES All fine grained auditing policies in the

databaseALL_BASE_TABLE_MVIEWS All materialized views with log(s) in the

database that the user can seeALL_CATALOG All tables, views, synonyms, sequences

accessible to the user

Page 23: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 23

Oracle9i V$ Views

Page 24: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 24

Oracle9i V$ Views

• Enhancements to V$ Views– Support Expanded Functionality– New Columns– Changed Data lengths

• Addition to V$ Views– Support New and Expanded Functionality

• V$FIXED_VIEW_DEFINITION View– All V$ Views and Underlying View Creation

Statements– Can Limit with WHERE Clause

Page 25: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 25

Oracle9i V$ Views

COLUMN view_definition format a50 SELECT * FROM v$fixed_view_definition;

VIEW_NAME VIEW_DEFINITION------------ --------------------------------------------------GV$WAITSTAT select inst_id,decode(indx,1,'data block',2,'sort block',3,'save undo block', 4,'segment header',5,' save undo header',6,'free list',7,'extent map', 8, '1st level bmb',9,'2nd level bmb',10,'3rd level bm b', 11,'bitmap block',12,'bitmap index block',13,' file header block',14,'unused', 15,'system undo he ader',16,'system undo block', 17,'undo header',18, 'undo block'), count,time from x$kcbwait where ind x!=0V$WAITSTAT select class,count,time from gv$waitstat where ins t_id = USERENV('Instance')

Page 26: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 26

Oracle9i V$ Views

• List of Modified V$ ViewsV$ARCHIVE V$ARCHIVED_LOG V$ARCHIVE_DESTV$BACKUP_DATAFILE V$BACKUP_PIECE V$BACKUP_SET V$DELETED_OBJECT V$INSTANCE_RECOVERY V$PROXY_ARCHIVEDLOGV$PROXY_DATAFILE V$RECOVER_FILE V$AQV$SQL V$SQLAREA V$DATABASEV$DATAFILE V$DATAFILE_COPY V$DATAFILE_HEADERV$INSTANCE V$TABLESPACE V$LOADPSTATV$FILESTAT V$TEMPSTAT V$DLM_LATCHV$DLM_RESS V$LATCH V$LATCH_MISSESV$LOGMNR_CONTENTS V$LOGMNR_LOGS V$CIRCUITV$DISPATCHER_RATE V$MTS V$SORT_USAGEV$SYSTEM_EVENT V$TRANSACTION V$PARAMETERV$LOGFILE V$PROCESS V$RSRC_CONSUMER_GROUPV$SESSION V$SESSION_EVENT

Page 27: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 27

Oracle9i V$ Views

• List of New V$ ViewsV$ARCHIVE_DEST_STATUS V$ARCHIVE_GAPV$RMAN_CONFIGURATION V$BUFFER_POOL_STATISTICSV$DB_CACHE_ADVICE V$BSPV$CR_BLOCK_SERVER V$GCSHVMASTER_INFOV$GCSPFMASTER_INFO V$SQL_PLANV$SQL_REDIRECTION V$SQL_SHARED_CURSORV$SQL_WORKAREA V$SQL_WORKAREA_ACTIVE V$LOADISTAT V$CLASS_CACHE_TRANSFERV$DLM_TRAFFIC_CONTROLLER V$FILE_CACHE_TRANSFERV$TEMP_CACHE_TRANSFER V$GC_ELEMENTS_WITH_COLLISIONSV$GES_BLOCKING_ENQUEUE V$GES_ENQUEUEV$HVMASTER_INFO V$LOGMNR_CALLBACK

Page 28: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 28

Oracle9i V$ Views

• List of New V$ Views (continued)V$LOGMNR_LOGFILE V$LOGMNR_PROCESSV$LOGMNR_REGION V$LOGMNR_SESSIONV$LOGMNR_TRANSACTION V$GLOBALCONTEXTV$TIMEZONE_NAMES V$QUEUEING_MTHV$OBJECT_USAGE V$RESUMABLEV$SPPARAMETER V$MVREFRESHV$REPLPROP V$REPLQUEUEV$UNDOSTAT V$VPD_POLICYV$HS_PARAMETER V$LOGSTDBYV$LOGSTDBY_STATS V$MANAGED_STANDBYV$STANDBY_LOG

Page 29: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 29

New Data Types

Page 30: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 30

New Data Types

• New Date/Time Data Types– TIMESTAMP (fractional_seconds_precision)

• Year, month, and day values of date, as well as hour, minute, and second values of time, where fractional_seconds_precision is the number of digits in the fractional part of the SECOND datetime field. Accepted values of fractional_seconds_precision are 0 to 9. The default is 6.

– TIMESTAMP (fractional_seconds_precision) WITH TIME ZONE • All values of TIMESTAMP as well as time zone displacement value, where fractional_seconds_precision is the number of digits in the fractional part of the SECOND datetime field. Accepted values are 0 to 9. The default is 6.

– TIMESTAMP (fractional_seconds_precision) WITH LOCAL TIME ZONE • All values of TIMESTAMP WITH TIME ZONE, with the following

exceptions: Data is normalized to the database time zone when it is stored in

the database. When the data is retrieved, users see the data in the session time

zone.

Page 31: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 31

New Data Types

• New Date/Time Data Types– INTERVAL YEAR (year_precision) TO MONTH

• Stores a period of time in years and months, where year_precision is the number of digits in the YEAR datetime field. Accepted values are 0 to 9. The default is 2.

– INTERVAL DAY (day_precision) TO SECOND (fractional_seconds_precision)

• Stores a period of time in days, hours, minutes, and seconds, where

day_precision is the maximum number of digits in the DAY datetime field. Accepted values are 0 to 9. The default is 2.

fractional_seconds_precision is the number of digits in the fractional part of the SECOND field. Accepted values are 0 to 9. The default is 6.

– Tables for Reference• Oracle9i SQL Reference

Page 32: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 32

New Data Types

• New Date/Time Data TypesSELECT SYSDATE, TO_CHAR(SYSDATE, 'MM/DD/YYYY HH24:MI:SS') sysdate_prior9i, TO_CHAR(SYSDATE, 'MM/DD/YYYY HH24:MI:SS.SSSSSSSSSSSS') sysdate_9iFROM DUAL;

SYSDATE SYSDATE_PRIOR9I SYSDATE_9I--------- ------------------- --------------------------------08-JAN-02 01/08/2002 15:31:16 01/08/2002 15:31:16.558765587616

SYSDATE SYSDATE_PRIOR9I SYSDATE_9I--------- ------------------- --------------------------------08-JAN-02 01/08/2002 15:31:19 01/08/2002 15:31:19.558795587919

Page 33: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 33

New Built-in Functions

Page 34: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 34

New Built-In Functions

• Several New Built-In Functions• Covered in SQL Reference Manual• List of New Functionsasciistr bin_to_num coalesce composecurrent_date current_timestamp dbtimezone decomposeexistsnode extract (datetime) extract (xml) firstfrom_tz group_id grouping_id lastlocaltimestamp nullif percentile_cont percentile_discrawtonhex rowidtonchar sessiontimezone sys_connect_by_pathsys_dburigen sys_extract_utc sys_xmlagg sys_xmlgen systimestamp to_char (character) to_clob to_dsinterval to_nchar (character) to_nchar (datetime) to_nchar (number) to_nclob to_timestamp to_timestamp_tzto to_yminterval treattz_offset unistr width_bucket

Page 35: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 35

New Built-In Functions

• New NULL Type Functions– NULLIF

• If Values Match, Then the Result is NULL

– COALESCE• If the List is NULL, Then the Result is the

Last Value in the List

– SQL and PL/SQL Functions

Page 36: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 36

New Built-In Functions

• New NULL Type FunctionsDECLARE x1 PLS_INTEGER := 1234; x2 PLS_INTEGER := 1234; x3 PLS_INTEGER; x4 PLS_INTEGER; x5 PLS_INTEGER; x6 PLS_INTEGER;BEGIN x5 := NULLIF(x1, x2); x6 := COALESCE(x3, x4, 4321); DBMS_OUTPUT.PUT_LINE('x5: ' || x5); DBMS_OUTPUT.PUT_LINE('x6: ' || x6);END;/

x5: x6: 4321

PL/SQL procedure successfully completed.

Page 37: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 37

New Built-In Functions

• New CASE Expression– Similar to IF Statement– Multiple Methods of Writing Statements

• Selector Option• Search Option

– Boolean Evaluation: If TRUE, CASE Terminated– Recommendation: Order CASE Conditions

Based on Most Highly Evaluated to TRUE First– Sets a Variable: Treated as Function– If No Match, Returns a NULL

Page 38: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 38

New Built-In Functions

• New CASE Expression– Selector Option

DECLARE customer_rating VARCHAR2(10); customer_credit VARCHAR2(1);BEGIN customer_credit := 'B'; customer_rating := CASE customer_credit WHEN 'A' THEN 'Rank 1' WHEN 'B' THEN 'Rank 2' WHEN 'C' THEN 'Rank 3' ELSE 'Rank 5' END; DBMS_OUTPUT.PUT_LINE('Customer Ranking: ' || customer_rating);END;/

Page 39: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 39

New Built-In Functions

• New CASE Expression– Search Option

DECLARE customer_rating VARCHAR2(10); customer_credit VARCHAR2(1);BEGIN customer_credit := 'B'; customer_rating := CASE WHEN customer_credit = 'A' THEN 'Rank 1' WHEN customer_credit = 'B' THEN 'Rank 2' WHEN customer_credit = 'C' THEN 'Rank 3' ELSE 'Rank 5' END; DBMS_OUTPUT.PUT_LINE('Customer Ranking: ' || customer_rating);END;/

Page 40: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 40

New Built-In Functions

• New CASE Statement– Similar to CASE Expression, but Each

Condition Contains a PL/SQL Command– Not Treated as a Function– If No Match, Raises a

CASE_NOT_FOUND Exception

Page 41: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 41

New Built-In Functions

• New CASE Statement– Selector Option

DECLARE customer_rating VARCHAR2(10); customer_credit VARCHAR2(1);BEGIN customer_credit := 'B'; CASE customer_credit WHEN 'A' THEN customer_rating := 'Rank 1'; WHEN 'B' THEN customer_rating := 'Rank 2'; WHEN 'C' THEN customer_rating := 'Rank 3'; ELSE customer_rating := 'Rank 5'; END CASE; DBMS_OUTPUT.PUT_LINE('Customer Ranking: ' || customer_rating);END;/

Page 42: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 42

New Built-In Functions

• New CASE Statement– Search Option

DECLARE customer_rating VARCHAR2(10); customer_credit VARCHAR2(1);BEGIN customer_credit := 'B'; CASE WHEN customer_credit='A' THEN customer_rating:='Rank 1'; WHEN customer_credit='B' THEN customer_rating:='Rank 2'; WHEN customer_credit='C' THEN customer_rating:='Rank 3'; ELSE customer_rating:='Rank 5'; END CASE; DBMS_OUTPUT.PUT_LINE('Customer Ranking: ' || customer_rating);END;/

Page 43: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 43

New SQL Commands

Page 44: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 44

New SQL Commands

• 3 New SQL Commands• Covered in SQL Reference Manual• List of New Commands

– CREATE PFILE– CREATE SPFILE– MERGE

Page 45: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 45

New SQL Commands

• Merge Statement– Insert or Update Operation in One Statement

• If record exists, update the record• If record does not exist, insert the record

– Example Scenario• System 1:

– Internal ADP Payroll Processing– ADP is the Single Point of New/Updates of Employees– Cannot Update Database Structures

• System 2:– Time and Expense (T&E) Entry System– Replicate the Master Employee Table

Page 46: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 46

New SQL Commands

• Merge Statement– Example Scenario

• Prior to Oracle9i– Execute a Scheduled Routine to Update System 2

Master Emps– ADP Employee Information Updates T&E

Employee Information– Select Each ADP Employee– If Exists in T&E, then Update– If Not Exists in T&E, then Insert

• Oracle9i– Superceded with the Merge Statement

Page 47: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 47

New SQL Commands

• Merge StatementMERGE INTO employee_master dest

USING

(SELECT emp_id, start_date, salary, title

FROM adp_employee_master@adp) orig

ON (dest.emp_id = orig.emp_id)

WHEN MATCHED THEN UPDATE

SET dest.salary = orig.salary,

dest.title = orig.title

WHEN NOT MATCHED THEN

INSERT (dest.emp_id, dest.start_date, dest.salary, dest.title)

VALUES

(orig.emp_id, orig.start_date, orig.salary, orig.title);

Page 48: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 48

Expanded Oracle Supplied Packages

Page 49: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 49

Expanded Oracle Supplied Packages

• Identify Packages Installed By Default (catproc.sql)– Groups Packages Installed– Provides Short Description of Grouping

• New Reference Manual in Oracle 8.1 (Oracle8i Supplied Package Reference)– Covers 70 Packages– Includes Many of the Packages Prior to Oracle8i

• Approximately 20 New Oracle Packages• Several Packages Upgraded and Enhanced

Page 50: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 50

Expanded Oracle Supplied Packages

• List of New Oracle Supplied PackagesDBMS_AQELM DBMS_ENCODEDBMS_FGA DBMS_FLASHBACKDBMS_LDAP DBMS_LIBCACHE DBMS_LOGMNR_CDC_PUBLISH DBMS_LOGMNR_CDC_SUBSCRIBE DBMS_METADATA DBMS_ODCI DBMS_OUTLN_EDIT DBMS_REDEFINITION DBMS_TRANSFORM DBMS_URLDBMS_WM DBMS_XMLGEN DBMS_XMLQUERY DMBS_XMLSAVE

UTL_ENCODE

Page 51: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 51

Expanded Oracle Supplied Packages

• View List of Supplied Packages on Your SystemSELECT object_nameFROM dba_objectsWHERE owner = 'SYS'AND object_type = 'PACKAGE'ORDER BY object_name;

OBJECT_NAME------------------------------DBMS_APPLICATION_INFODBMS_OUTPUTDBMS_PIPEDBMS_SESSIONDBMS_SHARED_POOL

Page 52: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 52

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package– Perform Redefinition Online While Table Being

Accessed

– Change Table Structure, Storage, etc.

– Creation Script: dbmshord.sql• Called By catproc.sql script

• Located in $ORACLE_HOME/rdbms/admin Directory

– Grant Privilege on Package to Schema• EXECUTE Privilege or EXECUTE_CATALOG_ROLE

Page 53: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 53

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package(DESCRIBE)PROCEDURE ABORT_REDEF_TABLE

Argument Name Type In/Out Default? --------------------------- ----------------------- ------ -------- UNAME VARCHAR2 IN ORIG_TABLE VARCHAR2 IN INT_TABLE VARCHAR2 INPROCEDURE CAN_REDEF_TABLE Argument Name Type In/Out Default? --------------------------- ----------------------- ------ -------- UNAME VARCHAR2 IN TNAME VARCHAR2 INPROCEDURE FINISH_REDEF_TABLE Argument Name Type In/Out Default? --------------------------- ----------------------- ------ -------- UNAME VARCHAR2 IN ORIG_TABLE VARCHAR2 IN INT_TABLE VARCHAR2 IN

Page 54: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 54

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package(DESCRIBE)PROCEDURE START_REDEF_TABLE

Argument Name Type In/Out Default? --------------------------- ----------------------- ------ -------- UNAME VARCHAR2 IN ORIG_TABLE VARCHAR2 IN INT_TABLE VARCHAR2 IN COL_MAPPING VARCHAR2 IN DEFAULTPROCEDURE SYNC_INTERIM_TABLE Argument Name Type In/Out Default? --------------------------- ----------------------- ------ -------- UNAME VARCHAR2 IN ORIG_TABLE VARCHAR2 IN INT_TABLE VARCHAR2 IN

Page 55: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 55

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Create Employee TableCREATE TABLE s_employee

(employee_id NUMBER(7) CONSTRAINT s_employee_id_nn NOT NULL, employee_last_name VARCHAR2(25) CONSTRAINT s_employee_last_name_nn

NOT NULL, employee_first_name VARCHAR2(25), userid VARCHAR2(8), start_date DATE, comments VARCHAR2(255), manager_id NUMBER(7), title VARCHAR2(25), department_id NUMBER(7), salary NUMBER(11, 2), commission_pct NUMBER(4, 2), CONSTRAINT s_employee_id_pk PRIMARY KEY (employee_id), CONSTRAINT s_employee_userid_uk UNIQUE (userid), CONSTRAINT s_employee_commission_pct_ck CHECK (commission_pct IN (10, 12.5, 15, 17.5, 20)));

Page 56: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 56

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– 25 Records Inserted into Employee Table– Assume the Following Desired:

• Remove COMMENTS Column• Add FULL_NAME Column• Change DEPARTMENT_ID Column Name to DEPT_ID• Increase Salary of All Employees by 50%

– Step 1: Ensure Table Can be Redefined• Execute CAN_REDEF_TABLE Procedure• If Execution Succeeds without Error, Then can

Redefine

Page 57: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 57

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Step 1: Ensure Table Can be Redefined

– Success: s_employee Table Can be Redefined– Illustration of a Table that Cannot Be

Redefined• Create TEMP Table• Execute CAN_REDEF_TABLE• Error Due to No Primary Key in Table

EXECUTE dbms_redefinition.can_redef_table('plsql_user','s_employee')

PL/SQL procedure successfully completed.

Page 58: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 58

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Illustration of a Table that Cannot Be Redefined

– Set of Criteria Checked to Ensure Redefinition Allowed

CREATE TABLE temp(temp VARCHAR2(10));

EXECUTE dbms_redefinition.can_redef_table('plsql_user','temp')begin dbms_redefinition.can_redef_table('plsql_user','temp'); end;

*ERROR at line 1:ORA-12089: cannot online redefine table "PLSQL_USER"."TEMP" with no primary keyORA-06512: at "SYS.DBMS_REDEFINITION", line 8ORA-06512: at "SYS.DBMS_REDEFINITION", line 236ORA-06512: at line 1

Page 59: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 59

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Criteria Detailed:

• Oracle9i Database Administration Guide (Chp. 15)

• Oracle9i Supplied PL/SQL Packages Reference (Chp. 45)

– Step 2: Create Temporary Table with New Structure

CREATE TABLE temp_s_employee(employee_id NUMBER(7) CONSTRAINT s_employee_id_nn2 NOT NULL, employee_last_name VARCHAR2(25) CONSTRAINT s_employee_last_name_nn2 NOT NULL, employee_first_name VARCHAR2(25), employee_full_name VARCHAR2(51), userid VARCHAR2(8), start_date DATE, manager_id NUMBER(7), title VARCHAR2(25), dept_id NUMBER(7), salary NUMBER(11, 2), commission_pct NUMBER(4, 2), CONSTRAINT s_employee_id_pk2 PRIMARY KEY (employee_id), CONSTRAINT s_employee_userid_uk2 UNIQUE (userid), CONSTRAINT s_employee_commission_pct_ck2 CHECK (commission_pct IN (10, 12.5, 15, 17.5, 20)));

Page 60: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 60

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Step 3: Start the Redefinition Process

• Execute START_REDEF_TABLE Procedure• Map Existing Columns to Temporary Table

ColumnsBEGIN dbms_redefinition.start_redef_table('plsql_user', 's_employee','temp_s_employee', 'employee_id employee_id, employee_last_name employee_last_name, employee_first_name employee_first_name, employee_first_name||'' ''||employee_last_name employee_full_name, userid userid, start_date start_date, manager_id manager_id, title title, department_id dept_id, salary * 1.5 salary, commission_pct commission_pct');END;/

Page 61: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 61

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Step 3: Start the Redefinition Process

• If Singe Quote Desired, Use 2 Single Quotes (Line 7)• Standard SELECT Capabilities Valid in Column Mapping• Once Step 3 Complete, 25 Records Inserted into

Temporary Table– Step 4: Complete the Redefinition Process

• Execute FINISH_REDEF_TABLE Procedure• Synchronizes the Redefinition and Applies the Temporary

Architecture and Contents to the Existing Table• Prior to Executing the FINISH_REDEF_TABLE Procedure,

Option to Execute SYNC_INTERIM_TABLE Procedure to Synchronize Table Contents and Reduce the Completion Process Time

Page 62: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 62

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Step 4: Complete the Redefinition

ProcessBEGIN dbms_redefinition.sync_interim_table('plsql_user', 's_employee','temp_s_employee');END;/

BEGIN dbms_redefinition.finish_redef_table('plsql_user', 's_employee','temp_s_employee'); END; /

Page 63: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 63

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Step 4: Complete the Redefinition

ProcessDESCRIBE s_employee Name Null? Type ------------------------------- -------- ---- EMPLOYEE_ID NOT NULL NUMBER(7) EMPLOYEE_LAST_NAME NOT NULL VARCHAR2(25) EMPLOYEE_FIRST_NAME VARCHAR2(25) EMPLOYEE_FULL_NAME VARCHAR2(51) USERID VARCHAR2(8) START_DATE DATE MANAGER_ID NUMBER(7) TITLE VARCHAR2(25) DEPT_ID NUMBER(7) SALARY NUMBER(11,2) COMMISSION_PCT NUMBER(4,2)

Page 64: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 64

Expanded Oracle Supplied Packages

• DBMS_REDEFINITION Package Example– Step 4: Complete the Redefinition Process

– Step 5: Drop the Temporary Table

SELECT * FROM s_employee WHERE employee_id = 1;

EMP_ID EMP_L_NAME EMP_F_NAME EMP_FULL_NAME USERID ------ ---------- ---------- ---------------- --------1 VELASQUEZ CARMEN CARMEN VELASQUEZ cvelasqu

START_DATE MANAGER_ID TITLE DEPT_ID SALARY COMMISSION_PCT---------- ---------- --------- ------- ------ --------------03-MAR-90 PRESIDENT 50 3750

Page 65: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 65

Expanded Oracle Supplied Packages

• DBMS_METADATA Package– Provides an API to the Object Creation

Layer

– 19 Total Procedures and Functions

– Concentration on GET_DDL FunctionFUNCTION GET_DDL RETURNS CLOB Argument Name Type In/Out Default? ------------------------- ------------------ ------ -------- OBJECT_TYPE VARCHAR2 IN NAME VARCHAR2 IN SCHEMA VARCHAR2 IN DEFAULT VERSION VARCHAR2 IN DEFAULT MODEL VARCHAR2 IN DEFAULT TRANSFORM VARCHAR2 IN DEFAULT

Page 66: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 66

Expanded Oracle Supplied Packages

• DBMS_METADATA Package– Table Example (Create and GET_DDL)

CREATE TABLE temp(temp VARCHAR2(10) NOT NULL);

SET SERVEROUTPUT ON SIZE 1000000DECLARE CURSOR select_table IS SELECT table_name FROM user_tables WHERE table_name = 'TEMP'; temp1 VARCHAR2(30); temp2 VARCHAR2(4000); BEGIN OPEN select_table; FETCH select_table INTO temp1; temp2 := SUBSTR(dbms_metadata.get_ddl('TABLE', temp1), 1, 250); dbms_output.put_line('SQL: ' || temp2); END;/

Page 67: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 67

Expanded Oracle Supplied Packages

• DBMS_METADATA Package– Table Example (Output)

SQL: CREATE TABLE "TREZZOJ"."TEMP" ( "TEMP" VARCHAR2(10) NOT NULL ENABLE ) PCTFREE 10PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS

PL/SQL procedure successfully completed.

Page 68: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 68

Expanded Oracle Supplied Packages

• DBMS_METADATA Package– Procedure Example (Create and GET_DDL)

CREATE OR REPLACE PROCEDURE abc ASBEGIN NULL;END abc;

DECLARE CURSOR select_procedure IS SELECT object_name FROM user_objects WHERE object_type = 'PROCEDURE'; temp1 VARCHAR2(30); temp2 VARCHAR2(4000); BEGIN OPEN select_procedure; FETCH select_procedure INTO temp1; temp2 := SUBSTR(dbms_metadata.get_ddl('PROCEDURE',temp1), 1, 250); dbms_output.put_line('SQL: ' || temp2); END;/

Page 69: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 69

Expanded Oracle Supplied Packages

• DBMS_METADATA Package– Procedure Example (Output)

– Output can be Directed to a Flat File using the UTL_FILE Package or Inserted into a Table for Later Use

SQL: CREATE OR REPLACE PROCEDURE "TREZZOJ"."ABC" ASBEGIN NULL;END abc;

PL/SQL procedure successfully completed.

Page 70: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 70

Suspending the Database

Page 71: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 71

Suspending the Database

•New Ability to Suspend the Database– Database Suspend Method– Database Quiesce Method

•Suspend Method– Allows DBAs to Backup Database Without

Activity– Allows Current Executing Operations to

Complete– Queues All Operations During Suspension for

Execution when Suspend Complete– View the State of the Database (V$INSTANCE

View)

SELECT instance_name, version, startup_time, active_state, database_statusFROM v$instance;

INSTANCE_NAME VERSION STARTUP_T ACTIVE_ST DATABASE_STATUS------------- ---------- --------- --------- -----------------tusc9is 9.0.1.2.0 04-JAN-02 NORMAL ACTIVE

Page 72: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 72

Suspending the Database

•Suspend Method–Once Database Suspended, the Status Changes

–Resume Database Activity with RESUME Option

SELECT instance_name, version, startup_time, active_state, database_statusFROM v$instance;

INSTANCE_NAME VERSION STARTUP_T ACTIVE_ST DATABASE_STATUS------------- ---------- --------- --------- -----------------tusc9is 9.0.1.2.0 04-JAN-02 NORMAL SUSPENDED

ALTER SYSTEM SUSPEND;

ALTER SYSTEM RESUME;

Page 73: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 73

Suspending the Database

•Quiesce Method– Similar to SUSPEND Method– Allows DBAs to Perform Database Operations While

Suspending All Other Database Operations– Command Only Available to SYS and SYSTEM– Current Active Transactions Must Complete Prior to

Quiesce State Taking Effect– Queues All Operations During Suspension for

Execution when Suspend Complete– View the State of the Database (V$INSTANCE View)

Page 74: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 74

Suspending the Database

•Quiesce Method–Once Database Quiesce Command

Executed, the State Changes

SELECT instance_name, version, startup_time, active_state, database_statusFROM v$instance;

INSTANCE_NAME VERSION STARTUP_T ACTIVE_ST DATABASE_STATUS------------- ---------- --------- --------- -----------------tusc9is 9.0.1.2.0 04-JAN-02 QUIESCING ACTIVE

ALTER SYSTEM QUIESCE RESTRICTED;

Page 75: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 75

Suspending the Database

•Quiesce Method–Once Database Quiesce Command Executed and

the Database in a Quiesced State, the State Changes

–Resume Database Activity with UNQUIESCE Option

SELECT instance_name, version, startup_time, active_state, database_statusFROM v$instance;

INSTANCE_NAME VERSION STARTUP_T ACTIVE_ST DATABASE_STATUS------------- ---------- --------- --------- -----------------tusc9is 9.0.1.2.0 04-JAN-02 QUIESCED ACTIVE

ALTER SYSTEM UNQUIESCE;

Page 76: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 76

Additional Oracle9i New Features

Page 77: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 77

Additional Oracle9i Features

Resumable Space Allocation (suspend long running processes)

Segment Space Management (auto versus manual)

Multiple Block Sizes (tablespace dependent and separate cache for each)

Dynamic SGA Sizing (ability to modify the SGA with init.ora parameters)

Managing UNDO Space (rollback segment management by Oracle)

Page 78: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 78

Additional Oracle9i Features

Drop the OS Data Files Automatically (when dropping a tablespace)

EXTERNAL TABLES (reference flat file data within Oracle)

SERVER PARAMETER FILES (modify system parameters via ALTER SYSTEM and kept on shutdown/startup)

MONITORING INDEX USAGE (determine index usage)

iSQL*Plus (browser based SQL*Plus interface) New Hints

Page 79: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 79

Additional Oracle9i Features

Java Enhancements Oracle Enterprise Manager (OEM)

Enhancements Plan Stability Automate Statistic Gathering

(DBMS_STATS.GATHER*) Automate SQL Execution Memory Management Standby Databases Improvement Version 1.2 of IFS with Oracle9i V$SQL_PLAN Enhanced (actual plan versus

theoretical plan executed)

Page 80: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 80

Additional Oracle9i Features

New Join Syntax True Real Application Clusters (RACs -

replaces Oracle Parallel Server for real scalability by adding nodes and making it transparent to the environment (add nodes and disk when desired to improve performance/failover))

Security Improvements LogMiner Improvements (graphical user

interface and more automated) Skip Scan Index (ability to skip the first

portion of an index if not referenced)

Page 81: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 81

Additional Oracle9i Features

Flashback Queries Better Integration and More Flexibility

on LOBs Increased Support for XML Enhanced Bulk Operation Support List Partitioning Modifications in Storing Execution Plans cursor_sharing Enhancements (similar)

Page 82: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 82

Presentation Coverage

Oracle9i Overview Oracle9i Data Dictionary Oracle9i V$ Views New Data Types New Built-In Functions New SQL Commands Expanded Oracle Supplied Packages Suspending the Database Additional Oracle9i New Features

Page 83: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 83

For More Information

• The V$ Views for Oracle 9i PosterThis poster displays the V$ views of Oracle9i categorized by major function. The V$ (fixed) views are a supplement of views to the data dictionary and contain valuable real-time information that is stored in the SGA.

• Oracle PL/SQL Tips & TechniquesExpand your PL/SQL knowledge to the next level by using hundreds of PL/SQL tips and techniques provided in this one-of-a-kind reference, designed for every Oracle developer and database administrator. This book highlights many solutions that are either hidden, undocumented, or can only be discovered through many years of experience or through laborious trial and error. (Released: September, 1999; 942 pages)

Page 84: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 84

Summary

• Oracle9i Introduces Many New/Enhanced Features that Increase the Flexibility and Functionality of Oracle

• This Growth Includes a Wide Range of Both DBA and Developer Enhancements

• Learn These New Features and Make Sure You Thoroughly Understand the New Features Prior to Deploying in Your Environment

• Expand Your Arsenal and Utilize These New Features that Oracle Has Provided

Page 85: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

Joe Trezzo Contact Information

Phone: 630-960-2909Email: [email protected]

This presentation will be available on the TUSC Web

Site

www.tusc.com

Thank You for Coming

Page 86: OracleWorld 2002 Catapult to the Next Version: Oracle9i New Features Overview Joe Trezzo The Ultimate Software Consultants (TUSC) Abstract Number 32176.

A TUSC Presentation 86

References

• Oracle PL/SQL Tips & Techniques (Oracle Press), Joseph C. Trezzo• Oracle9I Instant PL/SQL Scripts (Oracle Press), Kevin Loney• Oracle9I DBA Handbook (Oracle Press), Kevin Loney• Oracle9i The Complete Reference (Oracle Press), Kevin Loney• PL/SQL User's Guide and Reference(Release 9.0.1)• Supplied PL/SQL Packages and Types Reference (Release 9.0.1)• Application Developer’s Guide - Fundamentals (Release 9.0.1)• Oracle9i Database New Features (Release 9.0.1)• Oracle9i Database Administrators Guide (Release 9.0.1)• Oracle9I SQL Reference (Release 9.0.1)• Concepts (Release 9.0.1)• $ORACLE_HOME/rdbms/doc/README_rdbms.htm• www.tusc.com• All companies and product names are trademarks or registered trademarks

of the respective owners.• Please report errors in this article to TUSC. Neither TUSC nor the author

warrant that this document is error-free. Please provide comments/questions to [email protected]. TUSC copyright 2002.

• This document cannot be reproduced without expressed written consent from an officer of TUSC