SQL Server数据库文件,自动扩展时最后剩余空间如果不满足扩展条件,系统不会自动再利用剩余容量,http://space.itpub.net/81227/viewspace-713277
以下测试在Oracle中是否也存在同样的问题。
SQL> conn / as sysdba
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
--创建一个初始10M,每次扩展30M,最大60M的表空间
SQL> create tablespace t_demo datafile '/home/oracle/oradata/zw/t_demo01.dbf' size 10M autoextend on next 30M maxsize 60M;
Tablespace created.
SQL> create table t_table as select * from dba_objects;
Table created.
SQL> alter table t_table move tablespace t_demo;
Table altered.
SQL> select FILE#,name ,BYTES ,BLOCKS,CREATE_BYTES,BLOCK_SIZE from v$datafile where file#=6;
FILE# NAME BYTES BLOCKS CREATE_BYTES BLOCK_SIZE
---------- ------------ ---------- ---------- ------------ ----------
6 t_demo01.dbf 10485760 1280 10485760 8192
SQL> insert into t_table select * from t_table;
72339 rows created.
SQL> select FILE#,name ,BYTES ,BLOCKS,CREATE_BYTES,BLOCK_SIZE from v$datafile where file#=6;
FILE# NAME BYTES BLOCKS CREATE_BYTES BLOCK_SIZE
---------- ------------ ---------- ---------- ------------ ----------
6 t_demo01.dbf 41943040 5120 10485760 8192
--此处扩展了30M,总容量为40M
SQL> insert into t_table select * from t_table;
144678 rows created.
SQL> select FILE#,name ,BYTES ,BLOCKS,CREATE_BYTES,BLOCK_SIZE from v$datafile where file#=6;
FILE# NAME BYTES BLOCKS CREATE_BYTES BLOCK_SIZE
---------- ------------ ---------- ---------- ------------ ----------
6 t_demo01.dbf 41943040 5120 10485760 8192
SQL> select segment_name,bytes from dba_segments where segment_name='T_TABLE';
SEGMENT_NAME BYTES
---------------- ----------
T_TABLE 34603008
SQL> insert into t_table select * from t_table;
insert into t_table select * from t_table
*
ERROR at line 1:
ORA-01653: unable to extend table SYS.T_TABLE by 128 in tablespace T_DEMO
SQL> select segment_name,bytes from dba_segments where segment_name='T_TABLE';
SEGMENT_NAME BYTES
---------------- ----------
T_TABLE 61865984
SQL> select FILE#,name ,BYTES ,BLOCKS,CREATE_BYTES,BLOCK_SIZE from v$datafile where file#=6;
FILE# NAME BYTES BLOCKS CREATE_BYTES BLOCK_SIZE
---------- ------------ ---------- ---------- ------------ ----------
6 t_demo01.dbf 62914560 7680 10485760 8192
--此处扩展了20M,总容量为60M
SQL> select 7680*8/1024 from dual;
7680*8/1024
-----------
60
在Oracle中,数据文件自动扩展,最后会充分利用剩余的可用空间,使数据文件大小达到设定的最大容量。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/81227/viewspace-713286/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/81227/viewspace-713286/