1730_dba_ocp_9

29
8/10/2019 1730_DBA_OCP_9 http://slidepdf.com/reader/full/1730dbaocp9 1/29

Upload: iulian-best

Post on 02-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 1/29

Page 2: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 2/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Table of ContentsSecuri ty Enhancements .................................................................................................................................................. 3

 

Server Manager is Deprecated...................................................................................................................................... 3 

CONNECT INTERNAL is Deprecated........................................................................................................................... 3 

Default Security is Enhanced......................................................................................................................................... 4 

Encryption ...................................................................................................................................................................... 4 

Virtual Private Databases (VPDs).................................................................................................................................. 4 

Secure Application Role................................................................................................................................................. 5 

Global Application Context............................................................................................................................................. 6 

Partitioned Fine-Grained Access Control ...................................................................................................................... 6 

Fine Grained Auditing (FGA) ......................................................................................................................................... 7 

Optional Security Products ............................................................................................................................................ 8 

Oracle Label Security ................................................................................................................................................. 8 

Oracle Single Sign-on (SSO) ..................................................................................................................................... 8 

Oracle Enterprise Login Assistant (ELA).................................................................................................................... 8 

High Availabil ity Enhancements .................................................................................................................................... 8 

Minimal I/O Recovery..................................................................................................................................................... 8 

Fast-Start Time-Based Recovery Limit.......................................................................................................................... 8 

New Online Operations.................................................................................................................................................. 9 

Rebuilding Indexes Online ......................................................................................................................................... 9 

Managing Index Organized Tables (IOTs) Online ..................................................................................................... 9 

Online ANALYZE Command...................................................................................................................................... 9 

Online Table Redefinition........................................................................................................................................... 9 

Online Configuration Parameter Updating ............................................................................................................... 10 

Oracle Flashback ......................................................................................................................................................... 11 

Resumable Space Allocation....................................................................................................................................... 11 

New Import/Export Features........................................................................................................................................ 12 

Data Guard .................................................................................................................................................................. 13 

LogMiner Enhancements .............................................................................................................................................. 14 

Backup and Recovery Enhancements ........................................................................................................................ 14 

Backup and Recovery Enhancements ........................................................................................................................ 15 

Trial Recovery.............................................................................................................................................................. 15 

Recovery Manager (RMAN) Enhancements ............................................................................................................... 15 

Block Media Recovery (BMR) .................................................................................................................................. 15 

The CONFIGURE Command................................................................................................................................... 15 

Other RMAN Enhancements.................................................................................................................................... 16 

Page 3: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 3/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Manageabi li ty Enhancements ...................................................................................................................................... 16 

Oracle-Managed Files (OMFs) .................................................................................................................................... 16 

Default Temporary Tablespaces.................................................................................................................................. 17 

 Automated Undo Management (AUM) ........................................................................................................................ 17 

Multiple Block Sizes ..................................................................................................................................................... 18 

 Automatic Global Index Management.......................................................................................................................... 18 

List Partitioning ............................................................................................................................................................ 18 

Metadata Application Programming Interface (API) .................................................................................................... 19 

Bitmap Join Indexes..................................................................................................................................................... 19 

 Automatic Segment Space Management .................................................................................................................... 20 

Database Resource Manager (DRM) .......................................................................................................................... 20 

Scalable Session Management ................................................................................................................................... 21 

Memory Management.................................................................................................................................................. 21 

Real Application Clusters (RAC).................................................................................................................................. 22 

Workspace Management............................................................................................................................................. 22 

External Tables ............................................................................................................................................................ 22 

Replication Enhancements .......................................................................................................................................... 23 

Oracle Enterprise Manager (OEM) Enhancements..................................................................................................... 23 

Performance Enhancements ........................................................................................................................................ 23 

Index Monitoring .......................................................................................................................................................... 23 

Skip Scan Index Access .............................................................................................................................................. 24 

First Rows Optimization............................................................................................................................................... 24 

System Statistics.......................................................................................................................................................... 24 

Cursor Sharing............................................................................................................................................................. 25 

SQL Language Enhancements..................................................................................................................................... 25 

Joins ............................................................................................................................................................................. 25 

CASE Expressions....................................................................................................................................................... 26 

New Functions ............................................................................................................................................................. 26 

New Functions ............................................................................................................................................................. 27 

Globalization Enhancements ....................................................................................................................................... 27 

Miscellaneous Language Enhancements.................................................................................................................... 28 

Page 4: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 4/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Security Enhancements

Server Manager is Deprecated9i obsoletes the Server Manager: now, you start and stop Oracle through SQL*Plus. Use the STARTUP andSHUTDOWN commands from within SQL*Plus.

This means you have to rewrite scripts that do this work from within Server Manager. This table summarizes somedifferences between Server Manager and SQL*Plus, for which you’ll need to revise your scripts:

Server Manager: SQL*Plus Equivalent :

SET STOPONERROR WHENEVER SQLERROR,

WHENEVER OSERROR

SET CHARWIDTH,

SET DATEWIDTH,

SET LONGWIDTH

COLUMN colname FORMAT format_spec

SET MAXDATA No equivalent; remove

SET RETRIES No equivalent; remove

Comments Code comments between /*  and */ 

CONNECT INTERNAL is Deprecated 

9i no longer supports CONNECT INTERNAL and CONNECT INTERNAL/PASSWORD. Using them yields the errormessage:

ORA-09275: “ CONNECT INTERNAL is not a valid DBA connect ion”

Instead, use SQL*Plus with the CONNECT command. As before, you can use either:

Password file authentication ---or---

Operating System (OS) authentication

Use Oracle’s password file authentication to connect with DBA privileges over a nonsecure connection:

SQL> CONNECT username/password AS SYSDBA

Use Oracle’s OS authentication to connect with DBA privileges for a local database or over a secure connection to aremote database:

SQL> CONNECT / AS SYSDBA

The slash (“/”) without username or password denotes OS authentication. The OS user must belong to the dba groupunder Unix or Linux, or to the ora_dba group on Windows Servers.

Page 5: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 5/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Default Security is EnhancedThe Database Creation Assistant (DBCA) embodies many small enhancements for better default security.

DBCA prompts for passwords for users SYS and SYSTEM when creating a new database. Previously, you couldcreate these accounts with default passwords, and it was up to you to remember to change them to something securelater.

With the exceptions of SYS, SYSTEM, and SCOTT, user accounts are automatically created as locked and expired.You must enable their use by unlocking them, then creating a valid new password:

 ALTER USER username ACCOUNT UNLOCK;

 ALTER USER username IDENTIFIED BY new_password;

Dictionary Access 

Previous releases of Oracle used this default configuration parameter:

O7_DICTIONARY_ACCESSIBILITY = TRUE

9i changes this default to a more secure setting by using this default:

O7_DICTIONARY_ACCESSIBILITY = FALSE

EncryptionThe DBMS_OBFUSCATION_TOOLKIT now supports a Federal Information Processing Standard (FIPS) 140 certifiedrandom number generator called GETKEY.

Virtual Private Databases (VPDs)The Virtual Private Database (VPD) concept allows multiple users and applications to access a common shared

database server while logically separating their data based on security policies. Thus each set of users or applicationsappears to have its own “virtual private database.”

Create security policies that are associated with tables or views. (Associating security policies with tables andviews, rather than applications or user ids, means that the security system is contained and managed from within thedatabase, rather than in applications.)

Security policies can be created for the different SQL statements (SELECT, INSERT, UPDATE and DELETE). Theserver invokes the security policy for the table or view that is accessed with the particular SQL statement. This isimplemented by Oracle’s transparent rewrite of the query where it appends a WHERE clause that reflects the propersecurity policy. For example, this SELECT statement:

SELECT * FROM DEPARTMENT_TABLE ;

might be internally rewritten as this statement after applying a security policy for the DEPARTMENT_TABLE when

SELECTs are involved:SELECT * FROM DEPARTMENT_TABLE

WHERE DEPT = ‘ACCOUNTING’ ;

The GUI to create and manage security policies is called the Oracle Policy Manager. It is part of the Oracle EnterpriseManager (OEM) GUI. With it, you can create and manage security policies, associate them with tables and views, andcreate and manage application contexts (described below).

VPDs were introduced in Oracle8i. 9i greatly extends their usefulness through new 9i features:

Page 6: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 6/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Secure application roles

Global application contexts

Partitioned fine-grained access control

The next few sections discuss these new 9i features.

Secure Application Role 

8i introduced Secure Application Context, the ability to tailor or limit access to tables and views based on attributes ofthe user’s session. 9i takes this a step further. Now you can assign a set of security roles for each application, thenassign users to the roles. Here are the steps to set this up:

1. Create the role. The role does not refer to a password. Instead it refers to a stored procedure that authenticateswhether the user is allowed to use this role.

This example creates a Security Application Role, which is authenticated by the procedure verify_dba_manager :

CREATE ROLE dba_manager IDENTIFIED USING verify_dba_manager;

2. Now write the procedure that authenticates the user for this role. It should contain logic that either verifies the user

can be set to this role, or that the user is not eligible to use this role. The Oracle procedureDBMS_SESSION.SET_ROLE is used for this purpose. Here’s an example:

CREATE OR REPLACE PROCEDURE verif y_dba_manager

 AUTHID CURRENT_USER IS inst ring VARCHAR2(30);

BEGIN

…. IF (user context is appropr iate) …THEN

DBMS_SESSION.SET_ROLE(‘dba_manager’);

ELSE

RETURN;

END IF;END; 

3. When the application starts, it should enable the role(s) it will use by the

SET_ROLE statement.

Remember that as in 8i, an application can query its context by using the DBMS_SESSION.SYS_CONTEXT  package:

SYS_CONTEXT(‘userenv’, ‘attribute’) ;

Page 7: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 7/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Global Application Context When building web applications, for performance reasons you typically use a middle tier with Oracle’s connectionpooling. You’ll also want to pool and reuse application contexts – this is referred to as Global Application Context.This is more scalable because applications reuse Global Application Contexts instead of creating individual usersessions. 9i contains a set of procedures to support this feature in its package DBMS_SESSION:

Procedure: Use:

SET_CONTEXT Sets the global application context

CLEAR_CONTEXT Clears the context

SET_IDENTIFIER Associates a pre-established global application context(an existing database connection) with a particular clientsession

CLEAR_IDENTIFIER Releases the client session’s access to the globalapplication context

SYS_CONTEXT Retrieves info about the context associated with theSET_IDENTIFIER that was executed

Here are the steps to using global application contexts:

1. Create a global application context, using the ACCESSED GLOBALLY phrase, to show that it is available for reuse:

CREATE CONTEXT dba_manager USING dba.ini t ACCESSED GLOBALLY; 

2. The middle tier application starts up and establishes database connections. When a user logs in, the applicationassigns a temporary identifier ID for it. The application returns the ID as a cookie residing on the user’s machine andbrowser, or maintains it itself.

3. When the application invokes the ‘dba.init’ package in order to initialize the application context, the package issuesSET_CONTEXT commands using the temporary ID to set the application’s context.

4. The application gets an existing database connection for this user session by issuing SET_IDENTIFER.

5. The user uses the database application and makes authorized database calls.

6. When done, the client’s access to the global application context is released by CLEAR_IDENTIFIER andCLEAR_CONTEXT.

Partitioned Fine-Grained Access ControlIn 9i, you can assign multiple security policies for a table or view. All policies must be satisfied to get data access. Inother words, Oracle treats multiple policies as if there is a logical AND relating them.

For better control of the security facility, several Security Policies may be combined into a Security Policy Group. TheGroup is then associated with an application context, known as the driving application context. Oracle refers to thedriving application context to identify and apply the security policy group when users try to reference the data. Oracleapplies all security policies in that group to determine if the user can access the data. So security policy groups allowyou to partition fine-grained access control based on the driving application context.

In the Oracle Policy Manager GUI tool, there is a folder for Fine-Grained Access Control, and under it, a folder for thePolicy Groups. Security Policies are organized under a security policy group (by default called SYS_DEFAULT).

Page 8: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 8/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Oracle provides the DBMS_RLS package for working with policies, with such procedures asCREATE_POLICY_GROUP, ADD_GROUPED_POLICY, and ADD_POLICY_CONTEXT.

Here’s an example of how to use partitioned fine-grained access control:

1. Two groups of users have different security needs. Set up a driving application context for each user group(call them USER_1_CONTEXT and USER_2_CONTEXT).

2. Now set up a security policy group for each (call them USER_1_POLICY_GROUP andUSER_2_POLICY_GROUP).

3. When a user in the first driving application context tries to access data, Oracle applies all security policies inUSER_1_POLICY_GROUP and then all in SYS_DEFAULT. When a user in the USER_2_CONTEXT tries toaccess data, Oracle applies all policies in USER_2_POLICY_GROUP, and then those in SYS_DEFAULT.Only if all policies are satisfied can the user access data.

If you do not set up the driving application context, or if it is NULL, Oracle executes all the policies associated with thetable or view. This ensures applications can not circumvent security.

Fine Grained Auditing (FGA)You can create and manage audit policies using the new Oracle package DBMS_FGA and its procedures

 ADD_POLICY, DROP_POLICY, DISABLE_POLICY, and ENABLE_POLICY.

When you create an audit policy, it is stored in Oracle’s data dictionary table DBA_AUDIT_POLICIES. When thepolicy is triggered (through appropriate data access), the audit event data is stored in table DBA_FGA_AUDIT_TRAIL.The information collected includes session id, username, timestamp, policy name, and the SQL query text.

The audit policy is only triggered when the condition you specified in the ADD_POLICY statement is met.

You can also specify an audit column to restrict audits. Only queries meeting the audit condition and referencing theaudit column will be audited. Take this example audit policy:

DBMS_FGA.ADD_POLICY (

object_schema => ‘dba_group’,

object_name => ‘dept’ ,

pol icy_name => ‘audit_spies’,

audit_condition => ‘emp_status = ‘ ‘SPY’ ’ ’,

audit_column => ‘spy_id’ ) ;

Prior to adding the audit_column, any access to the object that meets the audit_condition  triggers an audit event. Adding the audit_column, as in the policy definition above, means the audit only occurs if the audit_condition  is metand the audit_column is referenced in the user’s query.

You can additionally specify an audit event handler when creating an audit policy. Add lines like these to the samplecode above to specify the event handler:

handler_schema => ‘dba’,handler_module => ‘dba_spies_handler’ ,

Now, code the audit event handler named DBA_SPIES_HANDLER like any other stored procedure, using theCREATE OR REPLACE PROCEDURE statement.

Page 9: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 9/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Optional Security ProductsOracle Advanced Security (OAS) includes a number of optional products. OAS has been certified at security level 2 ofthe FIPS 140-1 security standards specification. OAS includes the optional products Oracle Label Security, OracleSingle Sign-On (SSO), and Oracle Enterprise Login Assistant (ELA).

Oracle Label Security

Use either Oracle-supplied PL/SQL packages or the Oracle Policy Manager GUI tool to set up and administer OracleLabel Security. Create labels and associate the label security policies with tables and views.

When a user tries to access a row of data, the user’s label security privilege is validated against the security label forthe row. Access is only permitted to the user if validation of the row label succeeds.

Label security places the security with the data and requires granting label security privileges to users.

Oracle Single Sign-on (SSO)

Oracle Single Sign-On (SSO) allows a user to sign on once, with a single password, to multiple web-based

applications. SSO uses the underlying Oracle component, Oracle Login Server, to authenticate users. Oracle LoginServer requires cookies to implement the SSO capability, so users can not use SSO if their browser is not set tosupport cookies.

Oracle Enterprise Login Assistant (ELA)

Enterprise Login Assistant (ELA) enables enterprise-wide logins by using a wallet located in a default folder. Whenyou log in and enter a password, ELA keeps it in your wallet. Your state is “logged in” as long as the wallet exists.ELA can authenticate you to an LDAP server without asking for your password again. ELA allows you to update yourwallet, directory and database passwords.

High Availabili ty Enhancements

Minimal I/O RecoveryThis minimizes the number of redo log entries (data change records) that must be read and applied during recovery.9i achieves this through two passes of the redo logs. The first pass identifies dirty blocks and stores this information inthe Program Global Area (PGA). The second pass uses the PGA information to access and apply only the identifiedchanges. This is faster because Oracle only accesses those blocks required for recovery.

Fast-Start Time-Based Recovery Limit

You can specify the target mean time to recover (MTTR) for instance recovery by setting initialization parameterFAST_START_MTTR_TARGET to a value between 0 and 3,600 seconds. Set it dynamically by:

 ALTER SYSTEM SET FAST_START_MTTR_TARGET = number_of_seconds ;

 A lower value results in more frequent checkpointing by Oracle but a faster instance recovery. You no longer setvalues for initialization parameters FAST_START_IO_TARGET and LOG_CHECKPOINT_INTERVAL when using thisnew feature. Oracle uses FAST_START_MTTR_TARGET to calculate and set these values internally. If you do codethem, they override the values Oracle would otherwise calculate based on FAST_START_MTTR_TARGET. 9imakes obsolete the initialization parameter DB_BLOCK_MAX_DIRTY_TARGET .

Page 10: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 10/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

New Online Operations

Rebuilding Indexes Online

8i introduced the online building of indexes. 9i extends this feature to theonline rebuilding of reverse key indexes, function-based indexes, and key-compressed indexes on tables and index-organized tables (IOTs). 9i doesnot support online index rebuilding for bitmap indexes or partitioned localand global indexes.

While the index is being rebuilt online, users can issue DML against the tablebut not DDL. Changes that occur during the index rebuild are internallydocumented by Oracle in an IOT. The syntax to rebuild an index online is:

 ALTER INDEX my_index REBUILD ONLINE ;

Managing Index Organized Tables (IOTs) Online

You can now coalesce IOTs online. The coalesce operation defragmentsthe index tree. Do this by:

 ALTER TABLE my_iot_table COALESCE ;

You can now create secondary indexes for IOTs while they are in use:

CREATE INDEX my_iot_secondary_index

ON my_iot_table (column_to_index) ONLINE ;

You can also rebuild the IOT’s secondary index while it is online:

 ALTER INDEX my_iot_secondary_index REBUILD ONLINE ;

 As the index becomes stale, you may update the logical ROWIDs used inthe IOT’s secondary index by this statement:

 ALTER INDEX my_iot_secondary_index UPDATE BLOCK

REFERENCES ;

If you store a non-key column in the primary key B-tree index of an IOT, itreduces the density of the index rows in the leaf blocks. Specify an overflowsegment in a move operation to address this problem:

 ALTER TABLE my_iot_table MOVE ONLINE

TABLESPACE my_ts

OVERFLOW TABLESPACE my_overflow_ts ;

Online ANALYZE Command

9i allows you to validate the structure of a table while users perform DMLstatements against it:

 ANALYZE TABLE my_table VALIDATE STRUCTURE ONLINE ;

Online Table Redefinition

9i allows you to redefine a table online. Users can issue DML against thetable during most of the online redefinition. For online table redefinition, the

Page 11: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 11/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

table:

Must have a primary key, and source and target tables for redefinition must have the same primary key column

Can not contain BFILE or LONG columns, user-defined types, or be part of a cluster or be an overflow table foran IOT

Can not belong to SYS or SYSTEM schemas, or have materialized views or materialized view logs defined on it

Here is the process of online table redefinition:

1. Run the Oracle procedure DBMS_REDEFINITION.CAN_REDEF_TABLE to verify that the table meets theabove conditions and can be redefined online

2. Create an interim table with the same characteristics and in the same schema as the table to redefine

3. Run DBMS_REDEFINITION.START_REDEF_TABLE to start the redefinition process

4. Create indexes, constraints, triggers, and grants with different names on the interim table. DISABLE allconstraints (Oracle automatically ENABLEs them for you later).

5. If a large number of DML updates are going against the original table, sync it with the interim table by runningDBMS_REDEFINITION.SYNC_INTERIM_TABLE.

6. Complete the redefinition by running DBMS_REDEFINITION.FINISH_REDEF_TABLE. The table is brieflylocked in exclusive mode as the original table is redefined with all the characteristics, indexes, constraints,triggers, and grants that you defined on the interim table. Constraints are automatically enabled.

Note that if any problem occurs during the redefinition process, you must runDBMS_REDEFINITION.ABORT_REDEF_TABLE to terminate the redefinition process.

Online Configuration Parameter Updating

Oracle keeps initialization parameters in its parameter file (PFILE). Now Oracle also has a binary file equivalent to thePFILE called the server parameter file (SPFILE). Unlike the PFILE, you can not edit the SPFILE, because its contentsare binary.

To create an SPFILE: CREATE SPFILE FROM PFILE ;

To view settings within the SPFILE, query the dictionary view V$SPPARAMETER.

Change parameter file settings with the ALTER SYSTEM statement. Set the SCOPE for this statement as follows:

MEMORY – Change only applies to the current instance

SPFILE – Change only applies to the SPFILE (not to the current instance)

BOTH – Applies the change immediately to the current instance and to the SPFILE as well

The default is MEMORY if the PFILE was used to start the database. The default is BOTH if the SPFILE was used tostart the database.

To export the SPFILE to a PFILE, run:

CREATE PFILE=’editsp.ora’ FROM SPFILE;

You can edit the exported file with a text editor, then recreate the SPFILE from it. Remember that since the SPFILE isin binary format you can not directly edit it.

Page 12: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 12/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Oracle FlashbackOracle Flashback allows you to query the database as of a specific time or System Change Number (SCN) in the past.It can be useful in recovering from a recent logical or user error – just use Flashback to query the data prior to anaccidental data deletion, for example.

To use Flashback you must have already:

Set the initialization parameter UNDO_MANAGEMENT = AUTO

(This enables a new 9i feature called Automatic Undo Management, for Oracle-controlled management ofrollback segments.)

Set the initialization parameter UNDO_RETENTION to how far back (in seconds) Oracle should retain undoinformation:

Example:  ALTER SYSTEM SET UNDO_RETENTION = 1600 ;

Have the execute privilege on system package DBMS_FLASHBACK 

Here’s how to use Flashback:

Run either DBMS_FLASHBACK.ENABLE_AT_TIME orDBMS_FLASHBACK.ENABLE_AT_SYSTEM_CHANGE_NUMBER  to enable Flashback for the session andindicate the time or SCN to return to

Perform the query and access missing information by a PL/SQL cursor. You can not use a regular DML queryfor this purpose!

Disable Flashback when done by running DBMS_FLASHBACK.DISABLE 

 A primary limitation in using Flashback is how much extra Undo information you want to store, and how much spaceyou are willing to allocate to this purpose.

Resumable Space AllocationResumable space allocation suspends a long-running operation in event of a space allocation error so that you can fixthe problem. Then Oracle automatically resumes the long-running operation. Operations that are resumable are:

Queries that run out of temporary sort space

DML – INSERT, UPDATE, and DELETE statements 

DDL – CREATE TABLE AS SELECT, ALTER TABLE, CREATE INDEX, ALTER INDEX, and statements thatcreate materialized views or materialized view logs

Import/Export – SQL*Loader operations

The space problems resumable space allocation addresses are:

Out of space

Maximum extents reached

Space quota exceeded

To use resumable space allocation, set your session as resumable, and ensure you have the RESUMABLE systemprivilege:

 ALTER SESSION ENABLE RESUMABLE ;

GRANT RESUMABLE TO my_id ;

Page 13: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 13/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

If an operation is suspended, Oracle writes an error to its Alert log. Views USER_RESUMABLE andDBA_RESUMABLE contain info on the error, or you can run DBMS_RESUMABLE.SPACE_ERROR_INFO for errordetails. Fix the error, then Oracle will automatically resume the suspended statement.

Oracle also provides the AFTER SUSPEND system event to handle resumable space errors. You could use this, forexample, in a trigger with custom code:

CREATE OR REPLACE TRIGGER my_space_handler AFTER SUSPEND ON DATABASE…

New Import/Export Features 

New 9i IMPORT parameters:

IMPORT Parameter: Use:

STATISTICS ALWAYS Import the database statistics in the EXPORT file.Default.

STATISTICS NONE Do not import or recalculate database statistics

STATISTICS SAFE Import statistics if there is no question about theirvalidity

STATISTICSRECALCULATE

Recalculate the statistics, rather than importingthem

New 9i EXPORT parameter:

EXPORT Parameter: Use:

TABLESPACES Only exports Tables with that Tablespace, plus

corresponding indexes (regardless of thetablespace in which they reside)

New 9i parameters that apply to both IMPORTs and EXPORTs:

New Parameter: Use:

RESUMABLE Enables/disables resumable space allocation

RESUMABLE_NAME A name to identify the resumable space operation

RESUMABLE_TIMEOUT The resumable space allocation must be fixedwithin this time period, or else roll back occurs

(default is 7,200 seconds)

FLASHBACK_SCN Enables Flashback to the specified SCN

FLASHBACK_TIME Enables Flashback to the specified time

Page 14: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 14/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Data GuardOracle’s Standby Database feature has been upgraded and renamed to Data Guard in 9i. Data Guard allows you toset up a standby database (locally or at a remote site) and keep it either completely or approximately “in sync” withthe primary database by automatically shipping and applying redo logs to the standby database. This provides forquick disaster and/or off-site recovery should the primary database be lost or destroyed. Data Guard components

are: Data Guard Manager – The new administrative Data Guard GUI (part of OEM)

Data Guard Command Line Interface (CLI) – For issuing commands

Data Guard Monitor (DMON) – A monitor process that supports the Data Guard administration

Update the standby database by one of four Data Guard modes:

Guaranteed – Keeps primary and standby totally in sync at all times. Primary transactions are not committeduntil verification that the change has been applied to the standby

Instant – Ensures changes are shipped to the standby but does not require they immediately be applied andconfirmed

Rapid – Log Writer (LGWR) on the primary sends changes to the standby as soon as it can

Delayed – the Archiver Process (ARCH) process on the primary send changes to the standby. You can specifya time lag prior to propagation (this can help avoid propagating errors)

Guaranteed mode is the most conservative and keeps the standby totally synchronized with the primary, but impactsprimary performance the most. The other modes are progressively “looser” in the coupling between the primary andstandby but cause less performance impact on the primary. You configure the mode (and other Data Guard attributes)by the initialization parameters LOG_ARCHIVE_DEST_n and LOG_ARCHIVE_DEST_STATE_n.

Role Management Service (RMS) helps you to perform database transitions (switching the roles of the primary andstandby databases). A switchover is a planned transition whereby you purposefully make the primary the standby, andvice versa. Among the commands you use during a switchover are these key ones:

 ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;

 ALTER DATABASE MOUNT STANDBY DATABASE;

 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;

 ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL PRIMARY;

 A switchback is the reverse of the switchover operation. It puts the two databases back to their original roles asprimary and standby.

 A graceful failover is performed when the primary becomes unavailable but you have its redo logs to apply to thestandby. Apply any and all possible logs to the standby:

 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

then issue:

 ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL PRIMARY;

 A forced failover occurs when the primary fails and redo logs are not all available. Some redo may be lost as youactivate the standby. Key commands here include:

 ALTER DATABASE SET STANDBY DATABASE UNPROTECTED;

 ALTER DATABASE ACTIVATE STANDBY DATABASE;

 An archive log gap occurs whenever a primary database archives the online redo log, but it is not also archived to thestandby database. 9i automatically recovers archive log gaps for you. Set this up by initialization parameters thatassign service names to the primary and standby databases:

Page 15: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 15/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

FAL_CLIENT = ‘standby_name’

FAL_SERVER = ‘primary_name’

9i includes a Managed Recovery Process (MRP), a process that automatically applies archived redo logs on thestandby database server to the standby database. Put a standby database into MRP mode by running:

 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;

LogMiner Enhancements9i improves LogMiner in a variety of ways. The purpose of LogMiner is to allow you to view entries in the redo log (thelog that records database changes).

LogMiner now has a GUI called the LogMiner Viewer. Use this new GUI in viewing the contents of the redo log filesvia the view V$LOGMNR_CONTENTS. LogMiner Viewer has Display Options that allow you to specify whatinformation you want to view from the logs. Two of the key fields are SQL_REDO and SQL_UNDO. The formercontains the redo log statement, while the latter has its “inverse” – a statement that would reverse its effects (or “undo”it).

9i now records DDL statements in the redo logs. (You no longer have to reverse-engineer them from the complexDML Oracle runs against its internal tables, as you had to when using LogMiner under 8i). You can track (but not)undo DDL commands. That is, you can still not recover from a table DROP or TRUNCATE using this feature.

Remember that LogMiner requires access to the data dictionary in order to translate object identifiers into their namesand data according to proper data types. Without dictionary access, LogMiner returns object identifiers and hex datarepresentations – not too useful. You can now extract the data dictionary to either a flat file or to the redo log files byusing the procedure DBMS_LOGMNR_D.BUILD. Specify the OPTIONS parameter in this procedure as eitherSTORE_IN_FLAT_FILE or STORE_IN_REDO_LOGS.

There is also a third OPTION – DICT_FROM_ONLINE_CATALOG. This uses the online data dictionary, which couldpossibly be inaccurate if the database changed since the logs were generated.

If you extract the dictionary to either a flat file or the redo logs, you can specify the additional optionDDL_DICT_TRACKING. This prompts LogMiner to keep its extracted dictionary in sync with any changes to the real

data dictionary by applying DDL it encounters in the redo logs. LogMiner detects that its dictionary export is stale (obsolete) through its use of object version numbers.

LogMiner stops whenever it encounters a corruption in the redo log it is viewing. Use the OPTION called SKIPCORRUPTIONS to force it to continue beyond corruptions.

Page 16: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 16/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Backup and Recovery Enhancements

Trial RecoveryThe new 9i Trial Recovery feature does not write changes to files, just to the data buffers. Errors are written to the

 Alert Log. Trial Recovery allows you to test out recovery and find any corrupt blocks without failing at a real recovery

and leaving files in an inconsistent state. Use the keyword TEST for a trial recovery:

RECOVER DATABASE . . . TEST ;

 Also new in 9i is the ability to continue even past n corrupt blocks:

RECOVER DATABASE ALLOW n CORRUPTION;

Recovery Manager (RMAN) Enhancements

Block Media Recovery (BMR)

By default, RMAN’s backup/recovery method operates on the datafile level. 9i now allows you to recover individualdata blocks, called block media recovery (BMR). BMR is quicker than full file recovery where you have a smallnumber of corrupt blocks that need to be recovered. Plus you do not have to take either the datafile or the databaseoffline to perform BMR. BMR minimizes Mean Time to Recover (MTTR).

Determine what blocks are bad from views V$BACKUP_CORRUPTION and V$COPY_CORRUPTION. Oracle writesinformation about block corruption in both the Alert Log and the user trace files.

Here’s the command to recover one or more data blocks:

BLOCKRECOVER DATAFILE filename_1 BLOCK b1 [, b2, b3 …]

[ DATAFILE filename_2 BLOCK b4, b5 … ]

Restrictions:

You can only do BMR from RMAN (not from SQL*Plus)

You can only do BMR off full backups (not incremental backups)

You can only recover complete blocks

The CONFIGURE Command

The new 9i RMAN CONFIGURE command lets you permanently configure many aspects of RMAN. Configure thewindow for the retention policy:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

Configure the redundancy policy:

CONFIGURE RENTENTION POLICY TO REDUNDANCY 5;

Configure the default backup device type:

CONFIGURE DEFAULT DEVICE TYPE TO DISK;

Clear the previous command:

CONFIGURE DEFAULT DEVICE TYPE CLEAR;

You can also use the CONFIGURE command to assign attributes to channels. As well, you can configure things sothat control files are automatically backed up without having to specify the INCLUDING CONTROL FILE phrase on theBACKUP command.

Page 17: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 17/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

You can configure to exclude certain tablespaces from backups:

CONFIGURE EXCLUDE FOR TABLESPACE my_ts  ;

 Append keyword CLEAR to that command to remove the exclusion.

Turn on backup optimization with:

CONFIGURE BACKUP OPTIMIZATION ON;This skips files that already have a backup on the backup device with the same header status (they don’t need to bebacked up, because the same header means the original files have not been changed).

Other RMAN Enhancements

 Archivelog Backup – Include any archivelogs not yet backed up with a datafile backup by this command: BACKUPDATAFILE n PLUS ARCHIVELOG ;

Restartable Backup - Back up files that have not been backed up since a particular date and time with the new clauseNOT BACKED UP [SINCE TIME…]. Example:

BACKUP DATABASE NOT BACKED UP SINCE TIME ‘sysdate – 5 ;

Smarter Restoration – Oracle only restores files whose headers do not match those of the target. This savesneedlessly restoring certain files that are unchanged.

Other Improvements -

9i backs up tablespaces of different blocksizes in one command

Report obsolete backups not needed in the recovery period specified: REPORT OBSOLETE RECOVERYWINDOW 7 DAYS; 

The RECOVERY WINDOW clause was added here too: 

REPORT NEED BACKUP RECOVERY WINDOW 7 DAYS:

Use the CROSSCHECK command to check if backup sets or file copies exist

Display RMAN session configuration by the SHOW or SHOW ALL commands The LIST command has new parameters BY BACKUP and BY FILE 

You can now execute the BACKUP and RESTORE commands directly from the RMAN prompt, instead of onlyfrom within a RUN command

Manageability Enhancements

Oracle-Managed Files (OMFs)OMFs are new in 9i. They are an ease-of-use feature by which Oracle automatically creates, names and sizes filesfor you. To use OMF, set these two parameters in Oracle’s initialization file:

DB_CREATE_FILE_DEST

- location where Oracle creates data and temp files

DB_CREATE_ONLINE_LOG_DEST_n

- location where Oracle creates online redo log and control files

If you do not set DB_CREATE_ONLINE_LOG_DEST_n, it defaults to DB_CREATE_FILE_DEST. If you do not seteither, you can not use OMF.

Page 18: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 18/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

The default size for data files and redo logs files is 100 Megabytes. Data files are auto-extensible to an unlimited filesize. Default file name extensions are:

File Type: Extension:

Data .dbf

Temp .tmp

Redo log .log

Control .ctl

 A big advantage to OMFs is that when you DROP the tablespace, its underlying data files are automatically erased onthe operating system level:

DROP TABLESPACE my_ts_omf ;

9i also allows you to delete underlying operating system files when you drop a tablespace with non-OMF files, but you

have to tell it explicitly to do so:

DROP TABLESPACE my_ts INCLUDING CONTENTS AND DATAFILES ;

You can not use OMFs with raw devices. You would not use OMFs for performance reasons, but for ease of use.

Default Temporary TablespacesIf you CREATE USER and forget to include a TEMPORARY TABLESPACE clause, Oracle uses the SYSTEM tablespace for that user’s sorts. This hurts performance. 9i addresses this by allowing you to specify a system-widedefault temporary tablespace. Specify the DEFAULT TEMPORARY TABLESPACE on the CREATE DATABASE statement. Or, define the new temporary tablespace by the CREATE TEMPORARY TABLESPACE statement, andmake it the default by running:

 ALTER DATABASE DEFAULT TEMPORARY TABLESPACE defaul t_temp_ts ;

 Automated Undo Management (AUM) 

9i’s new feature Automated Undo Management (AUM) relieves you of the traditional, labor-intensive task of sizing andmanaging rollbacks. To use AUM, create a tablespace that will be used for rollbacks (the UNDO tablespace). Thenstart the instance with these two new 9i initialization parameters set to:

UNDO_MANAGEMENT = AUTO

UNDO_TABLESPACE = undo_tablespace_name

Once an instance is started with AUM, you can not and do not create or manage rollback segments manually. Youcan switch to another UNDO tablespace whenever you want, but you can not drop an UNDO tablespace while it has

active transactions.

Page 19: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 19/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Multiple Block Sizes 9i supports multiple blocksizes within one database. The original block size specified is called the default blocksize orthe standard blocksize. An Oracle database can have up to four additional blocksizes. Oracle’s allowable blocksizesare 2, 4, 8, 16, and 32 Kilobytes.

The SYSTEM and temporary tablespaces must be of the standard blocksize, and all partitions of a partitioned table

must be of the same blocksize.

For each nonstandard blocksize you intend to use, you must set one initialization parameter to provide its cache.Here’s an example for an 8K blocksize:

DB_8K_CACHE_SIZE = 8M

Now you can create tablespace(s) with the new blocksize simply by appending the keywords BLOCKSIZE 8K to theCREATE TABLESPACE statement. The dictionary view DBA_TABLESPACES has the new column BLOCK_SIZE to track this parameter.

 Automatic Global Index Management

9i can now update global indexes when Oracle performs partition DDL. Code the UPDATE GLOBAL INDEXES clause to gain this capability:

 ALTER TABLE my_par t_table

DROP PARTITION my_partition_name

UPDATE GLOBAL INDEXES ;

The default is INVALIDATE GLOBAL INDEXES, so you must explicitly code UPDATE GLOBAL INDEXES to updatethe indexes.

List Partitioning

9i introduces a new method of partitioning tables, list partitioning:New in: Partition ing

Method:How it Works:

Oracle8 Range Partitions tables by ranges of values

Oracle8i Hash Partitions tables by use of a hash function

Oracle9i List Partitions tables by lists of values foreach partition

 A good example of list partitioning would be placing rows with various of the different 50 state codes in different

partitions. Note that with list partitioning you can not specify MAXVALUE (as in range partitioning). List partitioning isfor regular (heap) tables only, not for IOTs, and its does not support multicolumn partitioning.

Page 20: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 20/29

Page 21: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 21/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

 Automatic Segment Space ManagementPrior to 9i, you had to manage space manually by the PCTFREE,PCTUSED, and FREELIST GROUPS parameters. 9i makes theseparameters obsolete because its automatic segment space managementuses bitmaps instead of freelists.

To use this feature, the tablespace must be locally-managed and you mustuse the SEGMENT SPACE MANAGEMENT clause:

CREATE TABLESPACE my_ts

DATAFILE ‘d:\oracle\oradata\orc l\test.dbf’ size 10M

EXTENT MANAGEMENT LOCAL

SEGMENT SPACE MANAGEMENT AUTO ;  

View DBA_TABLESPACES lists whether segment space management is AUTO or MANUAL. Use the new DBMS_SPACE package procedureSPACE_USAGE to view information about free blocks in automaticallyspace-managed (ASM) segments.

Note that the ALTER TABLE command does not update the bitmap blocks(BMBs) if you use it to update PCTFREE for ASM segments. Run the newprocedure DBMS_REPAIR.SEGMENT_FIX_STATUS to remedy thisproblem.

Database Resource Manager (DRM)8i introduced DRM. It controls resources and in 9i can now:

Detect and stop long-running operations

Limit resource consumption

You administer DRM through the OEM GUI or by packagesDBMS_RESOURCE_MANAGER andDBMS_RESOURCE_MANAGER_PRIVS.

Remember the basic way to set up DRM:

1. Create a Pending Area with:DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); 

2. Create a Resource Plan by: DBMS_REOURCE_MANAGER.CREATE_PLAN 

3. Create Resource Consumer Groups (a Resource Plan can havemany Resource Consumer Groups)

4. Create Resource Plan Directives (to associate a Resource

Consumer Group with a Resource Plan and assign appropriateresources)

5. Validate the Pending Area by:DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();  

6. Submit the Pending Area by:DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); 

To limit job execution time, you can now set a value in seconds to theMAX_EST_EXEC_TIME parameter (its default is UNLIMITED). If

Page 22: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 22/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

SWITCH_ESTIMATE is true, and Oracle’s estimated execution time is greater than MAX_EST_EXEC_TIME, Oraclereturns an error and does not start the operation. If SWITCH_ESTIMATE is false, Oracle starts the operation even ifthe estimated execution time is greater than MAX_EST_EXEC_TIME.

DRM can switch resources from one group to another if SWITCH_GROUP is encoded and the value inSWITCH_TIME has been exceeded.

Scalable Session Management9i renames the Multi-threaded Server (MTS) to its new name Oracle Shared Server. Recall that this feature enhancesscalability by using dispatcher processes in managing client workflow.

9i improves performance for external procedures by establishing only one external procedure process for all clientsthat call a particular procedure. Use the CREATE OR REPLACE LIBRARY command to create external procedureagents.

9i reduces the average size of the kernel library modules and its kernel is more modular. This improves memoryutilization.

Oracle uses Heterogeneous Service (HS) agents to access non-Oracle databases. 9i introduces a newmultithreaded HS architecture (analogous to that of Oracle Shared Server). HS now uses three kinds of threads:

Monitor Thread – The control thread, launched first

Dispatcher Thread – Communicates with Oracle and sends tasks to Task Threads

Task Thread – Does the work (like shared server processes)

Memory Management9i can now dynamically manage the sizing of many of its internal memory work areas. Set the new initializationparameter PGA_AGGREGATE_TARGET to a value indicating total memory for the PGA’s *AREA parameters, thenyou can set new parameter WORKAREA_SIZE_POLICY to AUTO. The default value forPGA_AGGREGATE_TARGET is 0 – you must set it to some other value first, prior to changing

WORKAREA_SIZE_POLICY from MANUAL to AUTO, or else Oracle gives you an error. Both parameters aredynamic so you can set them via the ALTER SYSTEM command if desired.

9i allows you to dynamically re-size the Systems Global Area (SGA), without having to shutdown and restart Oracle.Be sure you have set the new initialization parameter SGA_MAX_SIZE to the maximum SGA size you’ll ever wantbefore doing this.

You can get feedback from Oracle about the use of the buffer cache and advice on sizing the buffer cache by:

1. Set DB_CACHE_ADVICE to ON by:

 ALTER SYSTEM SET DB_CACHE_ADVICE=ON;

2. Query performance view V$DB_CACHE_ADVICE for the results

Page 23: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 23/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Real Application Clusters (RAC) 9i renames Oracle Parallel Server (OPS) to Real Application Clusters (RAC). The most important new features ofRAC are:

One initialization parameter file can be shared among all instances in the cluster. If a parameter in the sharedfile applies to only one instance, use dot notation to indicate which instance the parameter applies to:

server_name.processes = 50

Cache Fusion – A Cache Fusion Block Transfer is a direct, cache-to-cache transfer of a data block betweeninstances. This is much faster than the previously available methods of transferring blocks, especially BlockTransfer with Forced Disk Write.

 As before, instances can hold a resource in one of three modes: NULL, Shared, or Exclusive. 9i’s new GlobalResource Role allows other instances to hold a resource in either NULL or Shared mode while one instanceholds it in Exclusive mode.

The effect of these improvements in interactions between instances in the cluster is that RAC affords much greaterperformance and higher scalability.

Workspace ManagementWorkspace management is new in 9i. This feature allows you to version-enable tables, so that different users canhave their own private versions of tables. Oracle internally keeps track of changes to different workspaces and you must resolve any update conflicts prior to merging them. Here are the steps to using workspace management:

1. Version-enable one or more tables

2. Create workspaces

3. Grant privileges

4. Access and use the workspace

5. Resolve conflicts between original and versioned rows

6. Refresh/merge workspaces

7. Disable versioning tables

8. Remove workspaces

Versioning-enabling works on the unit of a table. Different workspaces contain different table versions. A version-enabled table has the suffix _LT appended to its regular name.

You can only refresh or merge table versions after  you have resolved any data conflicts (different row data) betweenthem. Oracle provides package DBMS_WM and the new role WM_ADMIN_ROLE to manage the new workspacefeature. Workspace management is installed by default, or login as user SYS and run OWMINST.PLB.

External TablesExternal tables are operating system flat files (stored outside of Oracle), but whose definition is maintained in Oracle’sdata dictionary. External tables appear as read-only tables to Oracle applications. They’re useful for reference to flatfiles that you don’t want to load into Oracle tables (perhaps the flat files are big and rarely accessed, for example).Here are the steps to set up an external table:

1. Create a directory object to define the external table. Example:

CREATE OR REPLACE DIRECTORY test_dir AS ‘c:\exttabs\data’;  

2. GRANT privileges on that directory object

Page 24: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 24/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

3. Create the external table definition with the CREATE TABLE command. The key clause here isORGANIZATION EXTERNAL. Use keyword PARALLEL if you want to enable parallel query. By default theaccess driver will be ORACLE LOADER.

You can not place an index on an external table. Remember that since external tables are actually operating systemfiles, one could bypass Oracle’s security to access the table.

Replication Enhancements9i allows you to add a new Master site to a Master Group without quiescing the Master Group. The new Master sitemust be configured for multi-master replication, you can only add one new Master site at a time, the Master Groupmust be replicating in asynchronous mode, and all links must be configured for parallel propagation.

To ensure transactions are propagated in the proper order, 9i now tracks dependency SCNs at the row level (8i couldnot track dependencies because it only tracked SCNs at the block level). To use this feature, encode keywordROWDEPENDENCIES on the CREATE TABLE statement.

9i can now replicate user-defined types, user-defined operators, and these database objects:

Tables having column objects, nested tables, VARRAYs and REF columns

Object tables

Object views (including INSTEAD OF triggers)

Index types

9i eliminates the SNP background processes used to submit jobs. Instead, it uses a job coordinator backgroundprocess (called CJQ0), and that job coordinator spawns job queue processes (J00n) to perform the work. Theinitialization parameter JOB_QUEUE_PROCESSES establishes the upper limit for the number of job queueprocesses, and the parameter JOB_QUEUE_INTERVAL is now obsolete.

Oracle Enterprise Manager (OEM) Enhancements As in every release, Oracle has changed the packaging, look, and feel of OEM. Recall that you can run OEM in eitherstandalone mode or through an Oracle Management Server (OMS). Standalone mode does not support features likeadministration through a web browser, administration of non-database objects (web servers, events, jobs), or use ofthe backup/recovery or web-enabled reporting tools.

You must use OMS to define events, alerts, jobs, and fix-it jobs. Oracle Intelligent Agent must be installed on eachnode you want to manage using these features.

OEM has been upgraded to support all the new 9i features. It also includes over one hundred new predefined HTMLreports you can run and view through any web browser.

Performance Enhancements

Index Monitoring 

You can now monitor an index to determine if it’s being used and collect usage statistics. To turn on monitoring:

 ALTER INDEX my_index MONITORING USAGE;

To turn off monitoring:

 ALTER INDEX my_index NOMONITORING USAGE;

Query the dictionary table V$OBJECT_USAGE to view the index utilization data.

Page 25: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 25/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Skip Scan Index AccessOracle can now use skip scan technology to scan composite indexes when a query does not include the prefixcolumn. This applies to B-tree, cluster, and descending index scans. It does not apply to bitmap, domain, andfunction-based indexes, or to reverse-key indexes.

First Rows Optimization9i introduces the ability to optimize data retrieval for the first N rows, where the only allowable values for N are: 1, 10,100 or 1,000. You can set the optimizer mode for a session like this:

 ALTER SESSION SET OPTIMIZER_MODE = FIRST_ROWS_100 ;

Or set the OPTIMIZER_GOAL, which overrides the OPTIMIZER _MODE:

 ALTER SESSION SET OPTIMIZER_GOAL = FIRST_ROWS_1000 ;

Remember that an optimizer hint on a particular SQL statement overrides either of these settings for that onestatement.

System StatisticsUse these procedures in the DBMS_STATS package to gather system statistics (for CPU and I/O utilization). Be sureto gather statistics during a period in which the workload is typical.

Procedure: Use:

GATHER_SYSTEM_STATS Gathers system performance statistics

SET_SYSTEM_STATS Sets system stats in the table specified by theSTATTAB parameter

GET_SYSTEM_STATS Gets system stats from the table specified by

the STATTAB parameter

9i includes these values you encode on the METHOD_OPT parameter of various DBMS_STATS procedures:

Parameter: Use:

SKEWONLY Creates histogram based on data distribution

REPEAT Creates histogram with the same number ofbuckets

 AUTO Creates histogram based on data distribution andhow the column is accessed

The new 9i columns in the PLAN_TABLE to track system statistics include: CPU_COST, IO_COST, andTEMP_SPACE.

Page 26: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 26/29

Page 27: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 27/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

ON d.department_id = e.department_id

ORDER BY d.department_id;

(The above two examples are from Oracle Corporation’s Oracle9I SQL Reference manual, Release 2.)

CASE ExpressionsExpressions consists of one or more values, operators, and SQL functions and result in a value. Expressions canappear in any of these clauses:

The SELECT clause of queries

The WHERE, ORDER BY, or HAVING clauses

The VALUES clause of the INSERT statement

The SET clause of an UPDATE statement

Oracle9I introduces CASE expressions. They have two basic forms. Here are examples of each:

SELECT last_name, class_membership,

CASE class_membership WHEN 1 THEN ‘Freshman’

WHEN 2 THEN ‘Sophomore’

WHEN 3 THEN ‘Junior ’

WHEN 4 THEN ‘Senior’

ELSE ‘Unknown’ END As “ Classes”

FROM class_table ;

The second CASE expression format is called the searched CASE. In it, comparisons occur after the WHEN clause:

SELECT last_name, salary,

CASE WHEN salary < 40000 THEN ‘low’

WHEN salary < 80000 THEN ‘average’

WHEN salary >= 80000 THEN ‘high’ END As “Category”

FROM employee_table ORDER BY last_name ;

Page 28: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 28/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

New Functions9i introduces many new SQL functions. Among them are various analytic functions. These provide for distributions,percentiles, ranking, histograms and grouping sets.

 Also new is the NULLIF function: NULLIF (expression_1, expression_2) 

If the expressions are equal, it returns NULL. Otherwise, it returns expression_1.The COALESCE function returns the first value in the list that is not null:

COALESCE (expression_1, expression_2, expression_3 . . . )

Globalization Enhancements9i introduces new date and time data types:

Data Type: Use:

TIMESTAMP Like DATE, but specifies fractional secondsprecision

TIMESTAMP WITH TIMEZONE

TIMESTAMP plus time zone displacement

TIMESTAMP WITHLOCAL TIME ZONE

TIMESTAMP plus time normalized in terms of thedatabase’s time zone

INTERVAL DAY TOSECOND

 A time duration stored in terms of days, hours,minutes and seconds

INTERVAL YEAR TOMONTH

 A time duration stored in terms of years andmonths

Oracle supports two new Unicode character sets:

New Character Set: Use:

 AL16UTF16 2-byte, fixed width (also known as UTF16 orUCS2)

 AL32UTF8 8-bit, variable-width encoding (use instead ofUTF8)

9i allows you to have up to 4 sort values for each character to enable a four-level linguistic sort.

Page 29: 1730_DBA_OCP_9

8/10/2019 1730_DBA_OCP_9

http://slidepdf.com/reader/full/1730dbaocp9 29/29

 Oracle8i to Oracle9i DBA OCP Upgrade (IZ0-030)

Miscellaneous Language Enhancements9i introduces the SQL MERGE statement. This provides for bulk insertand/or update of data records into a table. If a record matches a row in thetarget table as per some condition you specify, that row in the target table isupdated with the new record. If a record in the input stream does not match

any row in the existing table (as per the ON condition you specify), that thatrow is inserted into the target table.

9i allows you to create a constraint index explicitly as part of the CREATETABLE statement:

CREATE TABLE my_table

(column_a CHAR(5)

CONSTRAINT my_pk PRIMARY KEY

USING INDEX

(CREATE INDEX

my_ix ON my_table(column_a)),

column_b CHAR(10) );

When you later drop or disable the constraint, you can tell Oracle either toKEEP or DROP the index:

 ALTER TABLE my_table DROP CONSTRAINT my_pk KEEPINDEX ;

Oracle now minimizes the duration of its lock during foreign-key checking.Previously these locks were held until the operation completed. 9i alsocaches up to 256 primary keys, for quicker reference during referentialchecking.

On the SELECT…FOR UPDATE statement, you can now specify amaximum number of seconds to wait for any locks the statement requires:

SELECT… FOR UPDATE WAIT 10 ;

If the program does not get the lock within the specified time, it receives anerror message from Oracle and continues.

For performance, 9i can generate native C code from PL/SQL procedures,then compile the C code (assuming you have a C compiler on your server).

9i introduces a new GUI tool called the Locale Builder. It maintainsinformation about the language, territory, character set, sort definitions, andthe like in .nlt and .nlb files. Start the Locale Builder by issuing thecommand: lbuilder  under Unix, or select it off the Windows server “StartProgram” menus.