Is there a way not to display the password in the sys out when your korn shell script logs into sqlplus?
This is a common problem. i have seen it done before using sed and redirection but I dont know the syntax. Here is a thread I came across while searching. Hope this helps.
Two more suggestions:
1) You can echo the password to a sqlplus and use a here document:
echo $password | sqlplus username <<EOF
some SQL
EOF
2) You can use a named pipe:
mknod logon_credentials.sql p
chmod 600 logon_credentials.sql
echo "connect username/password" > logon_credentials.sql &
sqlplus /nolog <<EOF
@logon_credentials.sql
some SQL
EOF
rm logon.credentials.sql
I listed the following as a possible solution, but it is certainly not for every situation. If you use an OPS$ account, be sure to set REMOTE_OS_AUTHENT=FALSE in the init.ora to prevent remote OPS calls.
You can create an OPS$username account by performing the following steps:
Log into the Oracle database as the a user with DBA privs.
Type the following,
CREATE USER OPS$username IDENTIFIED EXTERNALLY;
where username matches your current UNIX login name.
Type the following:
GRANT CONNECT, <what ever other privs you want to grant> TO OPS$username;
This will allow you to access Oracle by simply typing,
sqlplus /
at the UNIX system prompt. No username or password needs to be specified. Thus the benefit and the risk.
Keith