 |
|
 |
Donald K. Burleson
Oracle Tips |
Re-setting PCTUSED based on row length
It is very important that the DBA understand how
the row length affects setting the values for PCTFREE and PCTUSED. You
want to set PCTFREE such that room is left on each block for row
expansion, and you want to set PCTUSED so that newly linked blocks have
enough room to accept rows.
Here we see the tradeoff between effective space
usage and performance. If you set PCTUSED to a high value, say 80, then a
block will quickly become available to accept new rows, but it will not
have room for a lot of rows before it becomes logically full again.
Remember the rule for PCTUSED. The lower the value for PCTUSED, the more
space will be available on each data block, and subsequent INSERTs will
run faster. The downside is that a block must be nearly empty before it
becomes eligible to accept new rows.
rem pctused.sql
set heading off;
set pages 9999;
set feedback off;
spool pctused.lst;
column db_block_size new_value blksz noprint
select value db_block_size from v$parameter where
name='db_block_size';
define spare_rows = 2;
select
' alter table '||owner||'.'||table_name||
' pctused '||least(round(100-((&spare_rows*avg_row_len)/(&blksz/10))),95)||
' '||
' pctfree '||greatest(round((&spare_rows*avg_row_len)/(&blksz/10)),5)||
';'
from
dba_tables
where
avg_row_len > 1
and
avg_row_len < .5*&blksz
and
table_name not in
(select table_name from dba_tab_columns b
where
data_type in ('RAW','LONG RAW','BLOB','CLOB','NCLOB')
)
order by
owner,
table_name
;
spool off;

|
|