Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to pass username/pasword@dbname for sqlplus in unix shell script

Arun Natarajan-OCFeb 7 2013 — edited Feb 8 2013
Hi Friends,

I would like to use sqlplus in a shell script and i would like to passw the username , password and dbname as variable. so i developed a script but this is not working.


Please let me know how to do this?

.bash profile has ORACLE_HOME and ORACLE_SID set


#test.sh
--------------

$HOME/.bash_profile
export USERNAME=system
export PASSWORD=manager
export DBNAME=test

export CONNECT=$USERNAME/$PASSWORD@$DBNAME
sqlplus $CONNECT <<!
select name from v$database;
!

Error is :
ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [logon [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where <logon> ::= <username>[<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][<password>][@<connect_identifier>]


Regards,
DB
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2013
Added on Feb 7 2013
7 comments
6,262 views