oracle extent管理

 
 extent的管理方式:
  • For uniform extents, you can specify an extent size or use the default size of 1 MB. All extents in the tablespace are of this size. Locally managed temporary tablespaces can only use this type of allocation.

  • For automatically allocated extents, Oracle Database determines the optimal size of additional extents.

什么时候使用统一管理区什么时候使用系统管理区?

当一个表分配给他10M空间,每个区为10M时,即使表用了1k数据,也是占用了10m空间,所以系统管理区方式在这方面有优势,在容量利用和性能方面能有一个平衡。

另外根据实验可以发现对于大于64m的表可以使用8m的统一管理区方式,大多数操作系统1次IO为1M,对于大于1M的区分配(如8M)每次IO虽然是1M,但是两个区之间是连续的减少了磁盘寻区时间。

结论先写:

实验一、

SQL>  create tablespace ye datafile '+DATA'   size 100m uniform size 1m ;
Tablespace created.

SQL> create table ye(id int) tablespace ye;

Table created.

SQL> insert into ye values (1); 
com
1 row created.

SQL> mit;

Commit complete.

SQL> insert into ye select object_id from dba_objects; 87008 rows created. SQL> commit; Commit complete. SQL> select file_id,extent_id,block_id,blocks,bytes/1024 from dba_extents where segment_name='YE'; FILE_ID EXTENT_ID BLOCK_ID BLOCKS BYTES/1024 ---------- ---------- ---------- ---------- ---------- 8 0 128 128 1024 8 1 256 128 1024 8 2 384 128 1024

实验2:

SQL> create tablespace ye1 datafile '+DATA' size 100m autoextend on ;

Tablespace created.

SQL> create table ye1(id int) tablespace ye1;

Table created.

SQL> insert into ye1 select id from ye1;

261033 rows created.

SQL> insert into ye1 select id from ye1;

4176528 rows created.

SQL> commit;

Commit complete.

SQL> select file_id,extent_id,block_id,blocks,bytes/1024 from dba_extents where segment_name='YE1';

FILE_ID EXTENT_ID BLOCK_ID BLOCKS BYTES/1024
---------- ---------- ---------- ---------- ----------
9    0    128    8    64
9    1    136    8    64
9    2    144    8    64
9    3    152    8    64
9    4    160    8    64
9    5    168    8    64
9    6    176    8    64
9    7    184    8    64
9    8    192    8    64
9    9    200    8    64
9    10    208    8    64
9    11    216    8    64
9    12    224    8    64
9    13    232    8    64
9    14    240    8    64
9    15    248    8    64
9    16    256    128    1024
9    17    384    128    1024
9    18    512    128    1024
9    19    640    128    1024
9    20    768    128    1024
9    21    896    128    1024
9    22    1024    128    1024
9    23    1152    128    1024
9    24    1280    128    1024
9    25    1408    128    1024
9    26    1536    128    1024
9    27    1664    128    1024
9    28    1792    128    1024
9    29    1920    128    1024
9    30    2048    128    1024
9    31    2176    128    1024
9    32    2304    128    1024
9    33    2432    128    1024
9    34    2560    128    1024
9    35    2688    128    1024
9    36    2816    128    1024
9    37    2944    128    1024
9    38    3072    128    1024
9    39    3200    128    1024
9    40    3328    128    1024
9    41    3456    128    1024
9    42    3584    128    1024
9    43    3712    128    1024
9    44    3840    128    1024
9    45    3968    128    1024
9    46    4096    128    1024
9    47    4224    128    1024
9    48    4352    128    1024
9    49    4480    128    1024
9    50    4608    128    1024
9    51    4736    128    1024
9    52    4864    128    1024
9    53    4992    128    1024
9    54    5120    128    1024
9    55    5248    128    1024
9    56    5376    128    1024
9    57    5504    128    1024
9    58    5632    128    1024
9    59    5760    128    1024
9    60    5888    128    1024
9    61    6016    128    1024
9    62    6144    128    1024
9    63    6272    128    1024
9    64    6400    128    1024
9    65    6528    128    1024
9    66    6656    128    1024
9    67    6784    128    1024
9    68    6912    128    1024
9    69    7040    128    1024
9    70    7168    128    1024
9    71    7296    128    1024
9    72    7424    128    1024
9    73    7552    128    1024
9    74    7680    128    1024
9    75    7808    128    1024
9    76    7936    128    1024
9    77    8064    128    1024
9    78    8192    128    1024
9    79    8320 1024    8192
9    80    9344 1024    8192
9    81    10368 1024    8192
9    82    11392 1024    8192
9    83    12416 1024    8192

84 rows selected.

猜你喜欢

转载自www.cnblogs.com/huayng/p/9190523.html