|
|
最初由 matrix 发布
[B]husthxd 斑竹做的例子可能不能说明问题!
(我说的不知道对不对,见谅)因为你插入的数据不够多,没有使数据库的使用率达到pctfree所限定的值,
不是数据库的使用率,而是数据库块的使用率.以数据库块为单位
也就是说数据块还在freelist列表当中,且你每次删除数据都是整个表删除(表空间test只有一个表),这样从freelist中踢出的数据块也又会重新加入到freelist中,所有的数据块都是可用的。不会影响空间的使用。
我的情况是表空间test已经被我使用到报ORA-1653错误了,我的大部分的数据块可能都处于不可用状态(没在freelist中),而且我删除数据是有条件的,也就是说没有全部把表清空。可能清空后的比例还在pctused(40)之上。所以我即使删除了数据,也还是无法插入的,因为数据块是不可用的(没在freelist中)。
不知道我说的对不对?? [/B]
你的例子pctused为40,据文档所述,删除数据后已用数据库的空间小于40%的时候数据块才会重新进入freelist.
如下的实验pctused设置为1
SQL> alter table t_1 pctused 1
2 /
表已更改。
SQL>
SQL> truncate table t_1
2 /
表已截掉。
SQL> select segment_name,bytes/1024/1024,blocks from dba_segments
where segment_name = 'T_1'
2 /
SEGMENT_NAME
--------------------------------------------------------------------------------
BYTES/1024/1024 BLOCKS
--------------- ----------
T_1
.0390625 5
SQL> select tablespace_name,sum(bytes)/1024/1024,sum(blocks) from
dba_free_space
2 where tablespace_name = 'TEST' group by tablespace_name
3 /
TABLESPACE_NAME SUM(BYTES)/1024/1024 SUM(BLOCKS)
------------------------------ -------------------- -----------
TEST 9.953125 1274
SQL> select count(*) from t_1
2 /
COUNT(*)
----------
0
SQL> insert into t_1 select * from dba_objects
2 /
已创建24777行。
SQL> insert into t_1 select * from dba_objects
2 /
已创建24777行。
SQL> insert into t_1 select * from dba_objects where rownum < 200
00
2 /
已创建19999行。
SQL> commit
2 /
提交完成。
SQL> select count(*) from t_1
2 /
COUNT(*)
----------
69553
SQL>
SQL>
SQL>
SQL> select segment_name,bytes/1024/1024,blocks from dba_segments
where segment_name = 'T_1'
2 /
SEGMENT_NAME
--------------------------------------------------------------------------------
BYTES/1024/1024 BLOCKS
--------------- ----------
T_1
7.4609375 955
SQL> select tablespace_name,sum(bytes)/1024/1024,sum(blocks) from
dba_free_space
2 where tablespace_name = 'TEST' group by tablespace_name
3 /
TABLESPACE_NAME SUM(BYTES)/1024/1024 SUM(BLOCKS)
------------------------------ -------------------- -----------
TEST 2.53125 324
SQL> insert into t_1 select * from dba_objects where rownum < 500
2 /
insert into t_1 select * from dba_objects where rownum < 500
*
ERROR 位于第 1 行:
ORA-01653: 表TEST.T_1无法通过473(在表空间TEST中)扩展
SQL>
SQL> delete t_1 where rownum < 10000
2 /
已删除9999行。
SQL> commit;
提交完成。
SQL>
SQL> insert into t_1 select * from dba_objects where rownum < 980
0
2 /
已创建9799行。
SQL> insert into t_1 select * from dba_objects where rownum < 100
2 /
已创建99行。
SQL> /
已创建99行。
SQL> /
insert into t_1 select * from dba_objects where rownum < 100
*
ERROR 位于第 1 行:
ORA-01653: 表TEST.T_1无法通过473(在表空间TEST中)扩展
SQL> commit;
提交完成。
SQL> select count(*) from t_1
2 /
COUNT(*)
----------
69551
SQL>
根据条件删除后数据仍然可以插入.
你的情况还没有遇到过.可能的话把你的实验过程贴出来看看? |
|