oracle - Sqlplus login error when using bash variables: SP2-0306: Invalid option -
i have bash script connects oracle 10g database.
in first step takes variables "config" file following command
. /path/to/my/configfile.ini
in config file there variables:
export usrid=myuser export usrid_pass=mypassword export usr_pass="$usrid/$usrid_pass@mydatabase"
then connects through sqlplus using command:
sqlplus -s $usr_pass
terrible security , design issues aside (this script has been around 5 years). doing job in 1 of our unix servers, not in another.
when run script bash -x
, can see command expanded to:
sqlplus -s myuser/mypassword@mydatabase
...which should fine (and working in 1 server), response in failing server is:
error: ora-01017: invalid username/password; logon denied
sp2-0306: invalid option. usage: conn[ect] [logon] [as {sysdba|sysoper}] ::= [/][@] | sp2-0306: invalid option.
i'm guessing has more bash oracle, i'm no bash expert. there configuration or detail i'm missing?
edit:
trying pin down problem bit more, i'm running 2 versions of script in third development server, , in different tests, login works if with:
sqlplus -s $usrid/$usrid_pass@mydatabase
but not when try:
sqlplus -s $usr_pass
so bit annoying.
besides that, i'll have check on te config file synchronization process... i'll let know when new. everybody.
the message pretty clear:
- you've contacted database
- the credentials supplied wrong
this indicates there isn't wrong client configuration.
so, leaves
- the user/pw combination wrong
- you've not contacted database think have
possibilites:
- make sure can connect credentials supplied command line.
- use tnsping mydatabase check host , instance you're contacting, verify it's correct. output command should tell host, port, , instance/service you're connecting to. if it's wrong, check tnsnames.ora file alias.
- as @omg ponies suggests, if you're using 11g, make sure case in passwords correct
Comments
Post a Comment