How to Resolve ORA-03297 When Resizing a Datafile by Finding the Table Highwatermark
Doc ID 130866.1 REM Script is meant for Oracle version 9 and higher REM ----------------------------------------------- set serveroutput on exec dbms_output.enable(1000000); declare cursor c_dbfile is select f.tablespace_name,f.file_name,f.file_id,f.blocks,t.block_size ,decode(t.allocation_type,'UNIFORM',t.initial_extent/t.block_size,0) uni_extent ,decode(t.allocation_type,'UNIFORM',(128+(t.initial_extent/t.block_size)),128) file_min_size from dba_data_files f, dba_tablespaces t where f.tablespace_name = t.tablespace_name and t.status = 'ONLINE' order by f.tablespace_name,f.file_id; cursor c_freespace(v_file_id in number) is select block_id, block_id+blocks max_block from dba_free_space where file_id = v_file_id order by block_id desc; /* variables to check settings/values */ dummy number; checkval varchar2(10); block_correction1 number; block_correction2 number; /* running variable to show (possible) end-of-file */ file_min_block number; /* variables to ch