oracle体系结构

体系结构:

  整个oracle数据库管理系统可分为:内存丶进程丶文件。

 

         内存+后台进程 = 实例。实例就相当于进入数据库的入口,启动数据库先要启动实例,即先给oracle分配内存然后启动后台进程并通过进程将内存和文件连接起来,后台进程执行数据库的输入输出和监控其他oracle进程。

         内存分配:

·         SGA(System Global Area)

存放sql语句的共享池 (shared_pool_size)

存放大输入输出及备份文件的大型池 (large_pool_size)

存放最近读入或者写入数据库的数据信息的数据库高速缓存区     (db_cache_size)

存放java代码的JAVA池(java_pool_size)

还有存放了在进行DML操作之前和之后的数据信息的重做日志缓存区   (log_buffer)

流池(stream_pool_size)(Oracle Streams enables information sharing, including data replication and message queuing, within or between databases.)
官方文档如下:

Component

Description

Database buffer cache

Before data stored in the database can be queried or modified, it must be read from a disk and stored

in the buffer cache. All user processes connected to the database share access to the buffer cache.

 For optimal performance, the buffer cache should be large enough to avoid frequent disk I/O

operations.

Shared pool            

 

The shared pool caches information that is shared among users:

·         SQL statements that can be reused

·         Information from the data dictionary such as user account data, table and index descriptions,

·          and privileges

·         Stored procedures, which are executable code that is stored in the database

Redo log buffer

This buffer improves performance by caching redo information until it can be written to the physical

online redo log files stored on disk. Redo information and online redo log files are discussed in

 "About Online Redo Log Files".

Large pool

This optional area is used to buffer large I/O requests for various server processes.

Java pool

The Java pool is an area of memory that is used for all session-specific Java code and data within the

 Java Virtual Machine (JVM).

Streams pool

The Streams pool is an area of memory that is used by the Oracle Streams feature.

 For more information about Oracle Streams, see Oracle Streams Concepts and Administration.

Result cache

The result cache buffers query results. If a query is run for which the results are stored in the result

cache, then the database returns the query results from the result cache instead of rerunning the query.

 This SGA component speeds the execution of frequently run queries.

 

 

·         PGA(Program Global Area):The PGA is used to process SQL statements and to hold logon and other session information. A large part of the PGA is dedicated to SQL work areas, which are working memory areas for sorts and other SQL operations.

         5主要的个后台进程:系统监控进程(SMON),进程监控(PMON),数据库写进程(DBWR),日志写进程(LGWR),检查点进程(CKPT)。

Background Process

Description

Database writer (DBWn)

The database writer writes modified blocks from the database buffer cache to the

files on a disk. Oracle Database allows a maximum of 36 database writer processes.

Log writer (LGWR)

The log writer process writes redo log entries to disk. Redo log entries are generated

in the redo log buffer of the System Global Area (SGA) and the log writer process writes

the redo log entries sequentially into an online redo log file.

Checkpoint (CKPT)

At specific times, all modified database buffers in the SGA are written to the data files

by a database writer process (DBWn). This event is called a checkpoint.

The checkpoint process signals DBWn, updates the data files and

control files of the database, and records the time of this update.

System monitor (SMON)

The system monitor performs instance recovery when a failed instance is restarted.

Process monitor (PMON)

The process monitor performs a recovery when a user process fails.

 It cleans up the cache and frees resources that the failed process was using.

Archiver (ARCn)

Archiver processes copy the online redo log files to archival storage

when the log files are full or a log switch occurs.

The database must be in archive log mode to run archive processes.

 For more information, see Chapter 9, "Performing Backup and Recovery".

Manageability monitor (MMON)

This process performs various management-related background tasks, for example:

·         Issuing alerts whenever a given metric violates its threshold value

·         Taking snapshots by spawning additional processes

·         Capturing statistical values for SQL objects that have been recently modified

Job Queue Processes (CJQ0 and Jnnn)

Job queue processes run user jobs, often in batch mode.

 A job is a user-defined task scheduled to run one or more times.

ALTER SYSTEM SET pga_aggregate_target = 140 M;

ALTER SYSTEM SET sga_target = 472 M;

 

数据库主要有三种文件:

 

         存储整个数据库的结构信息的控制文件,存储对数据库操作信息记录数据库变化的重做日志文件,整个数据库最核心的存储最终数据的数据文件。

 

工作原理:

         首先启动实例,即数据库进入nomount状态,这时就要根据系统的参数文件给oracle分配内存并启动后台进程,然后装载数据库,进入mount状态,这时打开了就控制文件,很多修改参数的操作只能在这个模式下进行,最后打开数据库进入open状态,就可以对数据库进行操作了。

         数据库打开之后就要进行用户登陆,数据库会根据口令文件进行检查,当登陆成功之后,oracle会建立一个用户进程,所有的请求都会通过这些进程发送给oracle服务器。
         当用户向服务器发出请求时,比如执行一条DML语句,服务器进程会将这条语句进行与ASCII值的等效转化,再由HASH函数转化为HASH值,这个HASH值可以唯一标识一条sql语句,oracle并不会直接解析语句,而是先再shared pool里查找是否存在相同的HASH值,如果存在,那么就可以省去后面的解析等开销,直接使用已经解析好的语句,并且这些数据块都已经提前取出,就放在db buffer中,所以很快就可以出结果。如果没有,那就只能将语句解析,再到数据文件中找到相应的数据,这个过程会使用较大的开销。这也是硬解析慢的原因。(如有错误,请留言。)


                                                                                                                                                                                                

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30175600/viewspace-1656832/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30175600/viewspace-1656832/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值