天天看點

oracle體系結構(四)

Overview of Extents

An extentis a logical unit of database storage space allocation made up of a number of contiguousdata blocks. One or more extents in turn make up a segment. When the existingspace in a segment is completely used, Oracle allocates a new extent for the segment.

區是由許多連續的資料塊組成的邏輯資料庫存儲配置設定空間的機關。一個或者更多的區組成一個段。當一個段中的已有空間完全使用後,oracle會為這個段配置設定一個新的區。

When Extents Are Allocated

When youcreate a table, Oracle allocates to the table’s data segment an initial extent ofa specified number of data blocks. Although no rows have been inserted yet, theOracle data blocks that correspond to the initial extent are reserved for thattable’s rows.

當使用者建立一個表的時候,oracle會為這個表的資料段配置設定一個有規格數量資料塊組成的初始區。盡管這個時候這個表中還沒有插入資料,但是oracle已經為插入表的資料行預留了相當于初始區大小的資料塊空間。

If thedata blocks of a segment’s initial extent become full and more space isrequired to hold new data, Oracle automatically allocates an incremental extentfor that segment. An incremental extent is a subsequent extent of the same orgreater size than the previously allocated extent in that segment.

如果一個段的初始區下的資料塊被充滿,并且又有新的資料需要更多的空間,oracle會自動為這個段配置設定一個自增長的區。自增長區是一個後來由oracle自動配置設定的區,段中的自增長區與之前已有的區大小一樣,甚至更大。

Formaintenance purposes, the header block of each segment contains a directory of theextents in that segment.

鑒于易于維護的目的,每個段的首部中包含一個記錄此段所有區的目錄。

Note:This chapter applies to serial operations, in which one server process parsesand runs a SQL statement. Extents are allocated somewhat differently inparallel SQL statements, which entail multiple server processes.

注意:本章的内容适用于串行執行(serialoperation)的情況,即隻有一個服務程序解析、執行 SQL 語句。對于并行執行(parallel)的 SQL 語句(即一個語句由多個服務程序執行),區(extent)的配置設定情況有所不同。

Determine theNumber and Size of Extents規劃區的大小和數目

Storage parameters expressed in terms of extents define every segment. Storage parameters apply to all types of segments. They control how Oracle allocates free database space for a given segment. For example, you can determine how much space is initially reserved for a table’s data segment or you can limit the number of extents the table can allocate by specifying the storage parameters of a table in the STORAGE clause of the CREATE TABLE statement. If you do not specify atable’s storage parameters, then it uses the default storage parameters of thetablespace.

每個段定義了表達區資訊的存儲參數。存儲參數适用于所有類型的段。這些參數控制oracle如何為一個已存在的段配置設定空閑的資料空間。例如,使用者可以在CREATE TABLE 語句中使用STORAGE 子句設定存儲參數,決定建立表時為其資料段配置設定多少初始空間,或限定一個表最多可以包含多少區。如果你沒有指定一個表的存儲參數,那麼oracle就會使用該表所在表空間的預設存儲參數。

You can have dictionary managedtablespaces, which rely on data dictionary tables to track space utilization,or locally managed tablespaces, which use bitmaps (instead of data dictionary tables) to track used and free space. Because of the better performance andeasier manage ability of locally managed tablespaces, the default for non-SYSTEMpermanent tablespaces is locally managed whenever the type of extent management is not explicitly specified.

使用者既可以使用資料字典管理的表空間(dictionary managed tablespace)(依賴資料字典表監控空間的利用情況),也可以使用本地管理的表空間(locally managed tablespace)(使用位圖(bitmap)來标記可用與已用空間)。由于本地管理的表空間性能較好且易于管理,當使用者沒有顯式地設定資料擴充(extent)管理參數時,除了 SYSTEM 之外的所有永久表空間(permanent tablespace)預設使用本地管理方式。

Atablespace that manages its extents locally can have either uniform extent sizesor variable extent sizes that are determined automatically by the system. Whenyou create the tablespace, the UNIFORM or   AUTOALLOCATE(system-managed)clause specifies the type of allocation.

在一個本地管理的表空間中,其中所配置設定的區的容量既可以是使用者設定的固定值,也可以是由系統自動決定的可變值。當你建立表空間的時候,UNIFORM和AUTOALLOCATE(系統管理的)字句指定了配置設定的區的管理模式。

■For uniform extents, you can specify an extent size or use the defaultsize, which is 1 MB. Ensure that each extent contains at least five databaseblocks, given the database block size. Temporary tablespaces that manage theirextents locally can only use this type of allocation.

■For system-managed extents, Oracle determines the optimal size ofadditional extents, with a minimum extent size of 64 KB. If the tablespaces arecreated with 'segment space management auto’, and if the database block size is16K or higher, then Oracle manages segment size by creatingextents with a minimum size of 1M. This is the default for permanenttablespaces.

■對于統一區管理,使用者可以指定區的大小,或者使用預設的區大小,預設的區大小是1MB。考慮到資料庫塊的大小,統一區管理指定區大小的時候要確定每一個區包括至少5個資料庫塊。

■對于系統管理區,由Oracle決定新增資料擴充的最佳容量,其最小容量為 64 KB。如果建立表空間時使用了“segment space management auto”子句,且資料塊容量大于等于 16 KB,Oracle擴充一個段時所建立的區的最小容量為 1 MB。對于永久表空間(permanent tablespace)上述參數均為預設值。

The storage parameters INITIAL,NEXT, PCTINCREASE,andMINEXTENTS cannot be specified at the tablespace level for locally managed tablespaces. They can, however, be specified at the segment level. In thiscase, INITIAL, NEXT, PCTINCREASE, and MINEXTENTS are used together to computethe initial size of the segment. After the segment size is computed, internalalgorithms determine the size of each extent.

在本地管理的表空間(locally managed tablespace)中,INITIAL,NEXT,PCTINCREASE,和 MINEXTENTS 這四個存儲參數可以作用于段(segment),但不能作用于表空間。INITIAL,NEXT,PCTINCREASE,和 MINEXTENTS 相結合可以用于計算段的初始容量。當段容量确定後,Oracle使用内部算法确定其中每個初始區的容量。