Sqlplus login error when using bash variables SP2-0306 Invalid option

0 votes

I have a bash script that connects to an oracle 10g database.

In a first step it takes some variables from a "config" file with the following command

. /path/to/my/configfile.ini

In the config file there are some variables:

export USRID=myUser
export USRID_PASS=myPassword
export USR_PASS="$USRID/$USRID_PASS@myDatabase"

Then it actually connects through sqlplus using the command:

sqlplus -s $usr_pass

Terrible Security and Design issues aside (this script has been around for 5 years). This is actually doing its job in one of our UNIX servers, but not in another.

When I run the script with bash -x, I can see that the command expanded to:

sqlplus -s myUser/myPassword@myDatabase

...which should do fine (and is actually working in one server), but the response in the failing server is:

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

SP2-0306: Invalid option. Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] where ::= [/][@] | SP2-0306: Invalid option.

I'm guessing it has to do more with bash than with oracle, but I'm no bash expert. Is there some configuration or detail I'm missing?

EDIT:

Trying to pin down the problem a bit more, I'm now running two versions of the script in a third development server, and in different tests, the login works if i do it with:

sqlplus -s $usrid/$usrid_pass@myDatabase

but not when i try:

sqlplus -s $usr_pass

So its a bit annoying.

Besides that, i'll have to check on te config file synchronization process... I'll let you know when i get to something new. Thanks everybody.

Jun 22 in Linux Administration by Korak
• 5,820 points
8 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Linux Administration

0 votes
2 answers

how to loop through the content of a file using bash

#!/bin/bash for i in  `cat peptides.txt` do echo $i done READ MORE

answered Sep 5, 2020 in Linux Administration by Prakash K. Aithal
1,680 views
0 votes
1 answer

Error when trying to install a few packages on ubuntu

Try executing the following commands and try ...READ MORE

answered Mar 15, 2019 in Linux Administration by Jobin
793 views
0 votes
1 answer

redirecting stdout and stderr to file using bash

cmd >>file.txt 2>&1 Bash always executes and redirects ...READ MORE

answered Mar 19, 2019 in Linux Administration by ajs3033
• 7,280 points
2,502 views
0 votes
1 answer

Error saying " Invalid operation uninstall" on sudo apt uninstall apache2

Try this: sudo apt-get cpufrequtils is missing a mandatory ...READ MORE

answered May 14, 2019 in Linux Administration by Yesha
7,503 views
0 votes
1 answer

Comparing two string variables in an 'if' statement in Bash

1. For string comparison, use: if [ "$s1" ...READ MORE

answered May 15, 2019 in Linux Administration by Shubham
• 13,490 points
348 views
0 votes
1 answer

pipe to clipboard using Bash

Try xclip; xclip - command line interface to ...READ MORE

answered Jun 17, 2019 in Linux Administration by Shubham
• 13,490 points
379 views
0 votes
1 answer

Using shell variables in an awk script

Using -v is, imo, The best way because ...READ MORE

answered Jul 1, 2019 in Linux Administration by Shubham
• 13,490 points
1,340 views
0 votes
1 answer

copy and create destination directory using bash

mkdir -p "$d" && cp file "$d" try ...READ MORE

answered Jul 16, 2019 in Linux Administration by Upasana
• 8,620 points
314 views
0 votes
1 answer

Proxy Error the proxy server received an invalid response from an upstream server.

Hi@akhtar, I think you did not configure your ...READ MORE

answered Apr 22, 2020 in Linux Administration by MD
• 95,360 points
1,940 views
0 votes
0 answers

What exactly does the Unix `bash` command do when run without options?

When you type bash into the terminal ...READ MORE

Apr 14 in Linux Administration by Soham
• 8,730 points
21 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP