Overview of Segments
segment由一组extent构成,其中存储了表空间(tablespace)内各种逻辑存储结构的数据。
Segment可以根据存储数据的类型而存储不同的对象。比如:
·Table, table partition, or table cluster表,分区表,簇表
·LOB or LOB partition大对象表
·Index or index partition索引或分区索引表
By default, Oracle Database creates a user segment when you create a user object with a CREATE statement。The database allocates one or more extents when the segment is created. (Storage parameters for the object determine how the extents for each segment are allocated)
值得注意的一点是在创建表CREAT TABLE时,如果表内含有主键primary或unique键,oracle会自动再创建一个索引表。所以,一个CREAT TABLE语句可能会创建多个段segment。
Temporary Segments
当Oracle处理一个查询时,经常需要为SQL语句的解析与执行的中间结果(intermediate stage)准备临时空间。Oracle会自动地分配被称为临时段(temporary segment)的磁盘空间。
Undo Segments
作用:
·Roll back an active transaction
·Recover a terminated transaction
·Provide read consistency
·Perform. some logical flashback operations
Undo records also provide read consistency by maintaining the before image of the data for users accessing data at the same time that another user is changing it.
Segment Space and the High Water Mark
The high water mark (HWM) is the point in a segment beyond which data blocks are unformatted and have never been used.
Overview of Tablespaces
A tablespace is a logical storage container for segments.
Segments are database objects, such as tables and indexes, that consume storage space.
A database must have the SYSTEM and SYSAUX tablespaces
Permanent Tablespaces永久表空间
The segments for objects in the tablespace are stored physically in data files.
Oracle recommends that you create at least one tablespace to store user and application data.
使用tablespace的几个目的:
·Control disk space allocation for database data
·Assign a quota (space allowance or limit) to a database user
·Take individual tablespaces online or offline without affecting the availability the whole database
·Perform. backup and recovery of individual tablespaces
·Import or export application data by using the Oracle Data Pump utility
·Create a transportable tablespace that you can copy or move from one database to another, even across platforms
The SYSTEM Tablespace
a necessary administrative tablespace included with the database when it is created.
The SYSTEM tablespace includes the following information, all owned by the SYS user:
·The data dictionary
·Tables and views that contain administrative information about the database
·Compiled stored objects such as triggers, procedures, and packages
cannot rename or drop the SYSTEM tablespace.
In a database with a locally managed SYSTEM tablespace, you cannot create dictionary-managed tablespaces (dictionary-managed tablespaces are deprecated)但是当创建数据库时,默认的SYSTEM tablespace是dictionary managed的
The SYSAUX Tablespace
The SYSAUX tablespace is an auxiliary tablespace to the SYSTEM tablespace.SYSAUX是SYSTEM的辅助表空间The SYSAUX tablespace provides a centralized location for database metadata that does not reside in the SYSTEM tablespace.
does not allow the SYSAUX tablespace to be dropped or renamed.
Undo Tablespaces
An undo tablespace is a locally managed tablespace reserved for system-managed undo data
Undo tablespaces require the database to be in the default automatic undo management mode.
A database can contain multiple undo tablespaces, but only one can be in use at a time.
If no undo tablespace is available, then the instance starts without an undo tablespace and stores undo records in the SYSTEM tablespace.
Automatic Undo Retention The undo retention period is the minimum amount of time that Oracle Database attempts to retain old undo data before overwriting it. oracle要更新覆盖undo数据时,最少保留时间的undo数据不被覆盖
Undo retention is important because long-running queries may require older block images to supply read consistency.
If the undo tablespace is
configured with the AUTOEXTEND option, and if the maximum size is not specified,
then undo retention tuning is different
Temporary Tablespaces临时表空间
The database stores temporary tablespace data in temp files.
No permanent schema objects can reside in a temporary tablespace。
Temporary tablespaces can improve the concurrency of multiple sort operations that do not fit in memory.
When the SYSTEM tablespace is locally managed, a default temporary tablespace is included in the database by default during database creation. (A locally managed SYSTEM tablespace cannot serve as default temporary storage).If SYSTEM is dictionary managed, and if a default temporary tablespace is not defined at database creation, then SYSTEM is the default temporary storage.本地管理SYSTEM表空间和字典管理SYSTEM表空间对于temporary tablespace的不同之处。
Tablespace Modes表空间的模式状态
Read/Write and Read-Only Tablespaces
注意:The SYSTEM and SYSAUX tablespaces and temporary tablespaces are permanently read/write, which means that they cannot be made read-only
Online and Offline Tablespaces
注意:The SYSTEM tablespace and temporary tablespaces cannot be taken offline.
Tablespace File Size表空间size
·A smallfile tablespace can contain multiple data files or temp files
·A bigfile tablespace contains one very large data file or temp file.
Bigfile tablespaces are supported only for locally managed tablespaces with ASSM
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24005010/viewspace-684194/ ,如需转载,请注明出处,否则将追究法律责任。