Linux Operating System (MOSC)

MOSC Banner

Commands in a script do not wait for previous to finish

edited Aug 21, 2024 12:27AM in Linux Operating System (MOSC) 7 commentsAnswered

I have a .sh script that does the following, among others.
The purpose is to refresh some schemas on an Oracle database from a dmp file.

sqlplus / as sysdba @$scriptsPath/DBshutstart_restr.sql
sqlplus / as sysdba @$scriptsPath/reset_user.sql

The first command runs a script to shutdown the database and startup restrict;
The second command drops the schemas that will be updated.

Now sometimes the first command takes long to execute and the second command starts before the first is completed. Therefore sometimes I'm getting the error:
ORA-01940: cannot drop a user that is currently connected

How can I make the second command start only when the first is completed?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center