Shell script execute SQL file

In this tutorial, How do I use shell script execute SQL file on an Oracle DB? On the server running the shell script, you use a sqlplus command on the server.

You need to install Oracle client on server-run shell script. Example picture below

Shell script execute SQL file

Oracle Client is free, easy to install client software for connecting to Oracle databases.

For example shell script execute SQL file as below


CONNT=dbuser/password@connect_identifier #your env
sqlplus -s ${CONNT} <<EOF

if [ "${RSTATUS}" != "0" ]
  echo "Error"
  exit 100
  echo "success"
  exit 0

Thank you for reading page.

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.