Executing commands from Oracle

Hi,
I want to execute commands from Oracle where files are stored in Server. For eg. (sample.dat) contains some insert scripts which is stored in UNIX Server, that scripts should be executed from oracle using some methods!! Hope everyone got it. If not, pls let me know i'll elaborate it later.
Thanks
Rajaram

If you are using oracle 10g then you can use dbms_scheduler to execute o/s commands, scripts.
BEGIN
-- Job defined entirely by the CREATE JOB procedure.
DBMS_SCHEDULER.create_job (
job_name => 'test_full_job_definition',
job_type => 'EXECUTABLE',
job_action => '/scripts/myscript.sh',
start_date => SYSTIMESTAMP,
repeat_interval => 'freq=hourly; byminute=0',
end_date => NULL,
enabled => TRUE,
comments => 'Job defined entirely by the CREATE JOB procedure.');
END;
For earlier versions than 10g
http://www.dba-oracle.com/t_execute_operating_system_os_command_oracle.htm

Similar Messages

  • How execute pl/sql command from Oracle ADF Business Components

    can't find examples for how execute pl/sql command from Oracle ADF Business Components and how call pl/sql package procedure from ADF Business Components.
    insert,update,delete rows in view object instance cache is good but if i must do some complex operations while insert,update,delete rows..it's more better for me to call
    pl/sql procedure from oracle db.Am i wrong ????

    Roman,
    this should be similar to how it worked in JDeveloper 9.0.3. hava a look at <JDev903 Home>\BC4J\samples\StoredProc for a code example.
    Frank

  • How can I use unix commands from oracle report

    I have to use the following command from oracle reports.
    In oracle forms we can use the HOST command but what about oracle reports2.5.
    I have to email the attached file 100245.pdf from oracle reports to the given email id
    uuencode 100245.pdf 100245.pdf | mailx -s "test" [email protected]

    Hi,
    It's because .bat (or .cmd) files are scripts and not executables and are interpreted using the command line executable - which is normally cmd.exe (although you can buy others).
    So you need to call cmd.exe passing the bat file name as a parameter, something like
    cmd.exe /c batchfilename
    Without the /c you will never get a response.
    However, this brings us to the bizarre conclusion that you are going to:
    call cmd.exe (a shell interpreter)
    to launch a batch file
    that calls cygwin (another shell interpreter)
    which then runs ls
    When shouldn't that just be:
    call cmd.exe to run the dir command
    Or better yet, If you are just after a file name listing and you seem to understand Java stored procs, why not just write a JSP to list the contents of a directory? No problems with OS dependant commands, scripts and 3rd party interpreters. Plenty of examples of that out on the internet as well.
    HTH
    Chris

  • Error Trying execute shell from oracle

    Using 11g
    Shell script
    #!/bin/bash
    clear
    echo "testing123"
    named transfer2.sh (This is just a testing shell script. the real one will scp a file to a remote server, but I cannot even get this one to work first).
    I can execute in linux no issues
    > sh transfer2.sh
    testing123
    I want to be able to schedule this to run from oracle.
    my testing so far :
    BEGIN
       DBMS_SCHEDULER.CREATE_JOB (
          job_name          => 'TEST_SHELL',
          JOB_TYPE          => 'EXECUTABLE',
          job_action        => '/myfiles/transfer2.sh',
          start_date        => SYSDATE,
          REPEAT_INTERVAL   => 'FREQ=HOURLY;', 
          enabled           => FALSE,
          comments          => 'shell script from Oracle'
    end;
    now to run the job
    BEGIN
      dbms_scheduler.run_job('TEST_SHELL',TRUE);
    end;
    Error starting at line 43 in command:
    BEGIN
      dbms_scheduler.run_job('TEST_SHELL',TRUE);
    end;
    Error report:
    ORA-27369: job of type EXECUTABLE failed with exit code: 255
    ORA-06512: at "SYS.DBMS_ISCHED", line 185
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
    ORA-06512: at line 2
    27369. 00000 -  "job of type EXECUTABLE failed with exit code: %s"
    *Cause:    A problem was encountered while running a job of type EXECUTABLE.
               The cause of the actual problem is identified by the exit code.
    *Action:   Correct the cause of the exit code and reschedule the job.
    I have set the myfiles directory to 0777
    I have set all files in the myfiles directory to 0777
    so everyone should have access to execute scripts here.
    I have also set the extjob file to 0777
    any help appreciated.
    Thank you.

    708631 wrote:
    Using 11g
    Shell script
    #!/bin/bash
    clear
    echo "testing123"
    named transfer2.sh (This is just a testing shell script. the real one will scp a file to a remote server, but I cannot even get this one to work first).
    I can execute in linux no issues
    > sh transfer2.sh
    testing123
    I want to be able to schedule this to run from oracle.
    my testing so far :
    BEGIN
       DBMS_SCHEDULER.CREATE_JOB (
          job_name          => 'TEST_SHELL',
          JOB_TYPE          => 'EXECUTABLE',
          job_action        => '/myfiles/transfer2.sh',
          start_date        => SYSDATE,
          REPEAT_INTERVAL   => 'FREQ=HOURLY;',
          enabled           => FALSE,
          comments          => 'shell script from Oracle'
    end;
    now to run the job
    BEGIN
      dbms_scheduler.run_job('TEST_SHELL',TRUE);
    end;
    Error starting at line 43 in command:
    BEGIN
      dbms_scheduler.run_job('TEST_SHELL',TRUE);
    end;
    Error report:
    ORA-27369: job of type EXECUTABLE failed with exit code: 255
    ORA-06512: at "SYS.DBMS_ISCHED", line 185
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
    ORA-06512: at line 2
    27369. 00000 -  "job of type EXECUTABLE failed with exit code: %s"
    *Cause:    A problem was encountered while running a job of type EXECUTABLE.
               The cause of the actual problem is identified by the exit code.
    *Action:   Correct the cause of the exit code and reschedule the job.
    I have set the myfiles directory to 0777
    I have set all files in the myfiles directory to 0777
    so everyone should have access to execute scripts here.
    I have also set the extjob file to 0777
    any help appreciated.
    Thank you.
    Hi,
    Please check oracle support External Job fails with ORA-27369: job of type EXECUTABLE failed with exit code: 255 (Doc ID 1494843.1)
    Thank you

  • How to execute commands from Java

    hi,
    i m trying to execute a CVS command from a java environment. i m writing this code to create a user. for this i m executing this cvs command "cmd /c cvs passwd -r <username> -a <new-username>"
    after executing this cmd the command prompt will prompt for a pasword and then after entring the password i have to retype the password for confirmation. the existing code execcutes the command but i don t know how to read the prompt for password.
    <code>
    import java.io.*;
    import java.lang.*;
    public class first {
    public static void main(String[] args) {
    try {
    Process p = Runtime.getRuntime().exec("cmd /c cvs passwd -r gopalakrishnan_k -a ram");
    InputStreamReader reader=new InputStreamReader(System.in);
    BufferedReader OptFromCmd = new BufferedReader(new InputStreamReader(
    p.getInputStream()));
    BufferedReader fromKeyboard = new BufferedReader(reader);
    BufferedReader stdError = new BufferedReader(new InputStreamReader(
    p.getErrorStream()));
    OutputStream stdOut = p.getOutputStream();
    String s;
    String pswd = "mahesh";
    System.out.println("Success");
    int i = 0;
    while ((s = OptFromCmd.readLine()) != null) {
    //s = OptFromCmd.readLine();
    i++;
    System.out.println(s);
    System.out.println(i);
    if (i > 1) {
    stdOut.write(pswd.getBytes());
    stdOut.flush();
    System.out.println(
    "Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null) {
    System.out.println(s);
         /* Your Password Here */
         String password="Password Please";
         stdOut.write(password.getBytes());
    stdOut.flush();
         stdOut.write(password.getBytes());
    stdOut.flush();
         /* Your Password here */
    OptFromCmd.close();
    stdError.close();
    stdOut.close();
    } catch (Exception e) {
    e.printStackTrace();
    </code>
    [o/p]
    this program gives the output as
    adding the user <username>
    password:
    now i need to enter the password from java envronment and provide it in the command prompt .
    then it prompts for the password again for confirmation so i have to retype the password again
    how to acheive this.

    String abc[]={"sh","-c","/dir1/dir2/dir3/scanVirus/uvscan --clean -- delete --exit-on-error ../*.*>abcde.txt"};
    Runtime runtime = Runtime.getRuntime();
    Process p = runtime.exec(abc);
    when it founds any infected file the process is not terminated correctly and it gives the following error :
    "java.lang.Exception: Process failed to terminate correctly"
    but it deletes the infected file.
    and running the program second time (after deletion of infected file), it executed fine.
    Wating for help.
    Regards,
    Sundeep.

  • Cannot call the execute command from java code

    Hello,
    I like to add a new user via a java web service.
    Establishing a connection to the OC4J MBean server is no problem. I also can execute the commands 'listAllCommands' and 'help' on the MBean. But if i try to call the execute command, i always get an NoSuchMethodException. Looking at the MBeanInfos 'execute' is listed there as an operation.
    Can anyone explain this to me?

    Hi,
    I basically used the code described at http://download.oracle.com/docs/cd/B32110_01/web.1013/b28952/mbeans.htm#CIHFDJBJ to connect to the MBeanServer.
    To invoke 'execute' i used
    MBeanServerConnection con= jmxCon.getMBeanServerConnection();
    con.invoke(new ObjectName(MBEAN_NAME), "execute", new Object[] { COMMAND }, new String[] {});
    where MBEAN_NAME is the ObjectName of the CommandService MBean and COMMAND is a String like "identity add ..."

  • Run OS command from Oracle

    Hi All!!
    Which package can help me to run OS command from SQL script?
    Thanks.

    If you are using SQL*Plus to execute the script, you can use the SQL*Plus command HOST. If you are trying to execute an operating system command from a PL/SQL block (i.e. a stored procedure), you would need to use an external procedure or a Java stored procedure that uses Java's shell functionality.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to run unix command from Oracle Foms 10g

    OS: UNIX Solaries, Oracle Application Server 10g
    To run shell script from Oracle Forms, I used the following host('/bin/bash /u01/compile.sh') and it works well
    Now, I need to run unix command something like
    host('mv form1.fmx FORM1.FMX') but it's not working
    I tried to append the command "mv form1.fmx FORM1.FMX" to the compile.sh shell script but also it's not working although the rest lines of the shell script is running well
    Edited by: slamonty on Aug 23, 2012 12:36 AM

    Yes, Thank you so much, it works well as follow
    $ /bin/mv /u01/oracle/runtime/test/form1.fmx  /u01/oracle/runtime/test/FORM1.FMX Edited by: slamonty on Aug 23, 2012 9:59 AM
    Edited by: slamonty on Aug 23, 2012 11:14 AM

  • Call an executable file from oracle forms 6i

    Hello ,
    i want to call a local .exe file from oracle forms 6i passing along a couple of parameters in the command line .
    Can anyone help me out here ?
    thanks
    C.
    Edited by: user539712 on Jan 21, 2011 11:55 AM
    Edited by: user539712 on Jan 21, 2011 11:55 AM

    that worked...now i am facing a different issue now which i didnt have without the start command . i am calling iexplorer.exe but i am passing a long a url in the command line . the 2nd parameter in the url is not working so when i do :
    "start c:\progra~1\intern~1\iexplore.exe" http://localhost/hello.jsp&a=ddd&b=333
    the &b=333 is not passed (some issue with the & character i am guessing). Would you know a workaround ?
    thanks

  • Error on converting EXECUTE IMMEDIATE from oracle to SQL

    Hi,
    I am converting db from oracle to SQL using SSMA.
    I get following error while converting schema-
    This is the statement on source side (oracle) which is giving below error -EXECUTE IMMEDIATE sqlStat INTO objects_count; 
             *   SSMA error messages:
             *   O2SS0013: EXECUTE IMMEDIATE statement was converted into EXEC(...) statement, but dynamic string was not converted. It must be converted manually.
             EXECUTE (@sqlStat)
    Another issue is that I get below warning when converting this - temHEX NUMBER;
    from oracle to sql.
             *   SSMA warning messages:
             *   O2SS0356: Conversion from NUMBER datatype can cause data loss.
    It is converting to this in SQL - @temHEX float(53), 
    Please suggest.
    Thanks.

    Hi,
    I faced same error again-
    Below is the EXECUTE IMMEDIATE statement. Please help.
                               *   SSMA error messages:
                               *   O2SS0013: EXECUTE IMMEDIATE statement was converted into EXEC(...) statement, but dynamic string was not converted. It must be converted manually.
                               EXECUTE (
                                  'insert into Table1 (C_REPORTNAME,C_REPORTCODE,C_DATE,C_WEEK,C_MONTH,C_YEAR,'
                                   + 
                                  ISNULL(@sColumnNames, '')
                                   + 
                                  ') values ('''
                                   + 
                                  ISNULL(@sReportName, '')
                                   + 
                                   + 
                                  ISNULL(@sReportCode, '')
                                   + 
                                   + 
                                  ISNULL(CAST(@dInputDate AS nvarchar(max)), '')
                                   + 
                                   + 
                                  ISNULL(@sWeekNumber, '')
                                   + 
                                   + 
                                  ISNULL(@sMonth, '')
                                   + 
                                   + 
                                  ISNULL(@sYear, '')
                                   + 
                                   + 
                                  ISNULL(@sName, '')
                                   + 
                                   + 
                                  ISNULL(@sDescription, '')
                                   + 
                                   + 
                                  ISNULL(CAST(@nFail_Count AS nvarchar(max)), '')
                                   + 
                                   + 
                                  ISNULL(CAST(@nPass_Count AS nvarchar(max)), '')
                                   + 
                                   + 
                                  ISNULL(CAST(@nPassing_Fraction AS nvarchar(max)), '')
                                   + 
                                   + 
                                  ISNULL(@sEnabled, '')
                                   + 

  • Executing commands from a text document

    I would like to add some javascript to a pdf to automatically read commands from a text document and execute them. Is this possible?

    You can use the eval() command to execute plain-text JS code from with a
    running JS script.

  • Invoke and Execute Unix command from Oracle PL/SQL

    Dear All,
    I am currently working in the development of multi user application in ORACLE.
    My problem is,
    I have to remove a temporary file created in unix server when a particular condition is satisfied in a PL/SQL proccedure.
    I searched for this and got solution to use DBMS_PIPE package.
    Can you help me how to pack the content 'rm file_name' from different users working in different sessions and how to execute. Can you please explain me how the server manages calls from different sessions and replies to individual sessions.
    Thanks in advance,
    Shenbaga.

    Well if doesn't raise an exception it succeeded. Is that sufficient acknowledgement?
    Cheers, APC

  • Execute Unix Command from Oracle

    Hi,
    I'm on Oracle 11g R1. I've a requirement where user will be putting CSV files on Unix server and I've to create a job which runs periodically to check if any new file is added by user in the folder.
    If it finds a new file (s), then it needs to identify it and insert its name in an Oracle table. Once file's name is noted, it has to move file from that directory to another one.
    Can you please help me achieve it? Thanks in advance for your help.
    Regards,
    Chintan

    Take a look at DBMS_SCHEDULER
    Regards
    Etbin

  • Not executed Commands from Testprogra​ms written in Labview communicat​ing over GPIB

    Hello
    Sometimes I have the problem that the commands sent from testprograms written in Labview aren't executed from the devices
    (for example a counter or a power supply).
    An extension of the the wait time between Write and Read couldn't solve the problem (We use VISA-VIs or the Manufacturers-VIs).
    First workaround is to send the command again.
    Somebody else ever had the same problems to deal with? What did you do?
    Many thanks
    Best Regards
    Silvio

    Usually stuff like this is caused by incomplete understanding of communications using the GPIB bus (either by the programmer OR by the supplier of the drivers - the latter reason being why I almost always write my own drivers).
    Many times, an instrument fails to respond in what we considre a "timely" manner - a prime example is an instrument that takes several seconds to complete a measurement.  Many times, instruments don't queue commands, so if you send a command to an instrument while it is still processing a previous command, it won't be aware of the command you just sent, and you will get a timeout.  In this case, it's best to make the VISA timeout something like 5000 ms and - if your instrument accepts the command - use *OPC? to turn your command into a query.  This way, your application always waits for a response - usually a "1" - from the instrument being commanded before sending the next command. 
    Bill
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Execute CR from Oracle in Background Process

    Post Author: dansken
    CA Forum: Deployment
    Hi, I'm new to CR and we have recently purchase Business Objects Enterprise XI.  I would like to execute/open a created report that is saved as a .rpt from an Oracle procedure passing an in parameter that is used in the database query in on the report.  I also would like the report to automatically be printed on a printer.  Is there a way to do this? I hope I haven't been too confusing.Thanks in advance,Magnus

    Hi,
    I am not sure about the express version. Never used it yet.
    Have a look at the scheduler jobs and their runs.
    Statistics collection is by default made every night between 10 pm and 6 am.
    And every weekend between SAT 12:00 and MON 12:00.
    You can of course influence this behaviour be changing the time window settings for this job (the job is called gather_stats_job).
    The AWR is the automatic workload repository which is new thing Oracle 10g.
    Here is an excerpt from the doku:
    Automatic Workload Repository (AWR) is a built-in repository in every Oracle Database. At regular intervals, the database makes a snapshot of all its vital statistics and workload information and stores them in AWR. By default, the snapshots are made every 60 minutes, but you can change this frequency. The snapshots are stored in the AWR for a period of time (seven days by default) after which they are automatically purged.
    it is me again:
    you can use the package dbms_workload _repository to influence the frequency of snapshotsw taken as well as the retention periode for which they shall be storede inside the SYSAUX tablespace.
    Maybe you should read some chapters in the concepts volume of the doku:
    here is a link to the AWR in the doku, hope it works:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14231
    If you do not want all these automatic things going on then you can set the init-parameter STATISTICS_LEVEL to BASIC.
    This will stop a lot of these statistics gatherings and also other nice things. Pls read the reference for this. There all initialization parameters are documented.
    Regards,
    Lutz

Maybe you are looking for

  • Regarding extract data from r/3 to BW3.5

    Hi, Before i extracted data from flat file to BW. Now i am extracting data from r/3 to bw.This is the first time to extract. Please give steps to extract data from r/3 to bw using LO's and please give some directions for generic also. Please do the n

  • Computer really noisy (fan I think?). Resetting PRAM and SMC does not work.

    Hi, so basically, as the title says, my computer is making a really loud noise as soon as I turn it on, I am presuming it is the fan. Over a month ago, my computer started to constantly crash, and about two weeks ago I took it to a Genius Bar for a d

  • Use of JCo

    Hello Everyone,                        I m developing one portal application using NWDS. This application connects to backend SAP R/3 system & fetches the data in some table. i have decided to use JCo to connect to R/3 system. But in my code it gives

  • Sort contacts by last name, not phonetic last name

    When I try to sort my Contacts by "Last, First", iOS (version 5 on iPhone 4) actually sorts them by Phonetic last name, then phonetic first name. I have populated the Phonetic names of some people with deceptive name spellings so I can voice dial the

  • Where Is The Content Source Name/Titles Stored In The SharePoint Database

    I am trying to tie my sharepoint crawl history (duration of crawls) with the content source.  the MSSCrawlHistory table has the data for calculating the durations but it doesn't give me the content source.  There is a column "crawlid" and "projectid"