why i cannot use sqlplus schemaname/password to connect to the database

I have an oracle 10g database running. I want to connect to a specific schema in one command like below. It prompts me "event not found". If I use the "sqlplus" then input schema name and password step by step, it works great. How could I resolve this?


[oracle@lom-dbstg-01 ~]$ sqlplus SURVEYREPORTRESULTS/P!n3app!3
-bash: !n3app!3: event not found
[oracle@lom-dbstg-01 ~]$ sqlplus SURVEYREPORTRESULTS/P!n3app!3;
-bash: !n3app!3: event not found
[oracle@lom-dbstg-01 ~]$ ps -ef | grep pmon
oracle    4148     1  0 Oct15 ?        00:00:20 ora_pmon_esstg
oracle   27815 27763  0 20:06 pts/0    00:00:00 grep pmon
[oracle@lom-dbstg-01 ~]$ sqlplus SURVEYREPORTRESULTS/P!n3app!3@esstg;
-bash: !n3app!3@esstg: event not found
[oracle@lom-dbstg-01 ~]$ sqlplus SURVEYREPORTRESULTS/P!n3app!3@ora_pmon_esstg;
-bash: !n3app!3@ora_pmon_esstg: event not found
[oracle@lom-dbstg-01 ~]$ sqlplus

SQL*Plus: Release - Production on Wed Oct 28 20:07:37 2015

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release - Production
With the Partitioning, OLAP and Data Mining options


Open in new window

Jason YuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

johnsoneSenior Oracle DBACommented:
Your problem is the ! in the password.  The shell is interpreting that as a history command.  You need to escape that in the password.

A word of caution...

That is not the recommended way to connect to the database.  The reason is that with the username and password on the command line anyone has access to it with the ps command.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gerwin Jansen, EE MVETopic Advisor Commented:
To add to the 'escape' suggestion: use a single \ (backslash) before each ! in the password to perform the escape.

Changing the password to one without exclamation marks is also an option.
Jason YuAuthor Commented:
Thanks guys, I got it resolved by adding a backslash. You are the BEST :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.