Avatar of bibi92
bibi92
Flag for France asked on

script to compare number of lines on all tables between two schémas

Hello,

I search a script to compare number of lines on all tables between two schémas.

Thank you

Best regards
Oracle Database

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)

8/22/2022 - Mon
slightwv (䄆 Netminder)

What do you mean by "number of lines"?  Do you mean number of rows?
slightwv (䄆 Netminder)

If you mean number of rows, you can use the SQL here:
https://www.experts-exchange.com/questions/24170132/List-tables-with-count-of-rows-in-Oracle-database.html#a23716743

Just run it for each schema and diff the results.
johnsone

Are your statistics up to date?  If they are, the dictionary is an easy way to check.
SELECT owner1.table_name, 
       owner1.table, 
       owner1.num_rows, 
       owner2.num_rows 
FROM   dba_tables owner1 
       join dba_tables owner2 
         ON owner1.table_name = owner2.table_name 
WHERE  owner1.owner = 'USER1' 
       AND owner2.owner = 'USER2'; 

Open in new window

I just typed that free hand and didn't try it, but it should be close.
Your help has saved me hundreds of hours of internet surfing.
fblack61
bibi92

ASKER
Hello,

I mean number of rows. I try already the post of slightwv but the result is not correct formatted.

Thank you

Best regards
ASKER CERTIFIED SOLUTION
slightwv (䄆 Netminder)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question