Rdbms server comes into picture when oracle allocates space to a segment (like a table or index), or when a group of contiguous free blocks, called an extent, is added to the segment. Metadata regarding extent allocation and unallocated extents are either stored in the data dictionary, or in the tablespace itself. Tablespaces that record extent allocation in the dictionary, are called dictionary managed tablespaces, and tablespaces that record extent allocation in the tablespace header, are called LOCALLY MANAGED TABLESPACES.
Sql> select tablespace_name, extent_management, allocation_type from dba_tablespaces;
Tablespace_name extent_man allocation
—————— ————— ——————-
System dictionary user
Sys_undots local system
Temp local uniform
Dictionary managed tablespaces (dmt):
Oracle use the DATA DICTIONARY (tables in the sys schema) to track allocated and free extents for tablespaces that is in “dictionary managed” mode. Free space is recorded in the sys.fet$ table, and used space in the sys.uet$ table. Whenever space is required in one of these tablespaces, the st (space transaction) enqueue latch must be obtained to do inserts and deletes agianst these tables. As only one process can acquire the st enque at a given time, this often lead to contention.
Execute the following statement to create a dictionary managed tablespace:
Sql> create tablespace ts1 datafile '/oradata/ts1_01.dbf' size 50m Extent management dictionary default storage (initial 50k next 50k minextents 2 maxextents 50 pctincrease 0);
Locally managed tablespaces (lmt):
Using lmt, each tablespace manages it’s own free and used space within a bitmap structure stored in one of the tablespace’s data files. Each bit corresponds to a database block or group of blocks. Execute one of the following statements to create a locally managed tablespace:
Sql> create tablespace ts2 datafile '/oradata/ts2_01.dbf' size 50m Extent management local autoallocate; Sql> create tablespace ts3 datafile '/oradata/ts3_01.dbf' size 50m Extent management local uniform size 128k;
Note the difference between autoallocate and uniform size:
Autoallocate specifies that extent sizes are system managed. Oracle will choose “optimal” next extent sizes starting with 64kb. As the segment grows larger, extent sizes will increase to 1mb, 8mb, and eventually to 64mb. This is the recommended option for a low or unmanaged environment.
Uniform specifies that the tablespace is managed with uniform extents of size bytes (use k or m to specify the extent size in kilobytes or megabytes). The default size is 1m. The uniform extent size of a locally managed tablespace cannot be overridden when a schema object, such as a table or an index, is created.
Also note, if you specify, local, you cannot specify default storage, minimum extent or temporary.
Advantages of locally managed tablespaces:
Locally managed system tablespace:
From oracle9i release 9.2 one can change the system tablespace to locally managed. Further, if you create a database with dbca (database configuration assistant), it will have a locally managed system tablespace by default. The following restrictions apply:
Thus, it is best only to convert the system tablespace to lmt after all other tablespaces are migrated to lmt.
Segment space management in lmt:
From oracle 9i, one cannot only have bitmap managed tablespaces, but also bitmap managed segments when setting segment space management to auto for a tablespace. Look at this example:
Sql> create tablespace ts4 datafile '/oradata/ts4_01.dbf' size 50m Extent management local segment space management auto;
Segment space management eliminates the need to specify and tune the pctused, freelists, and freelists groups storage parameters for schema objects. The automatic segment space management feature improves the performance of concurrent dml operations significantly since different parts of the bitmap can be used simultaneously, by eliminating serialization for free space lookups against the freelsits. This is of particular importance when using rac, or if “buffer busy waits” are deleted.
Convert between lmt and dmt:
The dbms_space_admin package allows dbas to quickly and easily convert between lmt and dmt mode. Look at these examples:
Pl/sql procedure successfully completed.
Pl/sql procedure successfully completed.
Get Updates on Tech posts, Interview & Certification questions and training schedules