原表6G大小,但是记录只有20W,该表中不存在LOB类型的字段
SQL> select bytes from dba_segments where segment_name='OCP_PROCESS_CCR_LOG';
BYTES
----------
6380584960
SQL> select count(*) from ocs.ocp_process_ccr_log ;
COUNT(*)
----------
201902
SQL> desc ocs.ocp_process_ccr_log ;
Name Type Nullable Default
----------------- ------------- -------- -------
SEQ_ID NUMBER
SESSION_ID VARCHAR2(100) Y
CMD_TYPE NUMBER(6) Y
CCR_REQUEST_TYPE NUMBER(1) Y
CCR_NUMBER NUMBER(8) Y
SOURCE_EVENT_TYPE NUMBER(9) Y
ORIGIN_HOST VARCHAR2(50) Y
BILLING_NBR VARCHAR2(30) Y
CREATED_TIME DATE Y
USED_UNIT NUMBER Y
CC_REQUEST_ACTION NUMBER Y
新创建一张表,CTAS,表比原来小得多了。
SQL> create table xigua_test tablespace TICKET_DATA03_TBS as select * from ocs.ocp_process_ccr_log ;
Table created.
SQL> select bytes from dba_segments where segment_name='XIGUA_TEST';
BYTES
----------
28311552
SQL> select count(*) from xigua_test;
COUNT(*)
----------
211403
这是日志表,定制了策略,删除15分钟之前的记录。理论上表占用的空间应该很小才对,现在却涨到了6G了,原本以为是高水位的问题,但结果发现不是。现在这个表还不断的增长之中,高水位之下空闲空间也不多。
SQL> set serveroutput on
SQL> declare
2 v_unformatted_blocks number;
3 v_unformatted_bytes number;
4 v_fs1_blocks number;
5 v_fs1_bytes number;
6 v_fs2_blocks number;
7 v_fs2_bytes number;
8 v_fs3_blocks number;
9 v_fs3_bytes number;
10 v_fs4_blocks number;
11 v_fs4_bytes number;
12 v_full_blocks number;
13 v_full_bytes number;
14 begin
15 dbms_space.space_usage (
16 'OCS',
17 'OCP_PROCESS_CCR_LOG',
18 'TABLE',
19 v_unformatted_blocks,
20 v_unformatted_bytes,
21 v_fs1_blocks,
22 v_fs1_bytes,
23 v_fs2_blocks,
24 v_fs2_bytes,
25 v_fs3_blocks,
26 v_fs3_bytes,
27 v_fs4_blocks,
28 v_fs4_bytes,
29 v_full_blocks,
30 v_full_bytes);
31 dbms_output.put_line('Unformatted Blocks = '||v_unformatted_blocks);
32 dbms_output.put_line('Blocks with 00-25% free space = '||v_fs1_blocks);
33 dbms_output.put_line('Blocks with 26-50% free space = '||v_fs2_blocks);
34 dbms_output.put_line('Blocks with 51-75% free space = '||v_fs3_blocks);
35 dbms_output.put_line('Blocks with 76-100% free space = '||v_fs4_blocks);
36 dbms_output.put_line('Full Blocks = '||v_full_blocks);
37 end;
38 /
Unformatted Blocks = 0
Blocks with 00-25% free space = 2
Blocks with 26-50% free space = 1
Blocks with 51-75% free space = 9
Blocks with 76-100% free space = 561
Full Blocks = 775902
PL/SQL procedure successfully completed
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10867315/viewspace-670609/
,如需转载,请注明出处,否则将追究法律责任。