dba_free_space小记

实验刚建立一个新的表空间数据文件时,dba_free_space值
  
SQL> create tablespace test datafile '/s01/orabase/oradata/mes/test01.dbf' size 5m autoextend off;

Tablespace created.

SQL> select * from dba_free_space where tablespace_name='TEST';

TABLESPACE_NAME                   FILE_ID   BLOCK_ID      BYTES     BLOCKS RELATIVE_FNO
------------------------------ ---------- ---------- ---------- ---------- ------------
TEST                                    5        128    4194304        512            5

SQL> 
SQL> select 4194304/1024/1024 from dual;

4194304/1024/1024
-----------------
                4


SQL> drop tablespace test including contents and datafiles;

Tablespace dropped.

SQL> 
SQL> create tablespace test datafile '/s01/orabase/oradata/mes/test01.dbf' size 20m autoextend off;

Tablespace created.

SQL> select * from dba_extents where tablespace_name='TEST';

no rows selected

SQL> select * from dba_free_space where tablespace_name='TEST';

TABLESPACE_NAME                   FILE_ID   BLOCK_ID      BYTES     BLOCKS RELATIVE_FNO
------------------------------ ---------- ---------- ---------- ---------- ------------
TEST                                    5        128   19922944       2432            5

SQL> select 19922944/1024/1024 from dual;

19922944/1024/1024
------------------
                19




SQL> drop tablespace test including contents and datafiles;

Tablespace dropped.

SQL> create tablespace test datafile '/s01/orabase/oradata/mes/test01.dbf' size 1g autoextend off;

Tablespace created.

SQL> select * from dba_free_space where tablespace_name='TEST';

TABLESPACE_NAME                   FILE_ID   BLOCK_ID      BYTES     BLOCKS RELATIVE_FNO
------------------------------ ---------- ---------- ---------- ---------- ------------
TEST                                    5        128 1072693248     130944            5

SQL> select 1072693248/1024/1024 from dual;

1072693248/1024/1024
--------------------
                1023


可以看到,文件刚创建,要使用1M的空间,dba_free_space文件为文件初始空间减去1M
请使用浏览器的分享功能分享到微信等