2014年9月22日 星期一

[Shell Script] How to execute SQL script file using sqlplus in shell script

exit | ${ORACLE_HOME}/bin/sqlplus -L -S <user>/<password>@<connect identifier> @abc.sql

notes:
  1. config ORACLE_HOME 
  2. -L = Attempts to log on just once, instead of reprompting on error. If you don't turn this flag on the script will hang on error like wrong login, wrong connect identifier
  3. -S = silent mode, suppresses the sqlplus banner, prompt, etc
  4. Exit command is for automatically exit sqlplus after running the sql script file, or you can put an exit (or quit) statement at the end of the sql script.
Evernote helps you remember everything and get organized effortlessly. Download Evernote.

沒有留言:

張貼留言