Oracle体系结构概览(二)

二、Oracle实例


2.1  Oracle实例的结构

When an instance is started, Oracle Database allocates a memory area called thesystem global area (SGA) and starts one or morebackground processes. The SGA serves various purposes, including the following:

当一个实例启动的时候,Oracle数据库会分配一组名为SGA的内存区域和启动一个或多个后台进程。SGA服务于以下方面:

  • Maintaining internal data structures that are accessed by many processes and threads concurrently

  •   同时维护多个被进程和线程访问的内部数据结构
  • Caching data blocks read from disk

  •   贮存从磁盘读取的数据块
  • Buffering redo data before writing it to the online redo log files

  •   在写入联机日志文件前缓冲重做数据
  • Storing SQL execution plans

  •   存储SQL执行计划

The SGA is shared by the Oracle processes, which include server processes and background processes, running on a single computer. The way in which Oracle processes are associated with the SGA varies according to operating system.

SGA是共享于Oracle进程的,这些进程包括运行在单个机器上的服务进程和后台进程。根据操作系统的不同,Oracle进程和SGA的关联方式是不同的。

A database instance includes background processes. Server processes, and the process memory allocated in these processes, also exist in the instance. The instance continues to function when server processes terminate.

以下为Oracle实例的结构:

Oracle体系结构概览(二)_第1张图片


2.2 实例的启动与关闭


如下图,可以看到实例从shutdown到open和其相反的过程。

Oracle体系结构概览(二)_第2张图片

How an Instance Is Started

When Oracle Database starts an instance, it performs the following basic steps:

当Oracle数据库启动实例时会按以下过程进行:

  1. Searches for a server parameter file in a platform-specific default location and, if not found, for a textinitialization parameter file (specifying STARTUP with the SPFILE or PFILE parameters overrides the default behavior)

  2. Reads the parameter file to determine the values of initialization parameters

  3. Allocates the SGA based on the initialization parameter settings

  4. Starts the Oracle background processes

  5. Opens the alert log and trace files and writes all explicit parameter settings to thealert log in valid parameter syntax

  1. 寻找SPFILE,如果不存在,可以通过制定文本文件开进行启动;
  2. 读取参数文件决定初始化参数;
  3. 根据初始化参数分配SGA;
  4. 启动Oracle后台进程;
  5. 打开alert.log和trace文件并写入各个参数设置。

At this stage, no database is associated with the instance. Scenarios that require aNOMOUNT state include database creation and certain backup and recovery operations.

How a Database Is Mounted

The instance mounts a database to associate the database with this instance. To mount the database, the instance obtains the names of the database control files specified in theCONTROL_FILES initialization parameter and opens the files. Oracle Database reads the control files to find the names of the data files and the online redo log files that it will attempt to access when opening the database.

实例mount到数据库时会把他们互相关联起来。mount到数据库时,实例会从数据库的控制文件中获取指定初始参数Control_files的值并打开控制文件。当打开数据库时,Oracle数据库读取这些控制文件去寻找将被访问的数据文件和联机日志文件。

In a mounted database, the database is closed and accessible only to database administrators. Administrators can keep the database closed while completing specific maintenance operations. However, the database is not available for normal operations.

在mounted状态下的数据中,一些操作只能被DBA所执行,例如一些维护性的操作。

If Oracle Database allows multiple instances to mount the same database concurrently, then theCLUSTER_DATABASE initialization parameter setting can make the database available to multiple instances. Database behavior depends on the setting:

  • If CLUSTER_DATABASE is false (default) for the first instance that mounts a database, then only this instance can mount the database.

  • If CLUSTER_DATABASE is true for the first instance, then other instances can mount the database if theirCLUSTER_DATABASE parameter settings are set to true. The number of instances that can mount the database is subject to a predetermined maximum specified when creating the database.

How a Database Is Opened

Opening a mounted database makes it available for normal database operations. Any valid user can connect to an open database and access its information. Usually, a database administrator opens the database to make it available for general use.

When you open the database, Oracle Database performs the following actions:

  • Opens the online data files in tablespaces other than undo tablespaces

    If a tablespace was offline when the database was previously shut down (see "Online and Offline Tablespaces"), then the tablespace and its corresponding data files will be offline when the database reopens.

  • Acquires an undo tablespace

    If multiple undo tablespaces exists, then the UNDO_TABLESPACE initialization parameter designates the undo tablespace to use. If this parameter is not set, then the first available undo tablespace is chosen.

  • Opens the online redo log files

你可能感兴趣的:(Oracle体系结构概览(二))