Home » Infrastructure » Unix » Echo password to sql*plus (Solaris 8, sqlplus 9.2.0.1.0)
Echo password to sql*plus [message #528455] Tue, 25 October 2011 01:58 Go to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
Hi all,

I'm trying to find an easy way to have a a unix script to call sqlplus and log onto the database, however I'm sure you'll realise that this leaves the password knocking about in ps.

I know that I can do this for batches to avoid it

echo $PW | sqlplus $USER


But if I execute that above to simply make an ad-hoc session it exits immediately, is there any easy way around this?

Basically trying to save myself some trouble typing the passwords all the time but masking it from the PS list.
Re: Echo password to sql*plus [message #528458 is a reply to message #528455] Tue, 25 October 2011 02:02 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Read the following topic: how to hide password in script.

Regards
Michel
Re: Echo password to sql*plus [message #528460 is a reply to message #528458] Tue, 25 October 2011 02:03 Go to previous messageGo to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
Thanks I searched for echo password, perhaps too generic. Hard to search when you're not sure what to search for though Smile

cheers
Re: Echo password to sql*plus [message #534789 is a reply to message #528460] Fri, 09 December 2011 04:02 Go to previous message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
I should really have followed up on this earlier.

I went for a program doing this:

cat >~/sql/pwtmp.sql<< EOF
conn $UNAME/$ORA_USER_PW
@login
EOF
chmod 700 ~/sql/pwtmp.sql
sqlplus /nolog @pwtmp.sql
#rm ~/sql/pwtmp.sql


Not perfect, but good enough for my needs.

Just leaves

sqlplus /nolog @pwtmp.sql


on a ps -ef execution.

[Updated on: Fri, 09 December 2011 04:02]

Report message to a moderator

Previous Topic: 10.2.0.1.0 Installation error
Next Topic: DBCA cannot be started
Goto Forum:
  


Current Time: Sat Nov 23 20:18:21 CST 2024