Sei sulla pagina 1di 52

Robert Korošec

Principal Sales Consultant

Oracle
Quick-Start to the Oracle DB
Architecture
Oracle Server Architecture
An Oracle server:
• Is a database Oracle Server
management system
that provides an open,
comprehensive,
integrated approach to
information management
• Consists of an Oracle
instance and an Oracle
database
Oracle RDBMS Architecture
Oracle Instance
SMON SNPn LCKn RECO Snnn Dnnn
PMON
Pnnn
SGA Redo Log
Shared Pool Database Buffer Cache Buffer
DBWR CKPT

LGWR ARCH

Server User
Processes Processes

Oracle Database

Parameter File Control Files Datafiles Redo Log Files


Database Files

• Parameter Files
• Control Files
• Data Files
• Redo Log Files
• Undo Data Files
PFILE Example
# Initialization Parameter File: initdb01.ora
db_name = db01
instance_name = db01
control_files = (
/u03/oradata/db01/control01db01.ctl,
/u03/oradata/db01/control02db01.ctl)
db_block_size = 4096
db_block_buffers = 500
shared_pool_size = 31457280 # 30M Shared Pool
db_files = 1024
background_dump_dest = /u05/oracle10g/admin/db01/bdump
user_dump_dest = /u05/oracle10g/admin/db01/udump
core_dump_dest = /u05/oracle10g/admin/db01/cdump
undo_management = auto
undo_tablespace = undtbs
. . .
SPFILE spfileSID.ora
• Binary file with the ability to make changes
persistent across shutdown and startup
• Maintained by the Oracle server
• Records parameter value changes made
with the ALTER SYSTEM command
• Can specify whether the change being
made is temporary or persistent
• Values can be deleted or reset to allow an
instance to revert to the default value
Control File
The control file is a binary file that defines the
current state of the physical database..
• Is read at MOUNT stage
• Is required to operate
• Is linked to a single database
Database
• Should be multiplexed
Control
• Maintains integrity of database files
Database Files
• Parameter Files
• Control Files
• Data Files
• Tablespaces
• Data Types
• Tables
• Indexes
• Redo Log Files
• Undo Data Files
Resizing a Tablespace

• Add a data file


• Change the size of a data file:
• Automatically
• Manually
Tablespace APP_DATA

100M
100M 200M
100M
app_data_01.dbf app_data_02.dbf app_data_03.dbf
Classification of Indexes
• Logical
• Single column or concatenated
• Unique or nonunique
• Function Based
• Domain Based
• Physical
• Partitioned or nonpartitioned
• B-tree
• Normal or reverse key
• Bitmap
Handout
B-Tree Index Handout

Index entry

Root

Branch

Index entry header


Leaf Key column length
Key column value
ROWID
Handout
Bitmap Index Handout

Table File 3
Block 10

Block 11

Index Block 12

start end
key ROWID ROWID bitmap
<Blue, 10.0.3, 12.8.3, 1000100100010010100>
<Green, 10.0.3, 12.8.3, 0001010000100100000>
<Red, 10.0.3, 12.8.3, 0100000011000001001>
<Yellow, 10.0.3, 12.8.3, 0010001000001000010>
Handout
Comparing B-Tree and Handout

Bitmap Indexes

B-tree Bitmap
Suitable for high-cardinality Suitable for low-cardinality
columns columns
Updates on keys relatively Updates to key columns very
inexpensive expensive
Inefficient for queries Efficient for queries
using OR predicates using OR predicates

Useful for OLTP Useful for data warehousing


Using Redo Log Files
Redo log files record all changes made to data and
provide a recovery mechanism from a system or
media failure.
• Redo log files are organized into groups.
• An Oracle database requires at least two groups.
• Each redo log within a group is
called a member. Database

Redo
log files
How Redo Logs Work

• Redo logs are used in a cyclic fashion.


• When a redo log file is full, LGWR will move to the
next log group.
• This is called a log switch
• Checkpoint operation also occurs
• Information is written to the control file
Archived Redo Log Files
Filled online redo log files can be archived.
• Two advantages exist to archiving redo
logs:
• Recovery: A database backup, together with
online and archived redo log files can
guarantee recovery of all committed
transactions.
• Backup: Can be performed while the database
is open.
• By default a database is created in
NOARCHIVELOG mode.
Managing Undo Data
Overview
• Two methods for managing undo data
exists
• Automatic Undo Management
• Manual Undo Management
• The term undo replaces what was known in
previous versions of Oracle as rollback
Handout
Undo Segment Handout

Old image

Table

New
image

Undo segment

Update transaction
Handout
Undo Segments: Purpose Handout

Transaction rollback

Transaction Undo segment Read consistency


recovery
Handout
Read Consistency Handout

SELECT *
Table FROM table

New image
Image at start of statement
Memory Structure

Oracle’s memory structure consists of two memory


areas known as:
• System Global Area (SGA): Allocated at instance
startup, and is a fundamental component of an
Oracle Instance
• Program Global Area (PGA): Allocated when the
server process is started
System Global Area (SGA)

• The SGA consists of several memory structures:


• Shared pool
• Database buffer cache
• Redo log buffer
• Other structures (e.g. lock and latch management,
statistical data)
• There are two optional memory structures that can
be configured within the SGA:
• Large pool
• Java pool
Process Structure
An Oracle process is a program that depending on its
type can request information, execute a series of
steps, or perform a specific task.
On some OS (MS Windows…) these are actually
implemented as process threads.
Oracle takes advantage of various types of
processes:
• User process: Started at the time a database user
requests connection to the Oracle server
• Server process: Connects to the Oracle Instance
and is started when a user establishes a session.
• Background process: Available when an Oracle
instance is started
Oracle RDBMS Architecture
Oracle Instance
SMON SNPn LCKn RECO Snnn Dnnn
PMON
Pnnn
SGA Redo Log
Shared Pool Database Buffer Cache Buffer
DBWR CKPT

LGWR ARCH

Server User
Processes Processes

Oracle Database

Parameter File Control Files Datafiles Redo Log Files


Database Writer (DBWn)
Instance DBWn writes when:
SGA • Checkpoint
Database
• Dirty buffers threshold
reached
buffer
cache • No free buffers
• Timeout
DBWn • RAC ping request
• Tablespace offline
• Tablespace read only
Data Control Redo log
files files files • Table DROP or TRUNCATE
• Tablespace BEGIN
Database BACKUP
Log Writer (LGWR)
Instance
SGA
LGWR writes:
Redo log • At commit
buffer • When redo cache
one-third full
DBWn LGWR • Every 3 seconds
• Before DBWn
writes
Data Control Redo log
files files files

Database
System Monitor (SMON)
Instance
Responsibilities:
SGA • Instance recovery:
• Rolls forward
changes in the
redo logs
• Opens the
database for user
SMON access
• Rolls back
uncommitted
transactions
Data Control Redo log • Coalesces free space
files files files
every 3 sec
• Deallocates temporary
Database segments
Process Monitor (PMON)
Instance
SGA
Cleans up after
failed processes by:
• Rolling back the
transaction
• Releasing locks
PMON • Releasing other
resources
• Restarts dead
dispatchers
PGA area
Checkpoint (CKPT)
Instance
SGA
Responsible for:
Redo Log • Signalling DBWn
Buffer at checkpoints
• Updating datafile
DBWn LGWR
DWW0 CKPT headers with
checkpoint
information
Data
files
Control
files
Redo log
files • Updating control
files with
checkpoint
information
Archiver (ARCn)

• Optional background process


• Automatically archives online redo logs when
ARCHIVELOG mode is set
• Preserves the record of all changes made to
the database
ARCn
ARCn
Data Control Redo log Archived
files files files Redo log
files
Logical Structure
The logical structure of the Oracle architecture
dictates how the physical space of a database is to
be used.
A hierarchy exists in this structure that consists of
tablespaces, segments, extents, and blocks.
Tablespace
Data file
Segment Segment

Extent Blocks
Database Schema
• A schema is a named
collection of objects Schema Objects
Tables
• A user is created, and a
corresponding schema Triggers
can be created Constraints
Indexes
• User can be associated
only with one schema Views
Sequences
• Username and schema
Stored program units
are often used
interchangeably Synonyms
User-defined data types
• Users are not
Database links
necessarily associated
with a schema
Introducing Oracle 10g

Complete, integrated grid infrastructure


The Consecutive RDBMS Market
Leader for More Than a Decade

Microsoft Other
15% 14,3%

IBM
22%

Oracle
48.6%

Source: Gartner DataQuest May 2006, based on Total Software Revenue


Oracle Database Product Family
Express Standard Standard Enterprise
Edition Edition One Edition Edition
Non-Oracle Low-price option for Full-featured database Large-scale Enterprises
developers, open SMB/LOB Deployments, for SMBs with optional that demand high-
source developers, ISVs who need a clustering support (up performance BI (ETL,
new DBAs, students, supported Oracle to 4 CPUs) DW, OLTP), security,
scalability, availability,
non-Oracle ISVs, hw database
etc.
vendors

FREE $149/user (min. 5) or $300/user $800/user


$4,995 or $15,000 or $40,000
per CPU per CPU per CPU

Uses 1 CPU 2 CPU Single or clustered up 4+ CPUs


< 4GB DB size < 500GB DB size to 4 CPUs > 500 GB DB size
1 instance per CPU < 500 GB DB size
Use up to 1GB RAM
Free OTN Fee-based Support Fee-based Support Fee-based Support
Community Forum available available available
Oracle Database XE:
Awards & Accolades
• “9/10” – LinuxFormat Magazine
• Best Database Award - LinuxWorld ‘06
• Best Database Finalist - TechEd ‘06
SQL Server Magazine
• “Oracle XE is an extremely good
product, and so cool it's kind
of hard for me to believe it
came from Oracle. Kudos to
the Oracle guys.”
- Developer.com, May ‘06*

* http://www.developer.com/db/article.php/10920_3599691_1
Oracle Database 10g
Express Edition
(Oracle Database XE)
You need a FREE database?
• Need a “starter” database for the next
generation of developers, DBAs, ISVs
• Free to download
• Free to develop
• Free to deploy
• Free to distribute
Oracle Database 10g Express Edition
• Small-footprint starter database
• Runtime criteria (hard-coded limitations):
• 4GB user data (plus Oracle system data)
• Single instance per machine
• May be installed on a multiple CPU server,
but only executes on 1 CPU
• May be installed on a server with any amount of
memory, but will only use up to 1GB RAM
• 32-bit Linux and Windows
• Oracle Application Express (HTML DB)
• Free OTN online community forum
SQL Developer
(formerly known as Project Raptor)
Released March 2006!

• Database Development
Productivity Tool
• Targeted at the DBA -
Developer
• Rich Client SQL plus
functionality
• Requires no Oracle home;
simple to install
• Included in the DB licence
Oracle Application Express
• Quick assembly of reporting and
data entry applications
• No programming or scripting
• Instant deployment on the Web
• Use the full power of Oracle
Database 10g
• Addresses MS Access proliferation
problem
• Included in the DB licence
Oracle is difficult to install?
Install
• CD contents (10g R2 – 1xDVD)
• Database CD
• Enterprise Edition
• Standard Edition
• Personal Edition (Windows)
• Client CD
• e.g. Enterprise Manager Java Console (~ 'old' EM)
• Companion CD
• Demos / examples
• Legato
• Workflow
• Accelerators
• Application Express (Formerly known as HTML DB)
• Oracle HTTP server (Apache)
Oracle Database 10g for
Windows
Windows Platform Support
OS 9iR2 10gR1 10gR2
Windows NT Yes Yes
Windows 2000 Yes Yes Yes
Windows XP Professional Yes Yes Yes
Windows Server 2003, 32-bit Yes Yes Yes
Windows XP & Windows Server Yes Yes Yes
2003 for 64-bit Itanium Systems
Windows XP & Windows Server Developer Yes
2003, x64 Editions (Intel EM64T Release
and AMD Opteron) (May 04)
Integration with Windows Services

Active DB registration/name resolution


Directory/ SSO (OS Auth, Kerberos, SSL)
Security AD Integration with Oracle IM

Services Transactions Oracle Services for MTS

Clustering Oracle Fail Safe

VSS Oracle VSS Writer (Future)


Oracle Database 10g for
Linux
Certified Linux Distributions

• Red Hat Enterprise Linux AS and ES


• RHAS 2.1
• RHEL3
• RHEL4
• Novell/SuSE Enterprise Server
• SLES8
• SLES9
• SLES10 to come
• Asianux (APAC)
Oracle #1 RDBMS Vendor on
Linux
Gartner Dataquest Results
80.6%
80%
Marketshare (%)

60% Oracle
IBM
40%
Others
20%

0%
2003 2004 2005

Source: Gartner DataQuest May 2006, based on Total Software Revenue

Potrebbero piacerti anche