This script will count the rows of all tables from a schema (prod).
conn prod/pass
CREATE TABLE TABLECNT (TABLE_NAME VARCHAR2(40 CHAR), NUM_ROWS INTEGER);
declare row_cnt number;
begin
for x in (select table_name from user_tables order by table_name)
loop
execute immediate 'select count(*) from ' ||x.table_name into row_cnt;
insert into tablecnt values(x.table_name,row_cnt);
end loop;
end;
/
select * from TABLECNT order by NUM_ROWS desc;begin
for x in (select table_name from user_tables order by table_name)
loop
execute immediate 'select count(*) from ' ||x.table_name into row_cnt;
insert into tablecnt values(x.table_name,row_cnt);
end loop;
end;
/