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

WHAT IS ORACLE DATABASE

Oracle Storage Structure


I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

1
DATABASE
Why we Need a Database
To Collect, Process and Distribute the Data.
I can do that using Excel, Notepad a simple C,VB code
etc. Why Database ?
Consider the Challenges of the Above approach.
DBAs Perspective (Developers have many more
reasons)
Manage 100s of files.
Manage 100s of users.
Just need to see One Line/record from one of the file.
Changes to the Data and propagation of the Changes.
Files getting Lost, Corruption due to Software, Hardware
Issues.
Backup & Restore.



2
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

HOW ORACLE DB DOES IT
Data File 1
Data File 2
Data file 3
Roll Back Segment
Redo Log 1_1,1_2
Redo Log 2_1,2_2
Redo Log 3_1,3_2
Archive Logs 1,2,3,4,5.
Control File 1 2 3

Shared Pool
DataBase Buffer Cache
Redo
Buffer
Oracle Process
Oracle Process
Oracle Process
Lock
s
Init_{SID}.ora spfile
Users
Background Processes
3
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

A TYPICAL UNIX KERNEL
Hardware
Applications
System Libraries (libc)
System Call Interface
Architecture-Dependent Code
I/O Related
Process Related
Scheduler
Memory Management
IPC
File Systems
Networking
Device Drivers
M
o
d
u
l
e
s

4
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

DATABASE
Physical

Parameter file
Control files
Data files
Temp files
Redo Log files
Archive Log files
Alert & Trace Files
Backup files


Logical

Tablespace
Schema
Segments
Extents
Oracle Data blocks

5
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

ORACLE STORAGE STRUCTURE
Schema_1
TableSpace_1
Ts1_df_1 Ts1_df_2 Ts1_df_3
TableSpace_2
Ts2_df_4
Ts2_df_5
Segment_1
Segment_2
Segment_3
Table_1
Extent_1
Block
Block Block
Block Block
Block Block
Block
Extent_2
Block
Block
Block
Extent_
3
Bloc
k
Bloc
k
Bloc
k
Bloc
k
Free
Block
Free
Block
Free
Block
Free
Block
Free
Block
Free
Block
Free
Block
Free
Block
Table_2
Table_3
Table_4
Table_5
6
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

A SIMPLE CREATE TABLE STATEMENT
CREATE TABLESPACE TableSpace_1
DATAFILE '\oraserv\ORADATA\Ts1_df_1.dbf'
SIZE 10M AUTOEXTEND ON NEXT 10M MAXSIZE 100M;

Alter tablespace TableSpace_1 add datafile '\oraserv\ORADATA\Ts1_df_2.dbf Size 10GB;

Alter Database Datafile '\oraserv\ORADATA\Ts1_df_2.dbf resize 20GB;

CREATE TABLE Schema_1.Table_1
( Col_1 VARCHAR2(100), Col_2 NUMBER, col_3 DATE )
TABLESPACE TableSpace_1
STORAGE ( INITIAL 16K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE
0 )
7
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

SCHEMAS AND SCHEMA OBJECTS
Collection of database objects
Tables
Views
Sequences
Synonyms
Indexes
Procedures
Functions
Packages
Triggers
8
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

DATA BLOCKS
The smallest unit of Input/Output used by Oracle
database.
The size of data block for any database is fixed at
the time of creation of the database;
Some values of the data block size are 2KB, 8KB,
16KB, and 32KB.
Oracle recommends a size of 8KB
9
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

EXTENTS
The next level of data storage.
One extent consists of a specific number of data
blocks
One or more extents in turn make up a segment.
When the existing space in a segment is completely
used, Oracle allocates a new extent for the
segment.
10
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

SEGMENT
A segment consists of a set of extents
Each tables data is stored in its own single
segment.
Each indexs data is stored in a single
segment.
More extents are automatically allocated by
Oracle to a segment if its existing extents
become full.
The different types of segments are the data
segments, index segments,rollback segments,
and temporary segments.
11
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

CONTROL FILES
Contain a list of all other files in the database
Key information such as
Name of the database
Date created
Current state
Backups performed
Time period covered by redo files
12
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

Store a recording of changes made to the database
as a result of transactions and internal Oracle
Activities
When Oracle fills one redo log, it automatically fills
a second.
Used for database recovery
REDO LOG FILES
13
I
n
t
e
l
l
i
p
a
a
t

S
o
f
t
w
a
r
e

S
o
l
u
t
i
o
n
s

P
v
t
.

L
t
d
.

Вам также может понравиться