Summary of oracle database segment segment

A segment is any entity that consumes physical storage space in a database (a segment may exist in multiple datafiles, since physical datafiles
 are the basic physical storage unit that makes up a logical tablespace)

 

I encountered a high water level problem today:

For a partitioned table, after deleting some data in a partition, the table space is not reclaimed.

 

reason:

If a table is not partitioned, then a table is in a segment. If a table has multiple partitions, then each partition is in a segment . If you delete some of the data, the space will not be reclaimed

Unless trunc off this partition.

 

Solution:

Use the method of exporting and importing partition exchange to reclaim the database table space.

 

--Create a temporary table to export the data of a certain day

createtable temp_msgbody  asselect*from im_msginfo_body partition(P_MSGINFO_BODY_20141213)

 

--Empty the exported partition

alter table  im_msginfo_body  truncate partition  P_MSGINFO_BODY_ 20141213

 

--Partition swap, rewind data

ALTERTABLE im_msginfo_body EXCHANGEPARTITION P_MSGINFO_BODY_20141213WITHTABLE temp_msgbody withvalidation;

 

With the concept of segment (segment):

A segment is any entity that consumes physical storage space in a database (a segment may exist in multiple datafiles, since physical datafiles
 are the basic physical storage unit that makes up a logical tablespace)

 More general segments are

 Table (table), data
 index (Index) used to store row and column structure, used to speed up access
 rollback (Rollback), a special segment used to maintain read consistency during user transactions and during transaction recovery, rollback Section 8. Managing Consistency and
  Concurrency Continues to describe
 partitioning, which divides a table into smaller, more manageable pieces to achieve performance goals. 

 


EXTENTS consists of contiguous blocks of storage space, but each extension can only reside in a single data file

Database blocks are smaller blocks in orcacle, composed of operating system blocks.

OS block


Segments are made up of extensions, one to two hundred million extensions. Since each extension can only belong to a single data file, segments can be distributed in different data files.
Extensions are composed of database blocks.
Each extension, database block It is composed of operating system blocks.

A tablespace is a grouping schema object that facilitates the management of physical objects. A tablespace is a bridge between physical structures (data files and extensions) and logical structures (tables and indexes).

 

 

 

 

The access segment can use sql language, C language , cobol, Java and other languages.

 

A piece can only occupy the space of one segment. When the data of this table increases, the segment can reallocate new areas for the table, so that the space can be expanded;
also, a segment belongs to only one table space, and a table space can have Multiple segments; tablespaces and segments have a one-to-many relationship on the logical storage structure;
tablespaces and data files are also in a one-to-many relationship, and segments and data files are not directly related;
but a segment can belong to multiple data files ;

So when the segment space is insufficient, it is equivalent to insufficient table space; as long as you expand the table space size or add new data files;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326595773&siteId=291194637