2. What is Oracle ?
Oracle is a name of a organization which has developed many software,
Operating Systems and Databases.
Here we are going to discuss about Oracle Database or Oracle DB.
Oracle database is a relational database management system in which data
are treated as a unit. It is the most trusted and widely-used relational
database engines.
The system of oracle database is built around a relational database
framework in which data objects may be directly accessed by users through
SQL (Structured Query Language).
3. History of Oracle
1979 Oracle Release 2
1986 client/server relational database
1989 Oracle 6
1997 Oracle 8 (object relational)
1999 Oracle 8i (Java Virtual Machine)
2000 Oracle Application Server
2001 Oracle 9i database server
2004: Oracle 10g is released (the g stands for Grid).
2007: Oracle 11g is released.
2013: Oracle 12C is released which is capable of providing cloud services with
Oracle Database.
4. Oracle Family
Personal Oracle- for single users. Used to develop systems
Oracle Standard Edition- (Entry level Workgroup server)
Oracle Enterprise edition- Extended functionality
Oracle Lite- (Oracle mobile) single users using wireless devices.
6. Oracle Architecture
SGA
Shared SQL Area Database Buffer Cashe
KByte1,200,000 KByte
Redo Log
Buffer
KByte2,100KByte
PMON
LGWR
Data File
Raw Device
Server
USER
ARCH
TL-812
Archive Log Mode(50M)
* Fixed Size :
70 Kbyte
* Variavle Size :
490 MByte
4,000,000 KByte
* Total SGA Size :
1700 Mbyte
DBW0 CKPT
SMON RECO D000 S000 P000
7. Memory Structure : Shared Pool
Shared Pool
Library Cache
Shared
SQL Area
PL/SQL Procedures
and Package
Control Structures
for examples;
Locks
Library
Cache handles
and so on ...
Dictionary
Cache
Control Structures
for example:
Character Set
Conversion
Memory
Network Security
Attributes
and so on ..
Shared Pool Contents
- Text of the SQL or PL/SQL statement
- Parsed form of the SQL or PL/SQL statement
- Execution plan for the SQL or PL/SQL
statements
- Data dictionary cache containing rows of data
dictionary information
Library Cache
- shared SQL area
- private SQL area
- PL/SQL procedures and package
- control structures : lock and library cache handles
Dictionary Cache
- names of all tables and views in the database
- names and datatypes of columns in database tables
- privileges of all Oracle users
SHARED_POOL_SIZE
Reusable
Runtime
Memory
8. TableSpaces
A database is divided into logical storage units called Tablespaces.
logical construct for arranging different types of data.
An Oracle database must have at least a system tablespace.
It is recommended to have different tablespaces for user and system data.
9. Tablespaces
a logical structure
Data1 Data2
Data1_01.dbf Data2_01.dbf Data2_02.dbf
The DATA1
Tablespace =
One datafile
The DATA2
Tablespace =
Two datafiles
10. Create Tablespace
CREATE TABLESPACE test
DATAFILE 'oraservORADATAa.dbf'
SIZE 10M
AUTOEXTEND ON
NEXT 10M MAXSIZE 100M;
CREATE TABLE cust(id int,name varchar2(20))
TABLESPACE test;
11. SQL(Structured Query Language)
SQL is a standard language for accessing databases.
Both an ANSI and ISO standard
Types of commands:
Data Definition Language (DDL) : Create, Alter, Drop, Rename, Truncate
Data Manipulation Language (DML): Insert, Delete, Update
Data Retrieval: Select
Transaction Control: Commit, Rollback, Savepoint
Data Control Language (DCL): Grant, Revoke
16. Example:
INSERT INTO Students VALUES (10,’Mark’,18);
INSERT INTO Students VALUES (20,’smith’,22);
INSERT INTO Students VALUES (30,’John’,19);
INSERT INTO Students VALUES (40,’Lee’,21);
17. Data Retrieval:
SELECT [DISTINCT | ALL] {table|view}
FROM {table | view}
[WHERE condition ]
[GROUP BY expr [, expr]]
[ORDER BY {expr} [ASC | DESC]]
18. Example:
select * from student;
select name from student where sid='10';
select courseid from course where department=‘computer’;
Select a.sid from takes a, student b where a.sid=b.sid;
20. Data Control Language:
GRANT [privileges]
ON object TO user|public
[WITH GRANT OPTION]
REVOKE [privileges]
ON object TO user|public
[CASCADE CONSTRAINTS]
grant select,update on student to XYZ ;
revoke update on student to XYZ;
21. For Further Informatiom:
Read more about oracle Database:
http://www.urgenthomework.com/oracle-10g-and-11g.php
Notes de l'éditeur
1. 오라클이란?
2. 오라클의 Overview
3. SGA란, SGA의 구성요소 3가지와 SGA의 역할
4. Background Process에 대해 (역할과 어떤것이 있는지)
5. Instance = SGA + Background Process
6. Server Process/User Process
7. File 의 구성요소와 간단한 역할
1) Fixed size
이 부분은 백그라운드 프로세스가 access하는데 필요한 일반적인 정보를 포함하고 있는 부분으로서 user data는 없으며 parameter로 크게 또는 작게 지정 할 수 없다.따라서 항시 instance내에서 일정한 크기를 갖으며 버젼별,os 별로 약간의 차이는 있다.
2) Variable size
이 size는 parameter file(initSID.ora)의 SHARED_POOL_SIZE에서 지정한 크기와 각종 파라미터로 지정한 값의 합으로 결정된다. SHARED_POOL_SIZE는 byte단위로 지정하며 OS의 shared memory
segment보다는 작아야 한다. InitSID.ora file에는 instance와 관련된 여러 parameter가 지정되어
있는데 이곳의 parameter의 지정 값에 따라서 SGA의 영역에 일정한 부분을 차지한다.따라서 SGA의 크기에 영향을 주는 요소는 단순히 SHARED_POOL_SIZE이외에 각종 parameter에 의해 점유되는 부분을 고려해야 한다.일반적으로 각 parameter값을 크게 할 수록 메모리 사용은 일정한 비율로 늘어나며 다음은 몇가지 예이다.
*DB_FILES - 10 증가시 약 6K소모
*DML_LOCKS - 100 증가시 9.7K소모
*PROCESSES - 10 증가시 19.5K 소모
*SEQUENCE_CACHE_ENTRIES - 10 증가시 약 1.17K 증가
*ROW_CACHE_ENQUEUES - 100 증가시 약 3.5K 증가
*SESSIONS - 10 증가시 약 5.3K 증가 : :
현재 각 parameter에 의해 점유된 SGA내의 점유된 메모리 영역의 크기는 V$SGASTAT에서 조회하여 볼 수 있다.(select * from v$sgastat;)
3) Database Buffer Cache
SGA에서 disk의 data가 저장되는 곳으로서 performance에 큰 영향을 준다.
이곳의 size가 작으므로 발생 할 수 있는 현상은 빈번한 disk i/o이다.크기는 DB_BLOCK_BUFFERS로 지정하며 buffer의 갯수를 지정한다.byte 산정은 DB_BLOCK_BUFFERS * DB_BLOCK_SIZE로 산출된다.
4) Log Buffers
이것은 redo log 용도로 사용될 메모리 내의 log buffer size를 말 한다.크기는 byte단위로 LOG_BUFFERS 로 지정한다.
1. SGA 의 특징
- data와 control information을 저장한다.
- SGA는 non-paged, non-swapped memory
- 전체 메모리에 1/3 정도로 구성한다.
2. 오라클 기본 메모리 구조
- software code areas : 실행되고 있거나 실행될 오라클을 위한 코드가 저장되는 곳
- the system global area (SGA)
the database buffer cache, the redo log buffer, the shared pool
- program global areas (PGA) : 프로세스(Server,background)에 대한 data와 control
정보를 담고있다.( stack areas, data areas )
- sort areas (SORT_AREA_SIZE에서 지정)
3. Shared Pool 의 구성과 역할
- Identical SQL문 (by Hashing algorithm)
Tablespaces
A database is divided into logical storage units called tablespaces, which group
related logical structures together. For example, tablespaces commonly group all of
an application’s objects to simplify some administrative operations.
Each database is logically divided into one or more tablespaces.
One or more datafiles are explicitly created for each tablespace to physically
store the data of all logical structures in a tablespace.
The combined size of a tablespace’s datafiles is the total storage capacity of the
tablespace (SYSTEM tablespace has 2 MB storage capacity while USERS
tablespace has 4 MB).
The combined storage capacity of a database’s tablespaces is the total storage
capacity of the database (6 MB).