Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Tricky question ... schema table row counts

Mike301Jun 5 2013 — edited Jun 5 2013
Hello friends n gurus...

Oracle: 11g
OS: Linux

I have this very tricky questions which I am trying to solve but not able to get definite answers...
I did search on google... otn etc but not luck with my requirement...

Schema statistics are not reliable so want to query dba_tables..

Q.
How to spool all table row count of a particular schema and also display table_name?

A.
I can display count easily in spool but not able to get table name beside count..
e.g.
Table_Name Count
tab1 200
tab2 500
tab3 300

with below I can get count but not able to figure out table_name display in result...
spool runme.sql

select 'select count(*) from '|| owner || '.' || table_name || ';' 
from dba_tables
where owner = 'user1'
order by table_name;

spool off
thanks
mike

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 3 2013
Added on Jun 5 2013
4 comments
337 views