Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to start a Stored Procedure directly from Unix shell skript ?
norwoodthree_at_my-deja.com (NorwoodThree) wrote in message news:<ba03e2c.0303111125.46599b00_at_posting.google.com>...
> The best practice approach is to create a dbms_job.
With the demise of command line SQL+ in a near future version, this might actually be the only option left!!! How the heck are people gonna be able to include Unix scripts into their DB work remains to be seen... Oh well, I'm sure someone will "re-invent" SQL+ as a J2EE EJB, or some other crap!
>
> However, if you absolutely must use a UNIX script, here is an example:
>
> $ORACLE_HOME/bin/sqlplus -s /nolog << EOF
> connect / as sysdba
> SELECT count(*)
> FROM dba_tablespaces;
> exit;
> EOF
>
> Substitute the connect / as sysdba for username and password. It is
> not good practice to hardcode usernames and passwords in your Oracle
> scripts, so use your method of choice to obscure them.
This is actually my preferred solution, by far. And the one I always use. It is not a good idea to put a uid/pwd in a Unix command line. It shows to anyone who can do a "ps -ef" command. Not the best way to hide a pwd! And hiding "ps" itself like I've seen done in many places is totally unnecessary.
This is a much better way. The uid/pwd can be inside the script itself, which in turn can be "chown"'ed and "chmod"'ed so no one can read it. Beter yet: put all these scrips into a directory with only "x" access right granted to others. This way, no one can even "ls" the name of the script let alone read it! And no pwd anywhere in command line: just about as perfect as can get. Very well done.
Cheers
Nuno Souto
wizofoz2k_at_yahoo.com.au.nospam
Received on Tue Mar 11 2003 - 18:11:32 CST