Lesson 1
Chapter 1
Oracle Architectural
Objectives
After completing this lesson, you should be able to do the following:
l Outline the oracle architecture and its main components
l List the structures involved in connecting a user the to an oracle instance
OV of primary Components
Oracle server
l Files,Process和memory structures 并不会并非都会用到,很多是用来恢复和调优的
l 一个server包含一个instance 和 一个database
Oracle instance
l 访问oracle数据库的手段或中介
l 只能打开一个和始终打开一个database,一个Instance对于一个database,一个database可以多个Instance来访问。多对一的关系
l 一个Instance包含Background Process就是PMON,SMON和memory structure就是SGA,database启动时候分配一个SGA,Background Process启动,它代替involve Process执行进程,将每个用户的进程功能综合起来。并执行I/O
l Instance一断电就消失,一开机就启动。
Connection & session 链接与会话
l Connecting to an oracle instance oracle Connection得客户端与后台服务器进程建立得一个tcp连接。Connection有三种连接方式:1、oracle服务器local连接;2、B/S连接方式;3、B/S调用C/S连接。
l Establishing a user connection 建立TCP链接,认证,验证,安全审计通过后,oracle连接建立以后就开始了一个会话,链接断开会话就结束。
l Session 是一种special Connection
注意:Process里面有三种类型:Background Process后台进程是组成Instance得基本部分,专注于数据库核心得进程。Sever Process服务器进程,也是后台进程,处理客户端与数据库连接的进程。User Process与后台sever Process链接,启动一个客户端就是用户进程。
Creating a session
Oracle database
An oracle database
l 包含操作系统文件提供物理存储,用户Instance失败时候的恢复
l Consists of three file types 包含三种基本文件类型。Datafiles是存储数据的,controlfiles是操作数据库的控制信息,redo logfiles是记录数据的改变,修改前后得状态都记录在redo log file,可以用来恢复数据库。其它文件也必不可少,parameter file 参数文件规定了基本参数值,archived log files 归档日志与redo log files相辅相成,为了进一步加强修改。Password file 存储链接数据库后台口令。
[oracle@mylinux ~]$ ps –ef
[oracle@mylinux ~]$ cd oradata
[oracle@mylinux ~]$ cd denver
[oracle@mylinux denver]$ ls -l
total 1195328
drwxr-xr-x 2 oracle oinstall 4096 Jun 20 16:34 archive
-rw-r----- 1 oracle oinstall 1871872 Jun 20 22:14 control01.ctl 控制文件
-rw-r----- 1 oracle oinstall 1871872 Jun 20 22:14 control02.ctl
-rw-r----- 1 oracle oinstall 1871872 Jun 20 22:14 control03.ctl
-rw-r--r-- 1 oracle oinstall 20975616 Jun 20 16:34 drsys01.dbf
-rw-r--r-- 1 oracle oinstall 152702976 Jun 20 16:34 example01.dbf 数据文件
-rw-r--r-- 1 oracle oinstall 26218496 Jun 20 16:34 indx01.dbf
-rw-r--r-- 1 oracle oinstall 20975616 Jun 20 16:34 odm01.dbf
-rw-r----- 1 oracle oinstall 104858112 Jun 20 16:34 redo01.log 重做日志文件
-rw-r----- 1 oracle oinstall 104858112 Jun 20 16:34 redo02.log
-rw-r----- 1 oracle oinstall 104858112 Jun 20 22:14 redo03.log
-rw-r--r-- 1 oracle oinstall 346034176 Jun 20 22:14 system01.dbf
-rw-r--r-- 1 oracle oinstall 41947136 Jun 14 09:44 temp01.dbf
-rw-r--r-- 1 oracle oinstall 10489856 Jun 20 16:34 tools01.dbf
-rw-r--r-- 1 oracle oinstall 209719296 Jun 20 22:14 undotbs01.dbf
-rw-r--r-- 1 oracle oinstall 26218496 Jun 20 16:34 users01.dbf
-rw-r--r-- 1 oracle oinstall 47190016 Jun 20 16:34 xdb01.dbf
[oracle@mylinux denver]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on Sat Jun 20 22:17:19 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> startup
Physical structure
The physical structure includes three types of files
l Control files
l Data files
l Online redo log files
Memory structure
Oracle’s memory structure consists of two memory areas known as ;
l System global area (SGA): allocated at instance start up ,and is a fundamental Component of an oracle instance 系统全球区:一个Instance就一块,是很大的一块
l Program global area (PGA): allocated when the server process is started 程序全局区:一个server process启动就分配了一个PGA,整个Instance就一个SGA。Oracle内存主要消耗在SGA上。
[oracle@mylinux denver]$ ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x24da8a7c 393226 oracle 640 255852544 60
------ Semaphore Arrays --------
key semid owner perms nsems
0x701243d8 98304 oracle 640 154
------ Message Queues --------
key msqid owner perms used-bytes messages
IPCS用来查看IPC内存进程通讯机制资源的
SQL> show sga 查看SGA
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Shared Memory Segments 255852544 236000356 对应。Oracle在linux,unix共享内存。SGA实际上就是一个大的内存块。