Avatar of GurcanK
GurcanK
 asked on

SQLPLUS hangs for a script ...

Dear experts,

I created an sql file running a series of analyze table and index rebuild commands for group of tables. When I run the script in Toad, it is OK. However, via sqlplus -s, it hangs at the middle of the operation.

An example run:

$ORACLE_HOME/bin/sqlplus -s xxx/yyy@zzz @/opt/app/table_statistics.sql

The system is Red-Hat Enterprise Linux with 64 GB of RAM, 4 Processors. How can I solve this problem?

BR,
Oracle DatabaseLinux OS DevLinux Distributions

Avatar of undefined
Last Comment
Milleniumaire

8/22/2022 - Mon
Milleniumaire

You will need to supply the script so that we can try to determine why it hangs.

One difference between Toad and Sqlplus is the way in which pl/sql blocks are run.  If you have a script containing a pl/sql block, ensure you place a forward slash "/" on the line following the block as it is this slash that tells sqlplus to run the pl/sql block.  I don't believe Toad requires this slash to run the block.

Have you tried running the script in sqlplus without the -s (silent) option so you can determine exactly where it hangs?
GurcanK

ASKER
Hi

The script is just a series of : analyze table <table name> compute statistics;

When I run manually in sqlplus, it again hangs.

BR,
Milleniumaire

Does it always hang at the same point in the script?  If so, can you provide a sample of the code causing it to hang?

Which version of Oracle are you using?

Are you aware that in later versions, DBMS_STATS is a better method of collecting statistics than using ANALYZE?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
GurcanK

ASKER
May I specify a time-out of a command in a script?
GurcanK

ASKER
The version of Oracle is 11g Release 2...
ASKER CERTIFIED SOLUTION
Milleniumaire

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.