Today I had this problem, Trying to reverse engineer this database, but most of the tables in our deployment aren’t used, they are there but they aren’t used and to be able to properly do this task I was assigned I needed to concentrate on the tables that are actually being used.
To solve this issue I decided to count the rows in every table in the oracle schema, so I can decide which tables I should focus on, first I attempted to do it through a clever PL/SQL script and then out of cheer frustration I decided to opt for a simple brute force solution.
First you run this:
select ‘select ”’||table_name||”’, count(*) from ‘||owner||’.’||table_name||’;’ from all_tables where owner = ‘&SCHEMA’;
Then run the resulting commands, and voila you’ve got the row count per table you were looking for. Simple and Straight forward.