set echo off;
set heading off;
set feedback off;
set termout off;
set echo off;
set VERIFY off;
set LINESIZE 1000;
SET NEWPAGE none


connect user/Password@service_odbc

spool c:\MoveTableStatsupbis.sql

select 'spool C:\MoveTableStatSupbis.log' from dual;



select 'alter table User.'||table_name ||' move tablespace TABLESPACE_DATA'|| CHR(10)
    ||'    INITRANS   1'|| CHR(10)
    ||'    STORAGE (    INITIAL        '||ROUND(num_rows * AVG_ROW_LEN*1.2/1024,-2)||'K'|| CHR(10)
    ||'            NEXT        '||ROUND(num_rows * AVG_ROW_LEN/20480,-1)||'K'|| CHR(10)
    ||'                MINEXTENTS       1'|| CHR(10)
    ||'                MAXEXTENTS       UNLIMITED'|| CHR(10)
    ||'                PCTINCREASE      0'|| CHR(10)
    ||'        ) ;' from user_tables where TABLESPACE_NAME= 'DATA_TABLESPACE' order by num_rows asc;

select 'spool off' from dual;
spool off

set serveroutput off




set VERIFY on;
set WRAP on;
set heading on;
set feedback on;
set termout on;
set echo on;
