Oracle本地管理对比数据字典管理表空间

Locally vs. Dictionary Managed Tablespaces

整理自:http://www.orafaq.com/node/3.

When Oracleallocates space to a segment (like a table or index), a group of contiguousfree blocks, called an extent, is added to the segment. Metadata regardingextent allocation and unallocated extents are either
stored in the datadictionary, or in the tablespace itself. Tablespaces that record extentallocation in the dictionary, are called dictionary managed tablespaces, andtablespaces that record extent allocation in the tablespace header, are calledlocally managed
tablespaces.

表空间分配段空间,即区:一组连续的块。表空间关于区分配的信息被存于数据字典(DMT)或表空间自身(LMT)位图区

查看数据库中表空间管理方式:

SQL> select tablespace_name,extent_management, allocation_type from dba_tablespaces;

TABLESPACE_NAME                EXTENT_MAN ALLOCATIO

------------------------------ -------------------

SYSTEM                         DICTIONARY USER

SYS_UNDOTS                     LOCAL      SYSTEM

TEMP                           LOCAL      UNIFORM

DictionaryManaged Tablespaces (DMT):

Oracle use thedata dictionary (tables in the SYS schema) to track allocated and free extentsfor tablespaces that is in "dictionary managed" mode. Free space isrecorded in the SYS.FET$ table, and used space in the
SYS.UET$ table. Wheneverspace 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 leadto contention(竞争).

使用数据字典管理区分配。空闲空间被记录在SYS.FET$表中,已使用空间记录在SYS.UET$表。

Execute thefollowing 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 50KMINEXTENTS 2 MAXEXTENTS 50 PCTINCREASE 0);

Locally ManagedTablespaces (LMT):

Using LMT, eachtablespace manages it‘s own free and used space within a bitmap structurestored in one of the tablespace‘s data files. Each bit corresponds to adatabase block or group of blocks. Execute one of the
following statements tocreate a locally managed

tablespace:

注意:在Oracle920中,默认系统表空间是local管理,因此不能在数据库中建立数据字典管理的表空间。

如果想要建立数据字典管理的表空间,必须在建立数据库时,将系统表空间改为数据字典管理才可以。

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 differencebetween AUTOALLOCATE and UNIFORM SIZE:  注意AUTOALLOCATE与UNIFORM
SIZE选项区别!

AUTOALLOCATEspecifies that extent sizes are system managed. Oracle will choose"optimal" next extent sizes starting with 64KB. As the segment growslarger extent sizes will increase to 1MB, 8MB, and eventually to 64MB.
This isthe recommended option for a low or unmanaged environment.

UNIFORMspecifies 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 defaultsize is 1M. The uniform extent size of a locally managed
tablespace cannot beoverridden when a schema object, such as a table or an index, is created.

Also not, if youspecify, LOCAL, you cannot specify DEFAULT STORAGE, MINIMUM EXTENT orTEMPORARY.

如果是本地管理表空间则不可以指定DEFAULT STORAGE与MINIMUM EXTENT或TEMPORARY选项。

Advantages ofLocally Managed Tablespaces: 本地管理优势:

  • Eliminates the need for recursive SQL operations against the data dictionary (UET$ and FET$ tables)  消除对于数据字典表的递归SQL操作。
  • Reduce contention on data dictionary tables (single ST enqueue)   减少对数据字典表的争用。
  • Locally managed tablespaces eliminate the need to periodically coalesce free space (automatically tracks adjacent free space)   不需要定期合并空闲空间。
  • Changes to the extent bitmaps do not generate rollback information   对于位图区的改变不会产生回滚信息。

Locally ManagedSYSTEM Tablespace:

From Oracle9irelease 9.2 one can change the SYSTEM tablespace to locally managed. Further, ifyou create a database with DBCA (Database Configuration Assistant), it willhave a locally managed SYSTEM tablespace by default.
The following restrictionsapply:

  • No dictionary-managed tablespace in the database can be READ WRITE.
  • You cannot create new dictionary managed tablespaces
  • You cannot convert any dictionary managed tablespaces to local

Thus, it is bestonly to convert the SYSTEM tablespace to LMT after

all other tablespaces are migrated to LMT.

自920后数据字典管理表空间已被废弃!

Segment SpaceManagement in LMT: 本地管理表空间中的段管理

From Oracle 9i,one can not only have bitmap managed tablespaces, but also bitmap managedsegments when setting Segment Space Management to AUTO for a tablespace. Lookat this example:设置段自动管理

SQL> CREATE TABLESPACE ts4 DATAFILE ‘/oradata/ts4_01.dbf‘SIZE 50M

EXTENT MANAGEMENT LOCAL

SEGMENT SPACE MANAGEMENT AUTO;

Segment SpaceManagement eliminates the need to specify and tune the PCTUSED, FREELISTS, andFREELISTS GROUPS storage parameters for schema objects. The Automatic SegmentSpace Management feature improves the performance
of concurrent DML operationssignificantly since different parts of the bitmap can be used simultaneouslyeliminating serialization for free space lookups against the FREELSITS. This isof particular importance when using RAC, or if "buffer busy waits"are deteted.

Convert betweenLMT and DMT:
本地管理与数据字典管理表空间转换

TheDBMS_SPACE_ADMIN package allows DBAs to quickly and easily

convert between LMT and DMT mode. Look at these examples:

SQL> exec dbms_space_admin.Tablespace_Migrate_TO_Local(‘ts1‘);

PL/SQL procedure successfully completed.

SQL> execdbms_space_admin.Tablespace_Migrate_FROM_Local(‘ts2‘);

PL/SQL procedure successfully completed.

---------------------------

Dylan Presents.

时间: 2024-08-24 12:49:31

Oracle本地管理对比数据字典管理表空间的相关文章

Oracle本地管理对照数据字典管理表空间

Locally vs. Dictionary Managed Tablespaces 整理自:http://www.orafaq.com/node/3. When Oracleallocates space to a segment (like a table or index), a group of contiguousfree blocks, called an extent, is added to the segment. Metadata regardingextent alloca

[独孤九剑]Oracle知识点梳理(一)表空间、用户

1.表空间 Oracle 的结构是 区/段.表空间.用户.表...(区段是Oracle存储方面的概念,编码人员不需要了解过多).当我们安装完Oracle后,默认就会拥有一个数据库,之后的所有操作,都是在这个默认的数据库中进行的. 注: 这里要与SqlServer的数据库(database)概念区别开,SqlServer中的数据库是我们最常操作的,给我们的印象是每个数据库是相互隔离的,不同用户(user)登录后可看到所有数据库并进行操作:而Oracle中我们的操作都是在同一个数据库(databas

Oracle在PLSQL Developer上创建表空间和用户脚本

oracle数据库还原,如何将dmp文件还原到oralce库 最近用到从oracle的dmp文件中还原数据 由于没有这方面的资料,在网上搜集了一些,相信有以下这些资料,我们可以成功地将dmp文件用命令行的方式还原回去 在这里我用的是oracle10g的版本,我的机器是512内存的,运行oracle的web管理程序有一些困难,所以我选择通过命令行的方式, 以下我的安装完成后,oracle给出的报告 Enterprise Manager Database Control URL - (orcl) :

(总结)Oracle 11g常用管理命令(用户、表空间、权限)

1.启动oracle数据库: 从root切换到oracle用户进入:su - oracle 进入sqlplus环境,nolog参数表示不登录:sqlplus /nolog 以管理员模式登录:sqlplus / as sysdba 启动数据库startup;停止数据库shutdown immediate远程连接数据库sqlplus /nologconn sys/[email protected]:1521/orainstance as sysdba也可以直接运行:dbstart#启动数据库的脚本d

【oracle11g,13】表空间管理2:undo表空间管理(调优) ,闪回原理

一.undo空间原理: dml操作会产生undo数据. update时,sever process 会在databuffer 中找到该记录的buffer块,没有就从datafile中找并读入data buffer.在修改之前,原始数据先放到undo段,并在数据块头记录undo段(acitve 状态)中该数据块的位置,读写这个块时会占用事务槽,会将该事务号记录在数据块的头部.然后在进行update,并将该块放到dirty list检查点队列,等待dbwr进行写操作. 二.创建新的undo表空间替换

Oracle 高水位说明和释放表空间,加快表的查询速度

高水位的介绍 数据库运行了一段时间,经过一些列的删除.插入.更改操作有些表的高水位线就有可能和实际的表存储数据的情况相差特别多,为了提高检索该表的效率,建议对这些表进行收缩: 查找高水位线的表 查找表需要的存储空间:表以数据块的形式存储在数据文件中,表的存储结构是:行×行数,如果知道了总共有多少行,每行的平均长度,两者相乘,再除于90%的使用率,那么就可以知道实际需要存储的空间: 表的存储结构; 从统计信息得出平均每行的长度和总共的行数,从而知道存储的SIZE: 查找表实际存储的空间:数据实际存

oracle下的数据库实例、表空间、用户及其表的区分

oracle数据库组成: 由oracle数据库和数据库实例两部分组成: 数据库是指一系列数据文件的集合,数据库实例则是oracle后台进程/线程以及在服务器分配的共享内存区: 查询当前数据库名 1 SQL> select name from v$database; 2 3 NAME 4 --------- 5 ORCL 查询当前数据库实例名 数据库实例名(instance_name)用于对外部连接.在操作系统中要取得与数据库的联系,必须使用数据库实例名.比如我们作开发,要连接数据库,就得连接数据

oracle 创建用户和imp指定表空间

创建用户: 1,sqlplus sys/pwd as sysdba; 2, create user username identified by password; 3, grant dba,connect,resource to username; 查看表空间使用情况: SELECT UPPER(F.TABLESPACE_NAME) "表空间名", D.TOT_GROOTTE_MB "表空间大小(M)", D.TOT_GROOTTE_MB - F.TOTAL_BY

Oracle创建,删除用户与表空间

1.创建表空间与用户 a:创建数据表空间 create tablespace user_data logging datafile 'D:\oracle\product\10.2.0\oradata\Test\xyrj_data.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local; b:创建用户并指定表空间 create user username identified by password d