kishore
kishore

Reputation: 167

can we execute unix command from oracle10g procedure

Oracle10g in unix machine

I have a requirement to execute the unix command in procedure how can I do that?

Upvotes: 3

Views: 5397

Answers (4)

Moiz
Moiz

Reputation: 127

I just want to share about an alternative approach for calling operating system commands. In this approach a simple web-service interface is setup for calling os commands from SQL or PL/SQL. Details about this approach can be found here:

Run Operating System (OS) Command in Oracle PL/SQL: A Web Service Approach

Using this approach, a step-by-step description about how to invoke SQL*Loader from SQL is also described here:

Run Oracle SQL-Loader from SQL or PL/SQL

Please note that in the above approach the web-service is defined in Python. Python comes pre-installed with most common linux distribution (including Oracle Linux), however if you are on windows platform then you may need to install the python 2.7.3

Upvotes: 0

Brian
Brian

Reputation: 13571

BEGIN
     DBMS_SCHEDULER.create_job(
    job_name        => 'SHELL_JOB',
    repeat_interval  => 'FREQ=DAILY; BYHOUR=2',
    job_type         => 'EXECUTABLE',
    job_action       => '/u01/app/oracle/admin/tools/shell_job.sh',
    enabled          => TRUE,
    comments         => 'Perform stuff'
);
END;

Upvotes: 3

DCookie
DCookie

Reputation: 43533

If DBMS_SCHEDULER isn't enough for you and you need to run commands within the context of other PL/SQL code, then you will need to look into calling External Procedures.

Upvotes: 0

mamboking
mamboking

Reputation: 4637

You can use the DBMS_SCHEDULER package from Oracle. There is also an open source set of packages for doing this. You can find those here.

Upvotes: 1

Related Questions