Call native command in PL/SQL

How can I call a native command in PL/SQL?

If you want to call a host command/program/script from within PL/SQL, it takes a bit of set up to do so. You can use java or 'C' to do it. Ask Tom has a good example using java at http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:952229840241
There are numerous other examples out there along similar lines, just do a search of the web with keywords along the lines of 'execute host command plsql'.

Similar Messages

  • How to call OS Commands through PL/SQL ?

    Is there any package to call OS (Solaris) commands from PL/SQL ? I want to do who cammand within PL/SQl Stored Proc and get the output inserted into a table. How can I do this ?

    Why don't you want to use Java? There are certainly alternatives, but without knowing why you don't like the Java solution, it's rather hard to know whether those alternatives make any sense in your environment.
    - You can make an external procedure call to a DLL (or shared library) installed on the server
    - You could use AQ or potentially DBMS_PIPE to communicate with external applications
    - You could use UTL_TCP to interact over the network with a machine
    - You may have other options depending on specifics about the call you're trying to make and the software you have.
    - In 10g, you could use the DBMS_SCHEDULER package to call OS commands
    Justin

  • Calling UNIX command from PL/SQL Procedure

    Is there a way to call a UNIX command (exa. ls) from within a PL/SQL stored procedure? Looking through the various packages, I didn't see anything that would give me this ability.
    I also looked through all the previous questions and nothing looked encouraging.
    Thanks in advance,
    Russ

    Russ,
    I thought I'd read a similar question awhile ago and did a search on the word host in this forum and found the following from July 9th that might help you:
    http://technet.oracle.com:89/ubb/Forum88/HTML/001611.html
    In that post I think the link listed by Barbara Boehmer in has changed to:
    ]http://asktom.oracle.com/pls/ask/f?p=4950:8:24579::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:16212348050,{host}
    It looks like they give solutions for Oracle 7, 8 and 8i.
    Good site Barbara, I've added it to my bookmarks.
    Hope this helps.

  • Call OS command from PL/SQL

    Hi expert,
    I am using 10gDB on Linux , I have found many website desribe above mention topic. and suggest few method as below : -
    1) DBMS_PIPE
    2) PRO/C
    3) JAVA
    4) DBMS_SCHEDULER
    In fact , My major execute OS command as below : -
    1) copy file to another directory.
    2) remove file in directory.
    3) call some tools to manipulate file.
    4) send email by command line.
    Could u let me know which method is best ? because some command may not
    execute success by each method.
    boris

    I'm not sure what you mean by
    "besides, u have't seen stability issues with either approach. how to do ??? dead la.
    i think every DBA in the world also face this problem ."
    Particularly the sentence
    "how to do ??? dead la."
    I think you are asking how to do something that you refer to as "dead la", but I can't figure out what "dead la" might mean. Is that an abbreviation for something? Or am I misunderstanding what you are trying to say?
    Justin

  • Calling Linux Command From Pl/SQL

    Hi!
    I need to create a trigger which will call a linux command. Basically, when a value changes in a table, I would like to run a linux script. The value in the table can change anytime during any day. I had a look at DBMS_JOB.SUBMIT but I'm not sure if this will work for me because I only need to run the linux script once - when the trigger is fired. I also don't wanna clutter the job queue. Please help. Thanx in advance.

    You didn't mention if you're looking for synchronous or asynchronous execution of your Linux command. Should the program wait for it to complete?
    If it has to be synchronous, you'll need to look into using the external program listener. If asynchronous is ok (and it usually is) and then I'd go with scheduling a job - don't worry about "cluttering up the job queue".
    If you're on 10g or later, don't bother with DBMS_JOB - use DBMS_SCHEDULER instead, which makes it much easier to execute an external process.

  • Calling OS commands from PL/SQL

    I want to write a PL/SQL procedure against an Oracle 9i database to import/export data from / to a file into / from a table. I need some advice for this. Please help me out.
    Any advice would be most welcome.
    Cheers
    SrihariKrishna Donepudi

    Not to mention SQL*Loader.
    Cheers, APC

  • Calling Operating System Commands from PL/SQL using java

    Calling Operating System Commands from PL/SQL - The Java Way
    wlth help of given thread link,
    Calling OS Commands from Plsql
    but i had user privilege problem
    Declare
    x Varchar2(2000);
    Begin
    x := OSCommand_Run('/tmp/sri/GROUP_ho.sh');
    DBMS_OUTPUT.Put_Line(x);
    End;
    o/p;
    can't exec: /tmp/sri/GROUP_ho.sh lacks user privilege
    i done the grant privillage also
    part
    dbms_java.grant_permission('abcd', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    dbms_java.grant_permission('abcd', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    dbms_java.grant_permission('
    abcd', 'SYS:java.io.FilePermission','<<ALL FILES>>', 'execute');
    again
    get
    can't exec: /tmp/sri/GROUP_ho.sh lacks user privilege
    same error;

    Process management at the OS level should prevent execution continuing in the calling code until the command has completed (either successfully or with error).
    If the low level java code were to spawn child process threads then execution could continue, but I'm guessing the Java function your talking about doesn't do that and just calls the operating system to execute the command and waits for the returning code to come back.

  • Can we call OS commands and SQLLOADER from pl/sql

    Hi,
    Please provide me a solution for calling OS commands and SQLLOADER from pl/sql

    See http://www.oracle-base.com/articles/10g/Scheduler10g.php for OS Commands.
    Another option for your SQLLoader question would be the use of external tables,
    http://www.oracle-base.com/articles/9i/ExternalTables9i.php
    C.

  • A HOST command in PL/SQL?

    Hello guys! :)
    I need to execute some SFTP commands on the database server to another SFTP server. In oracle forms theres a built in called "HOST" which executes native commands on the server. Is there something similar to that in PL/SQL?
    Also, im wondering of each call of the "HOST" command opens a new session in CMD. I'll need to log in, submit files, and retrieve files as well. If the HOST command opens a new session everytime, ill lose the login credentials from the first HOST command.
    Anyone know of anything like this thats been done before? Let me know. Thanks.
    Mo

    Duplicate thread
    SFTP in PL/SQL
    Please do not repost if the prior answers don't suit you.
    The answer to your question is obviously there is no HOST command in PL/SQL, as there has never been a HOST command, as Oracle happens to be a RDBMS.
    You could use the external procedure facility, you could also call Java.
    Tom Kyte has an utility for this on http://asktom.oracle.com, called run_cmd
    Sybrand Bakker
    Senior Oracle DBA

  • Creation of DB Adaptert for calling stored procedure in MS SQL server

    Hi,
    I need to create a DB adapter to call a stored procedure in MS SQL Server.
    I have gone thru the thread MS SQL Server database connection
    It mentions that we need to use a command line utility for generating the wsdl and xsd for calling stored procedures in MS SQL server. Please provide information where to find this utility and how to use it.
    Any links to tutorials are welcome.
    Thanks !!.
    Silas.

    Command line is required for stored procedures, if you are using the basic options you don't need to worry.
    (1) Download MS SQL Server 2005 JDBC Driver from Microsoft Site. http://msdn.microsoft.com/en-us/data/aa937724.aspx
    (2) The download is self extracting exe file. Extract this into Program Files on your machine. It should create folder as "Microsoft SQL Server 2005 JDBC Driver"
    (3) In above mentioned folder search for sqljdbc.jar copy this file into JDeveloper\JDBC\lib folder.
    (4) Open JDeveloper/jdev/bin/jdev.conf file add following entry.
    AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib
    While executing this step make sure that your JDeveloper is closed.
    (5) On command prompt go to J Developer folder and execute following command
    jdev -verbose
    This will open JDeveloper.
    (6) Now go to JDeveloper > Connections > Database Connections > New Database Connection
    (7) Select Third Party JDBC
    (8) Specify MS Sql Server User Name, password and Role.
    (9) In connection page specify following
    - Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
    - For class path browse to C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib folder, select sqljdbc.jar add it as library.
    - Specify URL as following.
    jdbc:sqlserver://SERVERNAME:1433;databaseName=MSSQLDBNAME;
    (10) Go to Test page and test it.
    cheers
    James

  • Call unix command in sqlplus script

    Hello, I wanna to know how to call a unix command in the sqlplus script.
    For exemple,
    I've a sqlplus script to lauch a oracle report, after the report is generated, I wanne to replace the output file in an other directory.
    So that, I have to call the unix command mv here in the sqlplus script
    How can I do it?**
    I completed my situation:
    I don't have dbms_scheduler untility in my database.
    Thanks a lot for your help
    Edited by: user11930885 on 17 janv. 2010 14:53

    Yes, at the begining, I'll tried the unix shell by calling SQL.
    I've the problem of passing the parameters through.
    It seems to me
    we can use
    Host in the SQLPLUS to run the unix command.
    but I've written it in my sqlplus script, it doesn't work. so I wanna to find an exemple how to use HOST in sqlplus script?
    I would have loved to give you an example..but its not unix on my laptop.
    But what i can tell you is...u should be doing otherway round.
    Not calling Unix commands from SQL but calling SQL's form unix.
    You got shell scripts for that.
    Write a shell script. Login to SQL execute your code.
    exit from sql and then move your file with MV. That's it.
    Do post how far you get after trying this.

  • How can i run oralce copy command with in sql j code [urgent]

    I try it but it give me error inavalid sql command etc
    i need help urgent

    http://www.oracle.com/technetwork/database/enterprise-edition/calling-shell-commands-from-plsql-1-1-129519.pdf

  • How to: execute operating system commands from PL/SQL

    System: IBM pSeries AIX
    Oracle: 11g Enterprise
    Is there a quick way to execute operating system commands from PL/SQL?
    Without creating a JAVA class....
    I need to execute a Loader script.
    I want to do this from within PL/SQL.
    I need to to do 4 things.
    Three require SQL scripts.
    The fourth is SQL*Loader.
    The usual way is with a UNIX script calling 3 SQL scripts and one Loader control file.
    Is there way to do all this from within ONE PL/SQL SCRIPT ??
    Just let me know.

    Is there a quick way to execute operating system commands from PL/SQL?
    NO
    Without creating a JAVA class....
    I need to execute a Loader script.
    I want to do this from within PL/SQL.
    WHY ON EARTH, such action will create a new connection and become a resource hog?
    I need to to do 4 things.
    Three require SQL scripts.
    The fourth is SQL*Loader.
    The usual way is with a UNIX script calling 3 SQL scripts and one Loader control file.
    Which is perfect for the purpose.
    Is there way to do all this from within ONE PL/SQL SCRIPT ??
    Just let me know.
    NO, there is NOT. Nor should there be. Why create unstable ineffcient Mickey Mouse systems, glued together by hacking?
    Sybrand Bakker
    Senior Oracle DBA

  • How to call dos commands through HTMLDB buttons

    HI,
    How do i call DOS commands through HTMLDB buttons, or on any process?
    can anyone help me on this?
    THANKS!
    BROKEN

    This article explains how to execute shell commands from whitin pl/sql using java (in the database).
    http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
    It is for Oracle8i but should still work. This still looks like a good way to go.
    ~Dietmar.

  • Call EXP/IMP in PL/SQL

    Is there any method to call EXP/IMP in PL/SQL ??
    Is there any method allow to run shell command in PL/SQL?
    or other mathod to direct call the EXP/IMP?
    Thanks you help !

    Can you give a example of calling Host Command in SQL ?
    I cannot find any referent about that;

Maybe you are looking for