How to Count Number of Tables and Views from Oracle and DB2

Several days ago i had a project that made me had to do data migration from DB2 to Oracle.
For validity check, i had to count number of tables and views from DB2 before migrated and number of tables and views on Oracle after ive migrate it.

Okay enough chit-chat, this is my queries.
Count DB2′s number of tables

Select Count(*) from syscat.tables
where tabschema = 'YOUR_SCHEMA_NAME' 
AND type = 'T'

And this is how to count DB2′s View numbers

Select Count(*) from syscat.tables
where tabschema = 'YOUR_SCHEMA_NAME' 
AND type = 'V'

This is how to count number of tables from Oracle

select owner, count(*) from dba_tables
where owner = 'YOUR_OWNER_NAME'
group by owner

And this is how to count number of views from Oracle

select owner, count(*) from dba_views
where owner = 'YOUR_OWNER_NAME'
group by owner

Hope it will help others,
cheers (D)

Google+

No Comments

Leave a Comment

Please be polite. We appreciate that.
Your email address will not be published and required fields are marked


:-[ (B) (^) (P) (@) (O) (D) :-S ;-( (C) (&) :-$ (E) (~) (K) (I) (L) (8) :-O (T) (G) (F) :-( (H) :-) (*) :-D (N) (Y) :-P (U) (W) ;-)