3

Oracle10g in unix machine

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

4 Answers 4

3
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;
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

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.

Comments

0

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

1 Comment

Please be sure to read the FAQ on Self-Promotion carefully. Also note that it is required that you post a disclaimer every time you link to your own site/product.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.