Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to hide sqlplus login/passwd
Andrey A. Kulaga wrote
>$ sqlplus -s scott/tiger @script.sql
To hide passwords from ps -ef when running SQL*Plus, use
echo scott/tiger | sqlplus -s @script.sql
or
echo tiger | sqlplus -s scott @script.sql
or
sqlplus -s scott @script.sql < scott.pwd > my_log.out
where the file scott.pwd just has one line (indeed: tiger) and is of course only readable for Scott. Or:
sqlplus -s @script.sql > my_log.out << EOF
scott
tiger
EOF
where the both EOFs could be replaced by anything, like 'MyMarker'
(search your Unix doc for "Here Documents"). Or:
sqlplus -s scott << EOF
tiger
begin
..
end;
/
EOF
echo "Exitcode: $?"
and even
COUNT=$( sqlplus -s scott << EOF
tiger
set pagesize 0
set feedback off
select count(*)
from user_tables;
EOF
)
echo "Count is: ${COUNT}"
Between the two EOFs the normal substitution is performed. Like:
USR=scott
PWD=tiger
COUNT=$( sqlplus -s ${USR} << EOF
${PWD}
set pagesize 0
set feedback off
select count(*)
from all_tables
where owner = upper( \'${USR}\' );
EOF
)
echo "Count for user ${USR} is: ${COUNT}"
Finally, if you want Scott to be identified by his Unix login, see your Oracle manuals for OPS$ users. This way, you don't need any password at all to use SQL*Plus.
Arjan. Received on Fri Dec 11 1998 - 00:00:00 CST
![]() |
![]() |