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

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...