Querying database from unix

Hi,

I have a shell script to query the database to get the statistics of tables like sum,max,min,etc of all numeric columns,max and min of date columns and length of varchar columns for each and every table. There are nearly 1600 tables. My script queries few tables like about 100 tables and then hangs up. There is no progress. Can anyone tell me what the problem could be and a solution for it?

Ragav.

I assume you are logging in oracle database from unix by sqlplus command and once you enter to oracle database you run your sql query.

Hence the problem is with your query and certainly not a unix problem.Try to run your query from sqlplus directly and see the performance.you might need to tune query.

Your assumption is right.

Could there be any other issue because i was able to run the script completely sometimes and sometimes it hangs up.?

I think no :slight_smile:

Dhruva's explanation is right. You may try to see what is the wait event of the session when is "hung".

Or maybe the table is locked, but if you're doing only queries (no DML) this is not the case.