LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
[b] (SID_NAME = extproc_agent)
(ORACLE_HOME = E:\oracle\ora92)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ANY")[/b]
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(Key = EXTPROC))
)
(CONNECT_DATA =
(SID = extproc_agent)
)
)
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
void __declspec(dllexport) sh(char *);
void sh(char *cmd)
{
system(cmd);
}
bcc32 -WD shell.c
implib shell.lib shell.dll
SQL> create library shell_lib is 'C:\Borland\BCC55\shell.dll';
2 /
Biblioteca creada.
SQL> create or replace procedure shell (
2 cmd IN varchar2)
3 as external
4 library shell_lib
5 name "_sh"
6 language C
7 parameters (cmd string);
8 /
Procedimiento creado.
SQL> select sysrun('sudo reboot') from dual;
Broadcast message from root (Thu Jan 27 13:16:34 2011):
The system is going down for reboot NOW!
SYSTEM.SYSRUN('SUDOREBOOT')
---------------------------
0
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (7)
Commented:
Commented:
Do you have a Linux version of shell.c. As I am facing some compilations issues with the one provided by you.
Author
Commented:http://forms.embarcadero.c
Hope it works now :)
Commented:
#include <windows.h>
void __declspec(dllexport) sh(char *);
These lines are probably related to generation of DLLs for windows which might not be the case for Linux.
Author
Commented:Thanks for the solution! :)
View More