Вы находитесь на странице: 1из 83

Oracle 10g New Features

Kiran K kirankollepalli@yahoo.co.in Oracle 10g Certified Professional

Contents

Introduction to Grid

Storage Enhancements

Network Enhancements

Backup and Recovery

Flashback Features

Automatic Storage Management

Self­Managed Database

Miscellaneous Features

Oracle 10g Introduction to Grid Computing

How DBA's Spend their time?

How DBA's Spend their time? 4

Database Management Challenges

Database Management Challenges 5

Oracle 10g Solution

Oracle 10g Solution 6

How 10g DBA's Spend Time

How 10g DBA's Spend Time 7

What is Grid Computing?

What is Oracle 10g?

The Oracle GRID architecture pools large number of servers, storage and networks into a flexible, on demand computing resource for enterprise computing needs.

This infrastructure continually analyzes demand for resource and adjusts supply accordingly

It offers High Availability and Scalability

It is flexible than Clustered Systems

Applications

Application

servers

Database

servers

Storage:

Use cheap and fast clustered server blades

Grid Infrastructure

servers • Database servers • Storage: Use cheap and fast clustered server blades Grid Infrastructure 9

Installation Enhancements

Much Faster

Does the pre­installation checks

Installation CD's

One

Two

One

One

One

­ Database

­ Grid

­ Client

­ Cluster

­ Companion

JVM, JDBC, Examples, SQLJ, Middle tier components, etc

Installation Requirements

Hardware:

RAM

Processor

Swap

­ 1GB (10g R2) ­ P4 ­ 1GB

Kernel Parameters:

kernel.sem

kernel.shmmax

net.core.rmem_default

net.core.rmem_max

net.core.wmem_default

net.core.wmem_max

fs.file­max

net.ipv4.ip_local_port_range

= 256 256000 100 1024 = 550000000 = 262144 = 262144 = 262144 = 262144 = 65536

= 1024 65000

Oracle 10g General Storage Enhancements

Architectural Enhancements

New memory component – Streams Pool (dynamic)

Java pool – Dynamic component

Background Processes:

MMAN – Memory Manager

MMON – Manageability Monitor

MMNL – Manageability Monitor Light

RVWR – Recovery Writer

CTWR – Change Tracking Writer

Tablespace Enhancements

Default tablespaces created:

SYSTEM: Container of Data Dictionary

SYSAUX: (in 10g)

Reduce load on System

Cannot rename / drop

v$sysaux_occupants

use PL/SQL package to move occupant

Sysaux Occupants

Automatic workload repository(AWR) statistics

Enterprise Manager

Oracle OLAP (online analytical processing applications)

Oracle Text (Multimedia content)

Oracle Ultra Search (extended search within database)

Oracle Data Mining (tools / algorithms for data mining)

Log Miner

Scheduler

etc

Types of Tablespaces

System / Non­System

Permanent / Temporary

Dictionary Managed / Locally Managed

Undo Tablespace

Small file / Big file (10g)

Temporary tablespace groups

BigFile Tablespace

Max datafiles in a database is 64k. Now, it is overcome:

8k block size – 32 TB / 32k block size – 128 TB

Supported only for LMT with Segment Management Auto

Create [bigfile | smallfile ] tablespace <name> datafile '<path/filename>' size <kb, mb, gb, tb>;

Create database set default bigfile tablespace;

Alter database set default bigfile tablespace;

Temporary Tablespace Groups

Contains one or more tempfiles

Create temporary tablespace

tempfile

tablespace group group1;

Alter tablespace temptbs tablespace group group2;

Alter tablespace temptbs tablespace group ' ' ;

Alter database <dbname> default temporary tablespace group2; Making group2 as default temporary tablespace

View: dba_tablespace_groups

Rename Tablespaces

Alter tablespace <name> rename to <newname>;

Compatible=10.0 or higher

Cannot rename SYSTEM / SYSAUX

Cannot rename offline tablespace

Dropping Datafiles

Alter tablespace drop datafile '<path/name>' ;

Alter tablespace drop tempfile '<path/name>' ;

Restrictions:

Database must be open

Datafile / tempfile must be empty

Cannot drop first / only datafile

Cannot drop datafiles from read­only tablespace

Cannot drop datafiles from SYSTEM tablespace

Archivelog Parameters

log_archive_start [obsolete from 10g]

log_archive_format = %d_%t_%s_%r.arc

%r will represent the RESETLOGS SCN number

Will not make the old archivelog files obsolete

Undo Enhancements

Create undo tablespace undotbs02 datafile '<path/filename>' size <size> [autoextend on] [ retention {guarantee | noguarantee} ];

ORA­1555 Error is eliminated

Enhanced to support Flashback features

Resumable Space Management

In 9i, it was restricted to session level

Now it can be enabled at Instance Level

RESUMABLE_TIMEOUT = 7200

RESUMABLE_TIMEOUT = 0 ­­ will disable the feature

Partitioned Indexes

Create index PART_IDX on Emp(EmpNo) Global

Partition by Range(EmpNo) (Partition Part1 values less than (500) tablespace TBS1, Partition Part2 values less than (1000) tablespace TBS2, Partition Part3 values less than (Maxvalue) tablespace TBS3 );

Create index PART_IDX on Emp(EmpNo) Global

Partition by Hash(EmpNo)

Partitions 4 Store in (TBS1, TBS2, TBS3, TBS4);

­­ 10g Feature

Oracle 10g Networking Enhancements

Naming Methods

Easy Connect:

Can specify different port number

No configuration required on the client

Reduces administrative work

sqlplus scott/tiger@localhost:1529/wisedba.co.in

sqlnet.ora NAMES.DIRECTORY_PATH= (EZCONNECT)

Enterprise Manager DB Control

Very much enhanced

Is invoked through a browser

Powerful / Simple / Easy tool

Easier to manage database

Steps:

emca ­repos create

emca ­config dbcontrol db

emctl {start | stop | status } dbconsole

Oracle 10g Faster Backup and Recovery

Logical Backup through Datapump

Will replace Exp / Imp in future releases. Imp will be retained for migration purposes

Enables to transfer data at very high speeds than exp/imp

Lets you to estimate job times and manage jobs effectively

Dump file is the proprietary format of Datapump

Ability to restart data pump jobs

Parallel execution capabilities

Ability to attach to running jobs

Network mode of operations

Datapump Features

Datapump is entirely based on server

Uses DBMS_DATAPUMP, DBMS_METADATA

More meaningful parameters than Exp / Imp

More secure – needs permissions on server directories

Datapump Job:

Master Process (MCP) – DMnn – Create and manage job

Worker Process – DWnn – Actual performer, depends on parallelism

Shadow Process – Create the master table and master process

Client Process – call the Datapump's API

Datapump Export Parameters

Directory

Dumpfile (expdat.dmp)

Filesize

Parfile

Logfile (export.log)

Nologfile

Full

Schemas

Tables

Content(all, data_only, metadata_only)

Parallel

Exclude(constraints, indexes, grants)

Include

Query

Estimate_only

Network_link

Attach

Jobname

Status

Interactive mode (ctrl+c)

Kill_job

Stop_job

Continue_client

Start_job

Modes of Export

Table Mode Export:

expdp user1/user1 tables=emp directory=dir1 dumpfile=emp.dmp job_name=emp_expdp content=data_only

Schema Mode Export: (EXP_FULL_DATABASE)

expdp system/manager schema=user1, user2 dumpfile=dir1:sch1% U.dmp, dir2:sch2%U.dmp logfile=expschema.log parallel=2 job_name=schema_export

Full Export: (EXP_FULL_DATABASE)

expdp system/manager full=y directory=dir1 dumpfile=fullexp.dmp job_name=fullexport

Datapump Import

Reads information from valid Export Dump file

Required to do Recovery of tables / schemas / tablespaces / database

15 to 30 times faster than traditional import job

Datapump Import Parameters

Parfile

Directory

Dumpfile

Logfile

Nologfile

SQLFILE (INDEXFILE in imp)

Reuse_datafiles=y

Content=Data_only, All, Metadata_only

Exclude

Include

Table_Exists_Action=(Skip, Append, Truncate, Replace)

Datapump Import Parameters (cont)

Job_name

Status

Parallel

Table

Schemas

Full

Remap_Schema

Remap_datafile

Remap_Tablespace

Network_Link

Examples

impdp system/manager Directory=dir1 dumpfile=expdat.dmp Sqlfile=finance.sql

impdp system/manager dumpfile=dir1:expdat.dmp

Remap_schema=HR:OE

imp

­­ similar to fromuser / touser in

impdp hr/hr Remap_tablespace='example_tbs':'new_tbs' directory=dump_dir1 parallel=2 job_name=tbsjob dumpfile=employees.dmp nologfile=y

Monitoring Datapump Jobs

Dba_datapump_jobs

Dba_datapump_sessions select sid, serial# from v$session s, dba_datapump_sessions d where s.saddr=d.saddr ;

v$session_longops select sid,serial#, sofar, totalwork from v$session_longops where opname='MYJOB';

v$session

Transportable Tablespace

Limitations prior to 10g

Must have same hardware platform

Must have same operating system

Converting Tablespace

select * from v$transportable_platform;

select platform_name from v$database;

select tablespace_name, plugged_in from dba_tablespaces;

Conversion using RMAN:

RMAN> convert tablespace users to platform 'HP­UX (64­bit)' format '/tmp/%U'; ­­ tablespace must be read only mode

RMAN> convert tablespace users to platform 'Microsoft Windows IA (32­bit)' ;

RMAN> convert datafile '/home/users.dbf' from platform='HP­UX (64­bit)' to platform='Linux IA (32­bit)'

RMAN> convert database to platform 'Linux IA (32­bit)'; ­­ database must be opened in read only mode

DBMS_File_Transfer

Create or replace directory sourcedir as

'/home/oracle10g/wisedba/data';

Create or replace directory backupdir as

'/home/oracle10g/wisedba/backup';

Exec dbms_file_transfer.copy_file

('sourcedir','users01.dbf','backupdir','users01.bak');

Oracle 10g Go back with Flashback

Flashback Enhancements

Flash Recovery Area

Flashback Database

Flashback Drop

Flashback Table

Flashback Query

Flashback Versions Query

Flashback Transaction Query

Flash Recovery Area

Serves as the default storage area for all files related to backup and recovery operations

Let Oracle take care of your backups

Simply designate the disk space as Flash Recovery Area, specify the area's maximum size, and let Oracle know how long you want to retain the backup­related information

Oracle manages backup related files including Archive logs, Control files, and other files

Flashback Database

Lets you to recover from logical corruptions (not media failure). Avoids restoring of backup datafiles

Once Flashback database is enabled, images of each alter block in datafiles are copied from memory to the new flashback logs (stored in Flash Recovery Area)

RVWR process writes the contents of flashback buffer to the Flashback database logs

The before images are used to reconstruct a database back in time

Flashback Database Example

Select count(*) from emp; ­­> 10,000

Select current_scn from v$database; ­­> 682021

Select count(*) from emp; ­­> 20,000

Shutdown

Startup mount

Flashback database to SCN 682021;

Alter database open Resetlogs;

Select count(*) from emp; ­­>10,000

Flashback Drop

Oracle 10g finally takes this hazard, you cannot mistakenly drop a table!!

If you have dropped a table with “Drop table Emp” and you realize you wanted the table back, you don't have to perform database point­in­time recovery

When you drop a table, Oracle simply renames it and stores the table and its dependent objects in the database's RECYCLE BIN

Recycle Bin

To query your dropped table:

Show recyclebin

Views: USER_RECYCLEBIN, RECYCLEBIN, DBA_RECYCLEBIN

Select * from tab; ­­> Shows dropped tables with a system generated unique name

Restoring table drop:

Flashback table Emp to before drop;

Flashback Table

Lets you to perform an online, point­in­time recovery on one / more tables

Lets you restore an earlier state of a table to recover from human / application errors

Relies on Undo Data

Not supported for SYS user

Must have flashback any table or flashback object privilege on the table

Must enable Row Movement on the table(RowId changes)

Flashback Table Commands

Alter table Emp enable row movement;

Flashback table Emp to scn 711087;

Flashback table Emp to timestamp to_timestamp('04­Sep­2006 08:00:00', 'dd­mon­yyyy HH24:MI:SS');

If the flashback results aren't satisfactory, you can again Flashback to current SCN

Flashback Query

Perform queries on the database at a target time in the past

Relies on Undo Data

Use the command: Select

Can use SCN number or Timestamp

Oracle retrieves only committed data in the as of the time specified

In Oracle 9i, dbms_flashback package was used to do flashback query

as of

Flashback Query (contd)

Select * from Emp as of Timestamp to_timestamp('03­Sep­2006 22:40:00','dd­mon­yyyy hh24:mi:ss') where Ename='SMITH';

Select * from Emp as of SCN 712388;

Insert into Emp (Select * from Emp as of scn 712388)

Flashback Versions Query

Enables users to query the history of a given row in a table

Oracle returns different committed versions of a row between two SCNs or two Timestamps

Relies on Undo Data

Flashback Versions Query (contd)

Select versions_xid, versions_startscn, versions_starttime, versions_endscn, versions_endtime, versions_operation, Empno, Ename, Sal from Emp VERSIONS between SCN minvalue and maxvalue as of SCN 712388 where Empno=7369

VERSIONS_XID

VERSIONS_STARTSCN

VERSIONS_ENDSCN

VER EMPNO

ENAME

SAL

0300040062010000

711141

I

7369

SMITH

900

0800190063010000

711097

D

7369

SMITH

800

 

711097

7369

SMITH

850

Flashback Transaction Query

Lets you to identify which transaction or transactions were responsible for certain changes during a certain period

View: Flashback_Transaction_Query

Enables to correct logical errors

Enables to Audit the transactions

Can avoid usage of LogMiner – where Oracle must read entire redo log files to get necessary information

Example Output

SELECT OPERATION, START_SCN, LOGON_USER, UNDO_SQL FROM FLASHBACK_TRANSACTION_QUERY WHERE XID = HEXTORAW

('0300040062010000');

OPERATION

INSERT

START_SCN

711140

LOGON_USER

SCOTT

UNDO_SQL delete from "SCOTT"."EMP1" where ROWID =

'AAAC5ZAAAAAAAAAAAA';

SELECT UNDO_SQL FROM FLASHBACK_TRANSACTION_QUERY WHERE TABLE_OWNER = 'SCOTT'

UNDO_SQL insert into "SCOTT"."EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO") values ('7369','SMITH','CLERK','7902',TO_DATE('17­dec­1980:00:00:00', ' dd­mon­yyyy:hh24:mi:ss'),'800',NULL,'20');

delete from "SCOTT"."EMP" where ROWID = 'AAAC5ZAAAAAAAAAAAA';

insert into "SCOTT"."EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM"," DEPTNO") values ('7934','MILLER','CLERK','7782',TO_DATE('23­jan­1982:00:00:00',

'dd­mon­yyyy:hh24:mi:ss'),'1300',NULL,'10');

Oracle 10g Enhanced Recovery Manager (RMAN)

RMAN Enhancements

Can backup Database, Tablespace, Datafiles, Control files, Archive log files, SP File, and also the Flash Recovery Area

Global and Local scripts can be created for routine jobs

Can easily catalog the files if metadata information is lost

RMAN supports binary compression of backups. No extra uncompression steps are required during recovery.

Automatic channel failover will be done by RMAN, if one of the channel on which RMAN is performing a backup fails

Incremental level of backup are possible (which is much faster in Oracle 10g with Change Track Writing)

RMAN Enhancements (contd)

Configuration

Configure encryption for database on;

Configure device type disk backup type to { copy | backupset };

Configure device type disk backup type to compressed backupset;

Backup

Backup recovery files;

Backup recovery area;

Backup as backupset database;

Backup as copy database;

Backup as compressed backupset tablespace users;

Incremental Backups

Fast Incremental Backups:

Alter database { enable | disable } block change tracking using file '/home/flash/changetrack.log' reuse;

Background process CTWR is in charge of writing the block changes information to the change tracking file.

V$BLOCK_CHANGE_TRACKING

V$BACKUP_DATAFILE

Rolling Forward of Image Copies

Regularly create incremental backups of your database and apply them to the image copy

run { Recover copy of database with tag "fullcopy"; Backup incremental level 2 for recover of copy with tag "fullcopy" database; }

Either for complete or point­in­time recovery, you can restore the datafiles from the incrementally updated datafile copies, and apply changes from the most recent incremental backup

Saves time required for recovery

Go back to Previous Incarnation

Point­in­time recovery to previous incarnation is possible through RMAN

It is not possible to restore one datafile of previous incarnation, you must restore the whole database

RMAN> List incarnation;

DB KeyInc Key

DB Name

DB ID

STATUS

Reset SCN

Reset Time

1 1

WISEDBA

36524583

PARENT

1

18­AUG­06

2 2

WISEDBA

36524583

CURRENT

682023

03­SEP­06

Perform incomplete recovery to go back to previous incarnation

Oracle 10g Simplified management with ASM

Automatic Storage Management

Oracle finally automates your disk and file management tasks

Enables to bypass third­party LVMs

Oracle takes care of Mirroring and Stripping

Optimizes database storage layout for better performance

ASM is built on top of OMF which much further simplifies the administration overhead

Benefits of ASM

Prevents disk fragmentation

ASM will manage – datafiles, control files, redo log files, archive logs, RMAN backups and so on

DBA has to deal with only few diskgroups instead of numerous files

Performs mirroring and striping. Automatically balances I/O load

Helps to maintain redundant copies for fault tolerance

ASM is FREE!!

ASM Architecture

ASM Architecture 65

Oracle 10g The Self­Managed Database

Automatic Database

Automatic Workload Repository (AWR)

Automatic Database Diagnostic Monitor (ADDM)

Automatic Shared Memory Management

Automatic Optimizer Statistics Collection

AWR

Oracle10g is truly Self­Managing database, AWR is the heart of it. Automatic Workload Repository (AWR) will collection performance statistics automatically

AWR stores the database in Sysaux tablespace. It keeps both current temporary statistics and permanent historical statistics

Dynamic views are only till the database shutdown

AWR stores the database for future comparisions

ADDM relies on the snapshots for diagnosis

AWR (contd)

MMON (Manageability Monitor)

Captures statistics through periodic snapshots

Transfers memory version of AWR statistics to disk on regular basis

MMNL (Manageability Monitor Light)

Performs lightweight tasks

Captures Session information for Automatic Session History

Flush ASH data to disk if ASH buffer fills up

ADDM

AWR collects database at regular intervals

Automatic Database Diagnostic Monitor (ADDM) analyzes this data regularly every hour

ADDM analysis are stored in Sysaux tablespace

Provides detailed information about the root cause of performance problems

It is self­diagnostic engine built into Oracle 10g

ADDM is also dependent on MMON to get read statistics directly from SGA

ADDM Benefits

Identifies root cause

Produces automatic performance diagnostic reports

Very little performance overhead

Diagnosis is based on Oracle's expert tuning knowledge for decades

ADDM runs automatically after each AWR snapshot

Oracle enables ADDM feature by default

Statistics_level = Typical or All

Timed_Statistics = True

ASMM

Automatically allocate and de­allocate memory for each of the memory pools based on the load

Less chance of running out of shared pool memory

Optimal usage of available memory

Performance Improvement

Automatic Shared Memory Management (ASMM) is enable by setting the parameter SGA_TARGET to a non­ zero value (lesser than sga_max_size)

ASMM (contd)

Statistics_Level must be Typical or All. MMAN process performs all necessary resizing

ASMM manages the following components automatically:

Buffer Cache

Shared Pool

Large Pool

Java Pool

Oracle internally uses memory tuning algorithm ( 0 to Optimum value)

ASMM (contd)

To disable automatic management, set SGA_Target to 0

Use Spfile rather than Pfile if you want Oracle to remember the sizes of the automatically tuned memory components across an instance shutdown

View to check the current size of auto­tuned components:

v$sga_dynamic_components

Automatic Statistics Collection

Normally, Oracle checks the optimizer statistics to select the best execution plan with the least cost

Optimizer cannot function properly if you do not feed up­ to­date statisitcs

Poor statistics mean non­optimal execution plan

Oracle recommends that you let the database collect optimizer statistics automatically through Automatic

Optimizer Statistics Collection

Automatic Statistics Collection (cont)

Statistics include:

Table Statistics

Column Statistics

Index Statisitcs

System Statistics

Oracle 10g Miscellaneous Features

Database Alerts:

Misc Features

DBAs generally use SQL scripts to alert them when abnormal conditions occur

Oracle 10g has built in system for alerts

Oracle 10g users indicators called Metrics which will show the rate of change of a cumulative statistic

MMON process collects database metrics continuously and automatically saves them in SGA

Misc Features (contd)

Job Scheduler:

Scheduler is required to run automated tasks

Oracle 10g has built in feature to perform some routine tasks all by itself

Scheduler user PL/SQL programs for scheduling and managing database

Using scheduler you can run PL/SQL Stored procedures, Java stored procedures, C functions, SQL Scripts, Windows Scripts or Unix Scripts

Misc Features (contd)

Drop Database:

Drop the database along with all the physical files

Startup restrict

Drop database

Misc Features (contd)

Advisory Framework:

Oracle 10g provides server advisors to provide you with automatic performance details about various subsystems of the database

Oracle has built a Common Manageability Structure that makes easy to manage the advisors

All the advisors get their raw data from AWR

ADDM recommends using the management advisors on an ad hoc basis, whenever a performance problem needs a deeper analysis. DBAs can also use it for analysis

Misc Features (contd)

Advisory Framework (contd):

Memory Related

Buffer Cache Advisor Library Cache Advisor PGA Advisor

Space Related

Segment Advisor Undo Advisor

Tuning Related

SQL Tuning Advisor SQL Access Advisor

Summary

General Storage Enhancements

Enterprise Manager DB Control

Backup and Recovery Enhancements

Flashback Features

Automatic Storage Management

Self­Managed Database

Miscellaneous Features