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.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM