10 Steps to Create and Run a Sample External Procedure Program on Unix (Doc ID 312564.1)

Last updated on AUGUST 08, 2017

Applies to:

Oracle Net Services - Version 8.1.7.4.0 to 11.2.0.2 [Release 8.1.7 to 11.2]
PL/SQL - Version 9.0.1.0 and later
Information in this document applies to any platform.
Prerequisites: a C compiler (This note is written with Solaris, Linux, AIX, and HP compilers gcc and cc)

For AIX, the following packages or later need to be installed. If not, please have your Unix admin install them.
> rpm -qa | grep gcc
gcc-4.0.0-1
libgcc-4.0.0-1
gcc-c++-4.0.0-1


Goal

The goal of this document is to create a sample program that calls OS Commands from PL/SQL using extproc.

The Oracle demos for extproc depend on the scott schema being installed as well as the sample "emp" and "dept" tables being created.  Most customers do not choose to utilize either option (or both) at install time thereby resulting in no efficient way to test extproc and its configuration.

The information provided in this note is a quick way of testing extproc (or extproc32) and should work with all versions of Oracle on any platform. 

Only steps 6 and 7 are Operating System specific. If you are using a different OS, it is your responsibility to find and correctly use a C compiler and a link editor.  See the note in step 6.

 

Change to External Procedures from release 11g onwards.

The default configuration for external procedures does not require a network listener to work with Oracle Database and the extproc agent.
The extproc agent is spawned directly by Oracle Database and eliminates the risks that extproc might be spawned by Oracle Listener unexpectedly.
This default configuration is recommended for maximum security.
You can change the default configuration for external procedures and have the extproc agent spawned by Oracle Listener.

Having the extproc agent spawned by Oracle Listener is necessary if you use:

o Multi-threaded Agent

o Oracle Database in MTS mode on Microsoft Windows

o The AGENT clause of the LIBRARY specification or the AGENT IN clause of the PROCEDURE specification such that you can redirect external procedures to a different extproc agent.

Information on 11g changes can be found
http://download.oracle.com/docs/cd/E11882_01/network.112/e10836/advcfg.htm#NETAG1474

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms