Home » RDBMS Server » Server Utilities » Executing sqlloader from sqlplus
Executing sqlloader from sqlplus [message #121380] Fri, 27 May 2005 18:36 Go to next message
caga_na_sakinha
Messages: 4
Registered: April 2005
Junior Member
Hi everyone,

when I execute sqloader from sqlplus, (i´ve created a procedure named "shell" to call external progs) the procedure completes successfully (no errors) but does nothing, meaning it doesnt load the values to my table.

using: exec shell('sqlldr user/pass refload.ctl')
when running the command on DOS prompt it works fine...

do you know why or how can i debug it???

thanks in advance for any help
take care
Re: Executing sqlloader from sqlplus [message #121386 is a reply to message #121380] Fri, 27 May 2005 21:27 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9097
Registered: November 2002
Location: California, USA
Senior Member
We would need to see the code of your shell procedure and know what permissions you have granted. Alternatively, are you aware that you can just use the HOST command to execute such things from SQL*Plus? For example:

SQL> HOST sqlldr user/pass control=refload.ctl
Re: Executing sqlloader from sqlplus [message #121418 is a reply to message #121386] Sat, 28 May 2005 13:52 Go to previous messageGo to next message
caga_na_sakinha
Messages: 4
Registered: April 2005
Junior Member
==============begin shell.c=================
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

void __declspec(dllexport) sh(char *);
void sh(char *cmd)
{
system(cmd);
}
============end shell.c======================
3) create shell_run.c (a test program)
=============begin shell_run.c===============
void __declspec(dllimport)ch (char*);

int main(int argc, char *argv[])
{
sh(argv[1]);
return 0;
}
============end shell_run.c==================
3) Create and run shell_compile.bat to compile and link shell and shell_run
============begin shell_compile.bat =========
bcc32 -WD shell.c
implib shell.lib shell.dll
bcc32 shell_run.c shell.lib
============end shell_compile.bat ===========

SQL> create library shell_lib is 'shell.dll';

SQL> create or replace procedure shell (
cmd IN varchar2)
as external
library shell_lib
name "_sh"
language C
parameters (
cmd string);
/

when I use this:
SQL> exec shell('any operating system command');

it gives me: procedure completed sucessfuly.

about using HOST, i was not aware of this, however i intent to use this shell procedure in a page from my ORACLE HTMLDB web application and i don't know if the HOST command can be executed there.

thanks again
Re: Executing sqlloader from sqlplus [message #121420 is a reply to message #121418] Sat, 28 May 2005 15:15 Go to previous message
Barbara Boehmer
Messages: 9097
Registered: November 2002
Location: California, USA
Senior Member
What version of Oracle are you using? Please see if the following helps:

http://www.idevelopment.info/data/Oracle/DBA_tips/Oracle9i_New_Features/ORA9i_14.shtml

I would be concerned about allowing execution of any operating system command. You might want to limit it to execution of just one .bat file. Here is an example using java:

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:3361193268672
Previous Topic: Monitor imports...
Next Topic: newbee: simple sql loader script
Goto Forum:
  


Current Time: Thu Jul 04 05:54:32 CDT 2024