Commands in a script do not wait for previous to finish
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?