It's all about the answers!

Ask a question

[closed] Commands to find count of tables and number of rows through command prompt in ORACLE database


meghana kaddu (217) | asked Jan 18, 4:14 a.m.
closed Jan 18, 4:28 a.m. by Ralph Schoon (63.1k33646)

Hello,


Please help me out in understanding the below commands.

1. To compare the count of tables in the databases, I used the below command

SELECT COUNT(table_name) FROM DBA_TABLES WHERE OWNER IN ('CONFIG','RICALM','RIDW','RIODS');

I got 0 results as I do not have any schemas created in the names of 'CONFIG','RICALM','RIDW','RIODS'.

Is these schemas present by default?

2. Replacing the command with the DB tablespace USER such as 'RM_DB_USER' 'QM_DB_USER','CCM_DB_USER,'JTS_DB_USER I was able to fetch the total table count.

SELECT COUNT(table_name) FROM DBA_TABLES WHERE OWNER IN ('JTS_DB_USER','RM_DB_USER','QM_DB_USER','CCM_DB_USER');

Is it a right way to fetch the table_name count?

3. The result is consistently 0 for both schema and user, regardless of the specific commands employed.

SELECT OWNER || '.' || TABLE_NAME AS TableNameOracle, NUM_ROWS AS RowCountOracle FROM DBA_TABLES WHERE OWNER IN ('CONFIG','RICALM','RIDW','RIODS') ORDER BY RowCountOracle DESC;

SELECT OWNER || '.' || TABLE_NAME AS TableNameOracle, NUM_ROWS AS RowCountOracle FROM DBA_TABLES WHERE OWNER IN ('JTS_DB_USER','RM_DB_USER','QM_DB_USER','CCM_DB_USER') ORDER BY RowCountOracle DESC;


Regards,
Meghana


The question has been closed for the following reason: "Question is off-topic or not relevant" by rschoon Jan 18, 4:28 a.m.