oracle area management and segment space management are introduced in detail

  • 2020-11-30 08:37:05
  • OfStack

As an DBA, common 1 scenario 1:

Create table Spaces:

 
createtablespaceThink 
datafile'/u01/app/oracle/oradata/orcl/think.dbf'size100M 
autoextendonnext10Mmaxsize4096M 
extentmanagementlocaluniformsize256K 
segmentspacemanagementauto; 

Create user:
 
createuserbin 
defaulttablespaceThink 
temporarytablespacetemp; 

Grant permission:
 
grantconnect,resourcetobin; 
revokeunlimitedtablespacefrombin; 
alteruserbinquotaunlimitedonThink; 

In this scenario, there are two statements:
1) extentmanagementlocaluniformsize256K
(2) segmentspacemanagementauto
Among them, the former is district management; The latter is segment space management

Seller area management
Zone management is really just table space management
Before i, the dictionary managed the table space. When objects were created or deleted, the space allocation or recycling of Oracle was recorded and managed by the data dictionary
In highly concurrent systems, this can lead to performance degradation, space debris, and other problems
This is already a past technology, and I won't repeat it here.
At the beginning of 8i, Oracle was introduced into local surface space management
A bitmap area is added to the head of the data file for each table space
The first block in the first block of the first segment is firstlevelbitmapblock
The second block is secondlevelbitmapblock
The third block is the segment header block
These two blocks are used to manage freeblock

Grammar:
 
extentmanagementlocal{autoallocate|uniformsizenK/M} 

Is it automatic allocation or unified size 1
For automatic allocation, Oracle allocates space according to the increment algorithm
You can also specify the size of each interval in detail if you choose series 1 dimensions
dba_extents this view can see which objects are allocated how many intervals

(ii) Paragraph space management
Oracle assigns space to object segments in intervals, while the space within segments is used and managed in block units
We understand segment space management in terms of a few parameters
 
[sql] 
<spanstyle="font-size:18px;">sys@ORCL>selectextent_management,segment_space_managementfromdba_tablespaces; 
EXTENT_MANSEGMEN 
---------------- 
LOCALMANUAL 
LOCALMANUAL 
LOCALAUTO 
LOCALMANUAL 
LOCALMANUAL 

Starting from 9i, there are two types of segment space management:
MSSM: You set freelists, freelistgroups, pctused, pctfree, initrans and other parameters to control how to allocate and use the space in the segment
ASSM: You only need to control one parameter, pctfree. Other parameters will be ignored even if they are built
(1) freelist
When using MSSM table space management, Oracle maintains blocks below HWM in freelist for free-space objects
freelist and freelistgroup do not exist at all in ASSM tablespaces and use this technique only in MSSM tablespaces
pctfree and pctused [2]
pctfree tells Oracle how much space should be left on the block for future updates
For MSSM, she controls when the block is put into freelist and when it is taken out of freelist.
If greater than pctfree, the block will be 1 straight on freelist
For ASSM, because ASSM does not use freelist at all. In ASSM, pctused will also be ignored.
But she still limits the ability to insert a new row into a block
Setting up pctfree properly helps reduce row migration
(3) initrans
The ASSMorMSSM parameter is still valid
The initialization size of the bulk transaction slot is specified by the object initrans


Related articles: