Many times as a system administrator you will be requiring the need to check few db details time to time or need to update,insert or simply execute a sql file automatically. For all these requirements a simple solution is to script the execution of sql files. here in this example we will see how to run sql files from a folder to oracle DB using bash shell script.
For this pre-requisites is sqlplus client shall already be installed on the machine and shall be available. you can just run below command to make sure sqlplus client is installed. “sqlplus /nolog”. Make sure your tns entry is setup correctly and you are able to login to the database with the username and password.
Having said that below are the script details:
In this script we have kept all the sql files in a folder i.e. /home/oracle/sqls
Found Useful? +1 this post.