Installing your ExtProc library on Oracle


  • Copy the binary to a directoy that O/S user 'oracle' has access to,  referred to below as <LIBDIR>.


  •   Log in to sqlplus as the appropriate user and create an Oracle library object:


  1. SQL> CREATE library libhostcmd AS '<LIBDIR>/libhostcmd.so';
  2. 2  /
  4. Library created.


Note that <LIBDIR> should be an absolute path and not the relative path.


  • Create a function to the library. This is the depricated way to do it (but I like it more):


  1. SQL> CREATE OR REPLACE FUNCTION hostcmd(p_cmd IN varchar2)
  2.      2  RETURN binary_integer
  3.      3  AS external name "hostcmd"
  4.      4  library libhostcmd
  5.      5  LANGUAGE C
  6.      6  parameters (p_cmd STRING, RETURN INT);
  7.      7  /
  8. FUNCTION created.


  • Set up access rights (Warning: see NOTES section below):


  1. SQL> GRANT execute ON hostcmd TO public;


  • Optional: Make a synonym if you have the privileges


  1. SQL> CREATE public synonym hostcmd FOR hostcmd


The binary does not actually need to exist when the library object is created. Binding to the binary library file only occurs at run time.