Table altered.
BYS@ bys3>select segment_name,tablespace_name,bytes,blocks,extents,initial_extent,next_extent from dba_segments where owner='BYS' and segment_name like 'TEST_';
SEGMENT_NAME TABLESPACE_NAME BYTES BLOCKS EXTENTS INITIAL_EXTENT NEXT_EXTENT
--------------- --------------- ---------- ---------- ---------- -------------- -----------
TEST1 TEST1 2228224 272 4 65536 1048576
TEST2 TEST2 2293760 280 56 40960 40960
实验二:一个表至少多大?
在ASSM下,一个区最少5个块。而一个普通堆表是一个段,一个段最少包含一个区,一个区最少包含5个块,所以当表空间block是8K时,表至少40K。
实验如下:
BYS@ bys3>create tablespace test2 datafile '/u01/oradata/bys3/test2.dbf' size 10m uniform size 32k;
create tablespace test2 datafile '/u01/oradata/bys3/test2.dbf' size 10m uniform size 32k
*
ERROR at line 1:
ORA-03249: Uniform size for auto segment space managed tablespace should have atleast 5 blocks
这一句报错信息可以看到,一个区需要至少5个数据块。
BYS@ bys3>create tablespace test2 datafile '/u01/oradata/bys3/test2.dbf' size 10m uniform size 40k;
Tablespace created.
BYS@ bys3>create table test16(bb int) tablespace test2 storage (initial 1k maxextents 1);
Table created.
BYS@ bys3>insert into test16 values(999);
1 row created.
BYS@ bys3>commit;
Commit complete.
BYS@ bys3>select a.SEGMENT_NAME,a.bytes/1024 segment_byte,a.TABLESPACE_NAME,b.INITIAL_EXTENT,b.BLOCK_SIZE,b.ALLOCATION_TYPE from dba_segments a,dba_tablespaces b where a.owner='BYS' and a.segment_name like 'TEST1_' and a.tablespace_name=b.tablespace_name;
SEGMENT_NA SEGMENT_BYTE TABLESPACE_NAME INITIAL_EXTENT BLOCK_SIZE ALLOCATIO
---------- ------------ ------------------------------ -------------- ---------- ---------
TEST15 64 USERS 65536 8192 SYSTEM
TEST16 40 TEST2 40960 8192 UNIFORM
实验三:一个表空间有10个数据文件,在此表空间中创建一个大小100M的表,表的空间将如何分配到10个数据文件
将会平均分配到10个数据文件中。下面我建一个表空间包含四个数据文件,建一个表,初始化大小为20M,将平均分配到这4个数据文件中。BYS@ bys3>select a.tablespace_name,a.file_id,b.file_name,a.bytes/1024/1024 file_byte_mb from dba_free_space a,dba_data_files b where a.file_id=b.file_id and a.tablespace_name='TEST2';
TABLESPACE_NAME FILE_ID FILE_NAME FILE_BYTE_MB
------------------------------ ---------- ---------------------------------------- ------------
TEST2 7 /u01/oradata/bys3/test2.dbf 9.8828125
TEST2 8 /u01/oradata/bys3/test2_2.dbf 9.921875
TEST2 9 /u01/oradata/bys3/test2_3.dbf 9.921875
TEST2 10 /u01/oradata/bys3/test2_4.dbf 9.921875
BYS@ bys3>drop table test16 purge;
Table dropped.
BYS@ bys3>drop table test17 purge;
Table dropped.
BYS@ bys3>create table test17(aa int) tablespace test2 storage (initial 20m);
Table created.
BYS@ bys3>insert into test17 values(888);
1 row created.
BYS@ bys3>commit;
Commit complete.
col file_name for a30
col tablespace_name for a15
select a.tablespace_name,a.file_id,b.file_name,a.bytes/1024/1024 file_byte_mb from dba_free_space a,dba_data_files b where a.file_id=b.file_id and a.tablespace_name='TEST2';
TABLESPACE_NAME FILE_ID FILE_NAME FILE_BYTE_MB
------------------------------ ---------- ---------------------------------------- ------------
TEST2 7 /u01/oradata/bys3/test2.dbf 4.921875
TEST2 8 /u01/oradata/bys3/test2_2.dbf 4.921875
TEST2 9 /u01/oradata/bys3/test2_3.dbf 4.921875
TEST2 10 /u01/oradata/bys3/test2_4.d