-
Can you kick off a unix script from inside a PL/SQL program??
-
Yes.
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:
In 8.0.X,
$ make -f demo_rdbms.mk extproc_nocallback \
SHARED_LIBNAME=shell.so OBJS=shell.o
In 8.1.X,
$ make -f demo_rdbms.mk extproc_no_context \
SHARED_LIBNAME=shell.so OBJS=shell.o
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)
as external
name "name"
library shell_lib
language C
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|