Skip to Main Content
  • Questions
  • execute operating system command from pl/sql

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, rams.

Asked: December 11, 2000 - 1:14 am UTC

Last updated: December 11, 2000 - 1:14 am UTC

Version: 8i with linux

Viewed 1000+ times

You Asked

Hai Tom
I want to execute linux os commands from pl/sql.
if possible please give me good suggestion with examples.
How to use ftp process in pl/sql and How to
solve RPC error also . I am awaiting for your reply.

Thanks and Regards
Rams.R

and Tom said...

see
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:150612348067 http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:952229840241 <code>
for methods on how to run system commands from inside the database.

As for the RPC error -- that would be due to "mis configured" tns or listener.ora files.

You need to setup the listener.ora and tnsnames.ora file for extprocs.

Here is a sample listener.ora file:

----------------------------------------------------
LISTENER =
(ADDRESS_LIST =
(ADDRESS=(PROTOCOL=IPC)(KEY=oracle81.world))
(ADDRESS=(PROTOCOL=TCP)(Host=sheepdog)(Port=1521))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME=sheepdog.us.oracle.com)
(ORACLE_HOME= /d01/home/oracle81)
(SID_NAME = oracle81)
)
(SID_DESC =
(SID_NAME = extproc)
(ORACLE_HOME = /d01/home/oracle81)
(PROGRAM = extproc)
)
)
STARTUP_WAIT_TIME_LISTENER = 0
CONNECT_TIMEOUT_LISTENER = 10
----------------------------------------------------


The important things in the listener file for extprocs:

o ADDRESS=(PROTOCOL=IPC)(KEY=oracle81.world))

set up an IPC based listener. remember the value of the KEY= (you can make it
whatever you want, just remember what it is)

o (SID_DESC=(SID_NAME=extproc)

remember that SID_NAME, call it extproc.


The next file is the tnsnames.ora file, it needs an entry like:

---------------------------------------------------
extproc_connection_data =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = oracle81.world))
(CONNECT_DATA = (SID = extproc))
)
--------------------------------------------------

Important things:

o (ADDRESS = (PROTOCOL = IPC)(KEY = oracle81.world))

should be the same as was in the listener.ora file....

o (CONNECT_DATA = (SID = extproc))

the sid must match the sid in the (SID_DESC=(SID_NAME=extproc) from the
listener.ora....



Also, if your sqlnet.ora specifies some default domain, it needs to be on the
tnsnames entry. So if you have a sqlnet.ora with stuff like:

sqlnet.authentication_services=(none)
names.directory_path = (TNSNAMES, HOSTNAME)
names.default_domain = world
name.default_zone = world
automatic_ipc = off


in it, that would be extproc_connection_data.world -- not just
extproc_connection_data.





Is this answer out of date? If it is, please let us know via a Comment