Hi all,
I am a newbie.....am jus trying to connect to oracle thro a script, but not thro giving the username/password@server_name directly like
`$ORACLE_HOME/bin/sqlplus username/password@server_name
In the above line, once it is connected to Oracle, it shud ask me the username and password (during run time)......how can i do that.....
Thanks in advance
kriti
Use the shell script to collect the user/pass info as follows:
echo "Enter username: "
read USER
echo "Enter password: "
read PASS
sqlplus -s /NOLOG << EOF
connect ${USER}/${PASS}
<add sqlplus commands here like 'set pagesize 60 trimspool on'>
<do your sql statements here 'select/insert/etc.'>
exit
EOF
If you need to, have the shell script also prompt for the Oracle Connection info. Here I assumed that the current $ORACLE_SID value is good.
Hi,
Thanks a lot....can u kindly explain the code also.....bcoz wats the difference between sqlplus and sqlplus -s......
Thanks,
kriti :)
As saps19 said it means silent. You wont get all the startup information in your output, nor a "SQL>" prompt.