Leave a Comment:
2 comments
Yipes.
Firstly, DON’T put username/password on the command line where any monkey who can type ‘ps -ef’ can see it.
Secondly, sqlplus is supposed to be interactive. If you are scripting SQL, look at perl (or python or php). Error/exception handling is much easier and you can keep the connection open for the entire script, avoiding any repeated sqlplus startup/logon/logoff.
Appreciate your hint, I second you that username/password cannot be disclosed, but here this was a simple narration to show how we can embed SQL inside shell, well in advance you can use external files to store username/password.
This objective was not to make any interactive scripts, instead to automate some DBA tasks by placing embedded sql in shell.
Reply