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實例的結構:

Description of Figure 13-1 follows


2.2 實例的啓動與關閉


如下圖,可以看到實例從shutdown到open和其相反的過程。

Description of Figure 13-3 followsDescription of Figure 13-4 follows

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章