Avatar of bibi92
bibi92Flag 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)
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

What do you mean by "number of lines"?  Do you mean number of rows?
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?anchorAnswerId=23716743#a23716743

Just run it for each schema and diff the results.
Avatar of johnsone
johnsone
Flag of United States of America image

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.
Avatar of bibi92
bibi92
Flag of France image

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
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo