Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Question: running a SQLPlus script from the UNIX shell with passwords??

Re: Question: running a SQLPlus script from the UNIX shell with passwords??

From: <lambu999_at_yahoo.com>
Date: 9 Mar 2005 20:58:27 -0800
Message-ID: <1110430707.758547.176660@o13g2000cwo.googlegroups.com>


Snewber,

Thanks for sharing your method. Arent we giving the power of SYSDBA to the user for a fleeting moment. One day some user may find out when they run this particular piece of code they can update any table, which in turn can lead to possible issues?

Thanks,
Ram.

Snewber wrote:
> 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
>
Received on Wed Mar 09 2005 - 22:58:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US