Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Question: running a SQLPlus script from the UNIX shell with passwords??
I don't like playing with hashvalues of users. What if they go to log in
while it is changed or something goes wrong and the hashvalue doesn't
get set back to it's original value? This might not be a problem, and
the script would probably execute very fast, but still I personally
aren't in favour of it.
Another method that is handy is to create a procedure, owned by the user who you need to run it as, and then execute that procedure. This will then run the script as that user. It is useful for granting privileges to other users, especially in 8i, when you don't have the owner's password.
Here is a sample:
sqlplus -s "/ as sysdba" << EOF
CREATE OR REPLACE
PROCEDURE $ora_user.dba_execute_as_me (sql_stmt VARCHAR2) IS
BEGIN
execute immediate sql_stmt;
END dba_execute_as_me;
/
spool /temp/dba_execute_as_me.log
exec $ora_user.dba_execute_as_me ( '$sql_stmt' ) ;
spool off
DROP PROCEDURE $ora_user.dba_execute_as_me ;
exit
EOF
DW wrote:
> My colleague has educated me - I need to script a process to pull the
> hash values out, store them, reset them to a known value, then log in
> and run the SQL, and then set the passwords back to the original
> values.
>
> I'll give that a whirl... ;)
>
Received on Wed Mar 09 2005 - 19:55:12 CST
![]() |
![]() |