Monday, May 14, 2012

Query to Find the Row Count of Tables in the Database

During upgrade this query can be quite handy to find the Row Count of tables in the database.


set linesize 999
set pages 0
set trimspool on

spool D:\row_count_FSCM88_01_bfr_upgrade.txt
-- spool D:\row_count_FSCM91_02_afr_upgrade.txt


SELECT table_name, to_number(extractvalue(xmltype(dbms_xmlgen.getxml('select count(*) c from 'table_name)),'/ROWSET/ROW/C')) AS COUNT FROM DBA_TABLES WHERE table_name IN (SELECT TABLE_NAME FROM DBA_TABLES WHERE TABLE_NAME LIKE 'PS%')AND owner = 'SYSADM' GROUP BY table_name ORDER BY table_name
/


spool off

3 comments:

Unknown said...

Can't we use UPGCOUNT for this?

Rakesh Parwal said...

Yes we can use UPGCOUNT app engine but at times we may not be able to use it as it has PeopleTools dependency. Using the query eliminates PeopleTools dependency. This is particularly useful when you are having infrastructure upgrades along-with PeopleSoft upgrade and your new server do not have old version of PeopleTools installed in it...

Rocky Singhaal said...

This blog post help me a lot to find out the queries.Blogtipshub is the best source to get latest blog tips on how to blog, SEO, Marketing and so on.

OCI - Attach Block Volume to Windows VM

Tip: Although creating and attaching Block Storage to a Windows VM is pretty straightforward (OCI documentation is pretty good for that), th...