码迷,mamicode.com
首页 > 其他好文 > 详细

存储空间管理

时间:2016-06-12 10:51:43      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:

在数据库的逻辑结构中,表空间将不同类型的数据分别组织在一起,如系统数据、用户数据、临时数据、回滚数据等。
在同一个表空间中,数据以数据库对象为单位组织在一起,一般情况下一个数据库对象对应一个段,一个表空间中包含多个段。
在段中存储数据库对象中的数据,数据所占用的存储空间以区为单位进行分配和回收。

一个数据库对象占用若干个区,所以段是由若干个区组成的。
当为数据库对象分配存储空间时,一次分配一个或多个区。
区是分配和回收存储空间的基本单位,一个区是由若干个连续的数据块组成的。
数据块是逻辑结构中的最小存储单位,是Oracle读写数据的基本单位。

当用户访问数据时,服务器进程首先将数据从数据块读到数据库高速缓存中,并存储在与数据块大小相同的缓冲区中,然后在缓冲区中对数据进行读写。
数据库中的数据在物理上是存储在磁盘上的,需要占用一定的操作系统块。

一个数据块是由若干个操作系统块组成的,因此,数据块的大小是操作系统块的整数倍。
数据库服务器对数据块的读写最终将转化为对多个操作系统块的读写。

段的管理

在表空间中,一个段一般代表一个数据库对象,对象的所有数据都存储在对应的段中。

一般情况下段不需要用户自己创建,在创建数据库对象将自动产生段。
为段所分配的空间就位于表空间的数据文件中,这些存储空间由若干个区组成。
段、区和数据块之间的关系如图所示。

技术分享

段的类型

Oracle 11g支持10余种类型的段。

通过查询数据字典dba_segments ,可以得到当前数据库中已经存在的段类型。

下面是有关数据字典dba_segments的相关信息:

DBA_SEGMENTS describes the storage allocated for all segments in the database.

Related View

USER_SEGMENTS describes the storage allocated for the segments owned by the current user‘s objects. This view does not display the OWNERHEADER_FILEHEADER_BLOCK, or RELATIVE_FNO columns.

ColumnDatatypeNULLDescription

OWNER

VARCHAR2(128)

 

Username of the segment owner

SEGMENT_NAME

VARCHAR2(128)

 

Name, if any, of the segment

PARTITION_NAME

VARCHAR2(128)

 

Object Partition Name (Set to NULL for nonpartitioned objects)

SEGMENT_TYPE

VARCHAR2(18)

 

Type of segment:

  • NESTED TABLE

  • TABLE

  • TABLE PARTITION

  • CLUSTER

  • LOBINDEX

  • INDEX

  • INDEX PARTITION

  • LOBSEGMENT

  • TABLE SUBPARTITION

  • INDEX SUBPARTITION

  • LOB PARTITION

  • LOB SUBPARTITION

  • ROLLBACK

  • TYPE2 UNDO

  • DEFERRED ROLLBACK

  • TEMPORARY

  • CACHE

  • SPACE HEADER

  • UNDEFINED

SEGMENT_SUBTYPE

VARCHAR2(10)

 

Subtype of LOB segment: SECUREFILEASSMMSSM, andNULL

TABLESPACE_NAME

VARCHAR2(30)

 

Name of the tablespace containing the segment

HEADER_FILE

NUMBER

 

ID of the file containing the segment header

HEADER_BLOCK

NUMBER

 

ID of the block containing the segment header

BYTES

NUMBER

 

Size, in bytes, of the segment

BLOCKS

NUMBER

 

Size, in Oracle blocks, of the segment

EXTENTS

NUMBER

 

Number of extents allocated to the segment

INITIAL_EXTENT

NUMBER

 

Size in bytes requested for the initial extent of the segment at create time. (Oracle rounds the extent size to multiples of 5 blocks if the requested size is greater than 5 blocks.)

NEXT_EXTENT

NUMBER

 

Size in bytes of the next extent to be allocated to the segment

MIN_EXTENTS

NUMBER

 

Minimum number of extents allowed in the segment

MAX_EXTENTS

NUMBER

 

Maximum number of extents allowed in the segment

MAX_SIZE

NUMBER

 

Maximum number of blocks allowed in the segment

RETENTION

VARCHAR2(7)

 

Retention option for SECUREFILE segment

MINRETENTION

NUMBER

 

Minimum retention duration for SECUREFILE segment

PCT_INCREASE

NUMBER

 

Percent by which to increase the size of the next extent to be allocated

FREELISTS

NUMBER

 

Number of process freelists allocated to this segment

FREELIST_GROUPS

NUMBER

 

Number of freelist groups allocated to this segment

RELATIVE_FNO

NUMBER

 

Relative file number of the segment header

BUFFER_POOL

VARCHAR2(7)

 

Buffer pool to be used for segment blocks:

  • DEFAULT

  • KEEP

  • RECYCLE

FLASH_CACHE

VARCHAR2(7)

 

Database Smart Flash Cache hint to be used for segment blocks:

  • DEFAULT

  • KEEP

  • NONE

Solaris and Oracle Linux functionality only.

CELL_FLASH_CACHE

VARCHAR2(7)

 

Cell flash cache hint to be used for segment blocks:

  • DEFAULT

  • KEEP

  • NONE

See Also: Oracle Exadata Storage Server Software documentation for more information

INMEMORY

VARCHAR2(8)

 

Indicates whether the In-Memory Column Store (IM column store) is enabled (ENABLED) or disabled (DISABLED) for this segment

INMEMORY_PRIORITY1

VARCHAR2(8)

 

Indicates the priority for In-Memory Column Store (IM column store) population:

  • LOW

  • MEDIUM

  • HIGH

  • CRITICAL

  • NONE

  • NULL

INMEMORY_DISTRIBUTE1

VARCHAR2(15)

 

Indicates how the IM column store is distributed in an Oracle Real Application Clusters (Oracle RAC) environment:

  • AUTO

  • BY ROWID RANGE

  • BY PARTITION

  • BY SUBPARTITION

INMEMORY_DUPLICATE1

VARCHAR2(13)

 

Indicates the duplicate setting for the IM column store in an Oracle RAC environment:

  • NO DUPLICATE

  • DUPLICATE

  • DUPLICATE ALL

INMEMORY_COMPRESSION1

VARCHAR2(17)

 

Indicates the compression level for the IM column store:

  • NO MEMCOMPRESS

  • FOR DML

  • FOR QUERY [ LOW | HIGH ]

  • FOR CAPACITY [ LOW | HIGH ]

  • NULL

例如:

 

存储空间管理

标签:

原文地址:http://www.cnblogs.com/jy627625/p/5576694.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!