Can you kick off a unix script from inside a PL/SQL program??
1. Configure your listener properly. If you don't now how, ask you DBA. If he doesn't know ask here.
2. Same with tnsnames.ora
3. Build shared libraries for use in external procedures:
$ make -f demo_rdbms.mk extproc_nocallback \
$ make -f demo_rdbms.mk extproc_no_context \
4. Define the libraries:
CREATE LIBRARY shell_lib is '/u11/home/lsupport/proc/shell.so';
5. The PL/SQL should look something like:
create or replace procedure ala_bala(x in char)
parameters (x string);
you have 2 options, use external C procedure interacting with dbms_pipe, or Java Stored procedure
There is a third one with CSH and DBMS_PIPE, for that you have to search on Asktom.oracle.com
What about this?
I was thinking that I could create a procedure that excepts the script name as a in parameter,/u04/mywork/test.sh, and then using dynamic sql I would create a string that would host out of oracle. "host /u04/mywork/test.sh" and then execute it. I haven't tested it yet but I would think that if oracle had rights to that directory and script that it should work.
if you use dbms_output you will have a problem, if you build several commands they will executed all at the end, if you run it at runtime it wont work because host is a sql*plus command not sql
Click Here to Expand Forum to Full Width