这篇文章是对ORACLE空间管理实验2:区的管理与分配中实验四的一个补充。
具体还请到连接中查看和其中我的一个评论(在这里我就直接贴实验代码了):
SQL> create tablespace test1 datafile '/u01/app/oracle/oradata/normal/test01.dbf' size 10M;
Tablespace created.
SQL> alter tablespace test1 add datafile '/u01/app/oracle/oradata/normal/test02.dbf' size 20M;
Tablespace altered.
SQL> alter tablespace test1 add datafile '/u01/app/oracle/oradata/normal/test03.dbf' size 10M;
Tablespace altered.
SQL> 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='TEST1';
TABLESPACE_NAME FILE_ID FILE_NAME FILE_BYTE_MB
------------------------------ ---------- -------------------------------------------------- ------------
TEST1 10 /u01/app/oracle/oradata/normal/test02.dbf 19
TEST1 11 /u01/app/oracle/oradata/normal/test03.dbf 9
TEST1 9 /u01/app/oracle/oradata/normal/test01.dbf 9
SQL> create table t1 (id number) tablespace test1 storage(initial 10M);
Table created.
SQL> 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='TEST1';
TABLESPACE_NAME FILE_ID FILE_NAME FILE_BYTE_MB
------------------------------ ---------- -------------------------------------------------- ------------
TEST1 10 /u01/app/oracle/oradata/normal/test02.dbf 11
TEST1 11 /u01/app/oracle/oradata/normal/test03.dbf 8
TEST1 9 /u01/app/oracle/oradata/normal/test01.dbf 8
SQL> alter table t1 allocate extent(size 1M);
Table altered.
SQL> 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='TEST1';
TABLESPACE_NAME FILE_ID FILE_NAME FILE_BYTE_MB
------------------------------ ---------- -------------------------------------------------- ------------
TEST1 10 /u01/app/oracle/oradata/normal/test02.dbf 10
TEST1 11 /u01/app/oracle/oradata/normal/test03.dbf 8
TEST1 9 /u01/app/oracle/oradata/normal/test01.dbf 8
SQL> alter table t1 allocate extent(size 1M);
Table altered.
SQL> 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='TEST1';
TABLESPACE_NAME FILE_ID FILE_NAME FILE_BYTE_MB
------------------------------ ---------- -------------------------------------------------- ------------
TEST1 10 /u01/app/oracle/oradata/normal/test02.dbf 10
TEST1 11 /u01/app/oracle/oradata/normal/test03.dbf 7
TEST1 9 /u01/app/oracle/oradata/normal/test01.dbf 8
SQL> alter table t1 allocate extent(size 1M);
Table altered.
SQL> 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='TEST1';
TABLESPACE_NAME FILE_ID FILE_NAME FILE_BYTE_MB
------------------------------ ---------- -------------------------------------------------- ------------
TEST1 10 /u01/app/oracle/oradata/normal/test02.dbf 10
TEST1 11 /u01/app/oracle/oradata/normal/test03.dbf 7
TEST1 9 /u01/app/oracle/oradata/normal/test01.dbf 7
SQL> alter table t1 allocate extent(size 1M);
Table altered.
SQL> 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='TEST1';
TABLESPACE_NAME FILE_ID FILE_NAME FILE_BYTE_MB
------------------------------ ---------- -------------------------------------------------- ------------
TEST1 10 /u01/app/oracle/oradata/normal/test02.dbf 9
TEST1 11 /u01/app/oracle/oradata/normal/test03.dbf 7
TEST1 9 /u01/app/oracle/oradata/normal/test01.dbf 7