邏輯表空間管理結構(Logical Storage Structures)

zhangsharp20發表於2015-12-11

Logical Storage Hierarchy

邏輯儲存層級
Figure 12-2
 shows the relationships among data blocks, extents, and segments within a tablespace. In this example, a segment has two extents stored in different data files.

圖12-2顯示了表空間在資料塊,區和段之間的關係,例如,一個段有兩個區被儲存在不同的資料檔案上。

Figure 12-2 Segments, Extents, and Data Blocks Within a Tablespace

This graphic depicts the relationship between a Tablespace, Segment, Datafiles, Extents, and Data Blocks.

The tablespace holds one Segment of 96 Kb. The segment is divided into one extent of 24 Kb and another of 72 Kb, each of which is in a separate datafile. The 72 Kb extent maps to 12 rows of 2 Kb blocks, with 3 2 Kb blocks in each row. The 24 Kb extent maps to 12 2 Kb blocks.

這張圖描述Lee表空間、段、資料檔案、區和資料塊之間的關係。
表空間擁有的一個96KB的段,這個段被分成了一個24KB的區和一個72KB的區,每一個都是區分屬於一個單獨的資料檔案,72KB的區對映成了12行每行3個2KB的塊。24KB的區對映成了一個12行每行一個2KB的塊。

At the finest level of granularity, Oracle Database stores data in data blocks. One logical data block corresponds to a specific number of bytes of physical disk space, for example, 2 KB. Data blocks are the smallest units of storage that Oracle Database can use or allocate.

orale存放資料的最小單位是資料塊。一個邏輯的資料塊與指定數量的物理磁碟空間是一致的,例如,2KB的資料塊是oracle資料庫能夠使用的最小的儲存單位。

An extent is a set of logically contiguous data blocks allocated for storing a specific type of information. In Figure 12-2, the 24 KB extent has 12 data blocks, while the 72 KB extent has 36 data blocks.

一個區是邏輯相鄰的被分配用來執行指定型別資訊的資料塊的集合。在圖12-2中,24KB的區有12個資料塊,而72KB的區有36個資料塊。

segment is a set of extents allocated for a specific database object, such as a table. For example, the data for the employees table is stored in its owndata segment, whereas each index for employees is stored in its own index segment. Every database object that consumes storage consists of a single segment.

段是被分配儲存指定資料庫物件的區的集合
,例如表。例如,employees表的資料被儲存在他自己的資料段中,而每個employees的索引都被儲存在他自己的索引段中,每個消耗儲存的資料庫物件都是有單個的段構成的。

Each segment belongs to one and only one tablespace. Thus, all extents for a segment are stored in the same tablespace. Within a tablespace, a segment can include extents from multiple data files, as shown in Figure 12-2. For example, one extent for a segment may be stored in users01.dbf, while another is stored in users02.dbf. A single extent can never span data files.

每個段只屬於一個表空間,因此,所有的區都被儲存在相同的表空間中,在表空間中,段可以包含多個資料檔案的區,就像12-2中顯示的那樣,例如,一個段的區或許被儲存在users01.dbf中,而另外一個區被儲存在users02.dbf
中。單個的區只能在一個datafile中。

Logical Space Management

邏輯空間的管理
Oracle Database must use logical space management to track and allocate the extents in a tablespace. When a database object requires an extent, the database must have a method of finding and providing it. Similarly, when an object no longer requires an extent, the database must have a method of making the free extent available.

oracle必須使用邏輯的空間管理去追蹤和分配表空間的區。當一個資料庫物件需要一個區,資料庫逆序有發現和提供它的方法,同樣的,當一個物件不再需要一個區,資料庫必須有方法釋放這個區。

Oracle Database manages space within a tablespace based on the type that you create. You can create either of the following types of tablespaces:

oracle資料庫根據建立表空間的型別管理空間。可以建立下列空間型別中的任一種:

  • Locally managed tablespaces (default)
    本地管理的表空間(預設)

    The database uses bitmaps in the tablespaces themselves to manage extents. Thus, locally managed tablespaces have a part of the tablespace set aside for a bitmap. Within a tablespace, the database can manage segments with automatic segment space management (ASSM) or manual segment space management (MSSM).

資料庫使用表空間本身的點陣圖管理區。因此,本地管理的表空間會有一部分空間留給點陣圖。對於表空間,資料庫能使用ASSM和MSSM管理段。

  • Dictionary-managed tablespaces
    基於字典管理的表空間

    The database uses the data dictionary to manage extents

資料庫使用資料字典管理區

Figure 12-3 shows the alternatives for logical space management in a tablespace.

表12-3顯示了兩種表空間的邏輯管理方式


Locally Managed Tablespaces

A locally managed tablespace maintains a bitmap in the data file header to track free and used space in the data file body. Each bit corresponds to a group of blocks. When space is allocated or freed, Oracle Database changes the bitmap values to reflect the new status of the blocks.
本地管理的空間會在資料檔案的頭部維護
點陣圖去追蹤資料檔案體部的空間是空還是非空。每一點都會對應一組塊。當空間被分配或是被釋放,oracle會改變點陣圖的值去反應塊的一個最新的狀態。

The following graphic is a conceptual representation of bitmap-managed storage. A 1 in the header refers to used space, whereas a 0 refers to free space.
下個圖是一個點陣圖管理儲存的概念圖。頭部的1代表已被用的空間,而0代表的是不用的空間。

This graphic shows a data file with the following numbers in its header: 1 0 0 1 0 1. The data file contains three rows of extents. The first five blocks are mostly full; the second 7 blocks are mostly empty; the next 7 blocks are mostly empty; the next 5 blocks are mostly full; the next 4 blocks are mostly empty; the next 8 blocks are mostly full.

這個圖顯示了資料檔案頭部的number號:1 0 0 1 0 1。
資料檔案包含了三行的區。前五個塊是滿的,後7個塊是空的;下一行的7個塊是空的,後五個塊是滿的,下4個塊是空的,下8個塊是滿的。

A locally managed tablespace has the following advantages:

  • Avoids using the data dictionary to manage extents

    Recursive operations can occur in dictionary-managed tablespaces if consuming or releasing space in an extent results in another operation that consumes or releases space in a data dictionary table or undo segment.

一個本地管理的表空間有下列優點:
避免使用資料字典去管理區

在基於字典管理的表空間,如果佔用或是釋放區的空間會導致資料字典表和undo段的空間的佔用和釋放

  • Tracks adjacent free space automatically

    In this way, the database eliminates the need to coalesce free extents.

自動跟蹤相鄰的空閒空間

這樣的話,資料庫會評估需要整合的空閒區

  • Determines the size of locally managed extents automatically

    Alternatively, all extents can have the same size in a locally managed tablespace and override object storage options.

自動決定本地管理區的大小

作為一種選擇,所有的在本地管理的表空的區都會有相同的大小並且覆蓋物件儲存的選項。

note:
Oracle strongly recommends the use of locally managed tablespaces with Automatic Segment Space Management.

oracle強烈推薦使用本地管理的ASSM的表空間
,oracle強烈推薦

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29802484/viewspace-1870677/,如需轉載,請註明出處,否則將追究法律責任。

相關文章