Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Script for total number of rows
You should not be using analyze table compute statistics. Or writing a
script.
Use DBMS_STATS.GATHER_SCHEMA_STATS(ownname =>schema_name, CASCADE=>True)
It will do all the statistics for all tables and indexes in the schema. Something required by the Cost Based Optimizer (CBO).
Unless, of course, your instructor wants you to get the experience. In which case use dynamic SQL with a cursor.
Daniel Morgan
Pinaki wrote:
> Hi,
> I am a beginner in Oracle.I need a script that will show the
> total number of rows in all the tables in a specific schema.I can
> select the "NUM_ROWS" along with the table_names from user_tables but
> for that I have to run "Analyze table t compute statistics" for each
> table and I want to avoid doing that. Is there any way I can write a
> PL/SQL script that I can store in the database which will retrieve the
> information I want...
>
> Thanks,
> Pinaki
Received on Wed Apr 17 2002 - 16:28:39 CDT