Can we run a unix script from sql plus

Hello,
Is there any possibility to run unix command from sql plus? I would appreciate if you can provide with the syntax.
Thank You
KK

user539616 wrote:
Hello,
Is there any possibility to run unix command from sql plus? I would appreciate if you can provide with the syntax.
Thank You
KKWithin sqlplus you can run
1) SQL statements
2) PL/SQL blocks
3) any valid sqlplus command.
SQLplus commands are documented in the SQLPlus reference manual. For 10g this is found at http://docs.oracle.com/cd/B19306_01/server.102/b14357/toc.htm. You might be interested in the HOST command, detailed at http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12026.htm#sthref2314
Just beware that the HOST command (or the shortcut version of it alluded to by Warren Tolentino) spawns a child process. When control comes back to sqlplus, that child process is gone.
What is the business problem you are trying to solve? If we knew that we could probably give better advice than blindly giving you the correct technical answer to a narrow question.

Similar Messages

  • How can I run a Unix script from a desktop icon?

    I have a Unix script I've created in vi and would like to run it by double clicking on an icon on my desktop. I would like to do this without the additional application layer of Applescript, Automator or Terminal. Is this possible?
    Thanks in advance.
    Howard

    Sounds like a job for platypus.

  • Running a Unix script from a Java class

    I am trying to use SCP (Secure copy) to copy an xml file from my J2EE application to a remote Unix server using a Unix script. How can I run the Unix script from my Java class? I could not find any resource for this on the internet. Can someone help me with this please.
    Thanks

    I am trying this below program ,but i am getting the error please help me
    import com.jcraft.jsch.*;
    import com.jcraft.jsch.Channel;
    import com.jcraft.jsch.JSch;
    //import com.jcraft.jsch.JSchException;
    import com.jcraft.jsch.Session;
    //import com.jcraft.jsch.UserInfo;
    import java.io.*;
    public class testrad {
    public static void main(String args[])
    String user="usertvr";
    String host="5.34.12.1";
    String cmd="ls -l";
    JSch jsch = new JSch();
    try{
    Session session=jsch.getSession(user,host,22);
    session.setPassword("$yhaj23");
    //UserInfo usrInfo=new MyUserInfo();
    //session.setUserInfo(usrInfo);
    session.connect();
    Channel channel=session.openChannel("exec");
    ((ChannelExec) channel).setCommand(cmd);
    channel.setXForwarding(true);
    channel.connect();
    //code
    channel.setInputStream(System.in);
    // channel.setOutputStream(System.out);
    //((ChannelExec) channel).setErrStream(System.err);
    InputStream in = channel.getInputStream();
    channel.connect();
    byte[] tmp = new byte[1024];
    while (true)
    while (in.available() > 0)
    int i = in.read(tmp, 0, 1024);
    if (i < 0)
    break;
    System.out.print(new String(tmp, 0, i));
    if (channel.isClosed())
    in.close();
    // System.out.println("JSCH: exit-status: " +
    //channel.getExitStatus());
    break;
    try
    Thread.sleep(1000);
    catch (Exception ee)
    channel.disconnect();
    session.disconnect();
    }catch(Exception e)
    {e.printStackTrace();
    System.out.println("Exception"+e);}
    /*public static class MyUserInfo implements UserInfo {
    public String getPassword()
    { return "password"; }
    public String getPassphrase()
    { return ""; }
    public boolean promptPassword(String arg0)
    { return true; }
    public boolean promptPassphrase(String arg0)
    { return true; }
    public boolean promptYesNo(String arg0)
    { return true; }
    public void showMessage(String arg0)
    Here is the error
    com.jcraft.jsch.JSchException: UnknownHostKey: 5.128.0.10. RSA key fingerprint is 02:a0:d6:c0:6f:69:2c:a9:a7:fa:7c:71:1c:60:ed:57
         at com.jcraft.jsch.Session.checkHost(Unknown Source)
         at com.jcraft.jsch.Session.connect(Unknown Source)
         at com.jcraft.jsch.Session.connect(Unknown Source)
         at testrad.main(testrad.java:23)
    Exceptioncom.jcraft.jsch.JSchException: UnknownHostKey: 5.128.0.10. RSA key fingerprint is 02:a0:d6:c0:6f:69:2c:a9:a7:fa:7c:71:1c:60:ed:57
    Can some one help me please.
    I running this program from Windows to connect to remote unix boxes.

  • Run a UNIX Script from java

    Hi,
    how can i run a unix script from java application. This java application is on windows.
    How can i do this.
    thanks,

    Hi,
    how can i run a unix script from java application.
    This java application is on windows.
    So I think it's safe to assume that the target script is on a remote unix server.
    Take a look at http://sourceforge.net/projects/sshtools/

  • How to run a unix script from oracle warehouse Builder

    Hi,
    can any one share the information about, running the unix script or scripts using oracle warehouse builder.
    Regards,
    Ak

    One way is define a workflow. Inside the workflow you put
    1)an external process that "points to" the shell script and then
    2)put the mapping
    The external process must have the "COMMAND" parameter set to the name of the shell script. If the script has parameters you must put them in the "PARAMETERS LIST" separated by "?" (for example, ?par1?par2).
    The path where OWB executes the external process I think is the ORACLE_HOME of the OWB.
    f you don't use workflow, you can try with this more complex solution. I tried with 9i and OWB 9.2 and it's working well.
    You create an autonomous procedure (within a package or not) :
    CREATE PROCEDURE Extract_Email_List
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    And use the sys.shell script that you need your dba/unix admin to install first of all, with a call like that.
    sys.shell('sh ' || txt_dir_name || '/send_email_marketing.sh ' || txt_dir_name || ' ' || email_addr );
    Then you import your procedure into OWB and use it in your mapping with the "pre-mapping" icon (you can set parameters for your proc with constants if you want).
    To implement sys.shell, go to metalink and find "Note:168065.1" - "How to call a UNIX shell script from PL/SQL".
    Once it's done once, it's not so bad. But I would still recommend the workflow approach also..
    I hope this helps.

  • How to run a Unix Script from a specific user

    Hi,
    I want to run a GoldenGate related unix script from a super user. I have created crontab enter from that super user. But its still running from root user. As GGSCI cannot be invoked other than super user, the Script is failing.
    The Script is running fine on command prompt and from "at" batch job command.
    Please give me a way to run the script from a specific user on Cron
    Thanks,
    Saravana

    Hi.
    can you show:
    grep root /etc/passwd
    grep <super user> /etc/passwd (It's not clear for me, what you call super user. For me - root is super user. )
    ls -la /var/spool/cron/crontabs
    Generaly for add cronjobs for any user need:
    crontab -e <username>
    For more information - man crontab
    Reagrds.

  • How to run O/S command from SQL * Plus.

    Hi,
    Can i run O/S commands, say copy or move, from SQL * Plus prompt? If yes, what is the command.
    Thanks.

    hi,
    or you can try the following
    slq > !
    and then your command
    rgds
    Alan

  • Running an Unix Script from Informatica Mapping/workflow.

    Hi ,
    I have a need to start /stop service to a remote server (away from the DAC server ,which is on UNIX os)
    how could this be done in a best way?
    I am planning to do this through Informatica Workflow,and need help (technical steps Please) to do this.
    1) workflow will call the Unix Script
    2) Unix Script logins to the remote server
    3) Unix scripts navigates to particular folder
    4) Unix script executes a command to Start/Stop the server.
    5) Unix Script logs out.
    6) if everything done success ,Workflow will success else fail with the error code.
    Regards

    Hi ,
    I have a need to start /stop service to a remote server (away from the DAC server ,which is on UNIX os)
    how could this be done in a best way?
    I am planning to do this through Informatica Workflow,and need help (technical steps Please) to do this.
    1) workflow will call the Unix Script
    2) Unix Script logins to the remote server
    3) Unix scripts navigates to particular folder
    4) Unix script executes a command to Start/Stop the server.
    5) Unix Script logs out.
    6) if everything done success ,Workflow will success else fail with the error code.
    Regards

  • Can I run a shell script from the services menu?, part II

    Remember this?
    It is now possible.

    Doesn't look like there is a direct way to do it.
    The services are all Bundles, which is easy
    enough to fake -- just copy one from /Library/Services
    to ~/Services and modify the plist. Put your shell
    script in Contents/MacOS/ and identify it in the
    plist under CFBundleExecutable and hope for the
    best
    Where it gets sticky is CFBundlePackageType (APPL
    for Application, FMWK for FrameWork, BNDL for
    'loadable bundle', whatever that is] and NSServices.
    CFBundlePackageType should pose no problem if Services
    use the OS loader and handles file magic [and '#!' of
    course].
    NSServices specifies a named port that the app
    listens on, the data type it receives, and so forth.
    This looks a bit harder to fake. I'd bet Applescript
    has the functionality, and there may be some
    command-line hooks to backend that, or it may be
    possible to netcat your way through it.
    But it doesn't look trivial
    Property List Key Reference
    Anyways, tried it with a quick script that echoes to a
    file, and haven't figured out how to refresh the
    Services menu to get it to appear. Probably have
    to NetInfo it or something ridiculous; doesn't appear
    to watch the FS.
    [ Edited by Apple Discussions Moderator; href URL ]

  • Can I run a shell script from the Services menu?

    This would be kind of cool.
    Is there a simple way to do this?

    Doesn't look like there is a direct way to do it.
    The services are all Bundles, which is easy
    enough to fake -- just copy one from /Library/Services
    to ~/Services and modify the plist. Put your shell
    script in Contents/MacOS/ and identify it in the
    plist under CFBundleExecutable and hope for the
    best
    Where it gets sticky is CFBundlePackageType (APPL
    for Application, FMWK for FrameWork, BNDL for
    'loadable bundle', whatever that is] and NSServices.
    CFBundlePackageType should pose no problem if Services
    use the OS loader and handles file magic [and '#!' of
    course].
    NSServices specifies a named port that the app
    listens on, the data type it receives, and so forth.
    This looks a bit harder to fake. I'd bet Applescript
    has the functionality, and there may be some
    command-line hooks to backend that, or it may be
    possible to netcat your way through it.
    But it doesn't look trivial
    Property List Key Reference
    Anyways, tried it with a quick script that echoes to a
    file, and haven't figured out how to refresh the
    Services menu to get it to appear. Probably have
    to NetInfo it or something ridiculous; doesn't appear
    to watch the FS.
    [ Edited by Apple Discussions Moderator; href URL ]

  • Accept input from Shell script in sql*plus

    Hey! Guys..
    i need the following info.
    I am running a shell script from sql*plus. I need to accept a value from shell script into my .sql file.
    thanks..
    Harsh.

    prompt for input, pass to another shell
    # contract_status_prompt.sh
    read udate?"Enter week-ending date in format dd-mmm-yyyy: "
    contract_status_update.sh $udate >$FDWLOG/current/contractstatusupdate`date +%d%h%y`.log
    echo `date`
    # End contract_status_prompt.sh
    Read the variable passed and use in SQLPlus:
    # contract_status_update.sh
    echo "Running contract_status.sh"
    echo "create records for contract_status"
    echo `date`
    echo " "
    echo " date used is "; print $1
    echo " "
    sqlplus <<exit
    @$FDWSQL/sqlparms
    set time on
    prompt *** Set contract_status_period ***
    update contract_status_period
    set period_date = '$1';
    commit;
    exit
    etc.

  • Call Unix Script from JSP.

    Hi,
    I need to run a unix script from a JSP page.
    JSP pages reside on a different machine.
    How can i call the unix script resides on different machine from JSP.
    Thanks,
    Narendra

    yah. I can access that machine telnet and having all credentials of that system.
    Can you please share the code needed for this.
    Thanks,
    Narendra

  • How can i run unix script from my apex page

    how can i run unix script from my apex page and take the output of unix script as a hidden variable and display it on the report region of that page

    I had a requirement to run a Fortran program against some data that woudl be extracted from the database after the user set up their filtering criteria and made some additional input. SInce the program was to complex to conver to PL/SQL, we decided to try and invoke it from Apex. This is how I did it.
    1. I followed the steps in Tim Archer's excellent article "Oracle External Procedure to Run Host Commands" (http://www.timarcher.com/?q=node/9). If the link does nto work, google the article's title.
    Using this steps I created a function which accepts any OS command, including calling my own shell scripts, and runs them. I called my PL/SQL function "shell" instead of "USF_RUN_HOST_CMD " as Tim did in his example (step 9).
    2. In Apex,
    a. I created a button to run my shell command. (I named it P2_RUN_SHELL)
    b. I created a PL/SQL process whose source looks as follows:
    shell('/home/ackness/scripts/cr_xcf_file.sh > /tmp/cr_scfp_file.log');
    and which was conditioned on the the button P2_RUN_SHELL.
    It works like a charm.
    Note: since you can run your own scripts using this method, you can encapsulate a series of commands in a UNIX shell script and invoke that script from Apex. This allows you to be able to test or run you commands from the command line as well as Apex and makes it easier to develop/debug/enhance the scripts in the future.
    Ackness

  • More on unix script from pl/sql

    Hi All,
    There was this discussion on starting unix scripts from within a pl/sql stored procedure started on August 31.
    All comments were targeted towards an oracle 8X solution.
    Does anyone have a solution for 7.3.4?
    Somebody mentioned something about using dbms_pipe package.
    So, just to rephrase the problem:
    - Need to execute any unix command/script from within a pl/sql block (stored procedure). Instance is oracle 7.3.4
    Thanks!
    Enrique

    Hi Juan,
    You can try this solution:
    enable in the the init file the parameter
    utl_file_dir="target_directory"In this way You permit the the DB to writing directly to the filesistem in the directory You specified.
    After restarting the istance You may write Your own code that, using the supplied package UTL_FILE, writes a file in that directory (es. my_script.sh)
    Then, instruct the cron daemon to execute every 1 minute this command.
    You may append to the script the self-destruction after the execution.
    I hope that this will help You.
    Max

  • Script having Chinese characters throws error when run from SQL PLUS

    Dear All,
    I have a script file(.sql) which contains Chinese characters ....
    I have saved the file in unicode Format.
    When I run this file using @D:\filename from SQL PLUS it throws an error "unknown Command at line 1"...
    My database is Oracle 10g...
    Can anyone suggest anything???
    Thanks In Advance
    Dev
    Edited by: Devarsh on Oct 21, 2009 8:16 AM

    I think you may need to set your local NLS_LANG setting for your client (SQL*Plus) to recognize the characters.
    You may also consider posting your question on the Globalization forum which pertains more to these types of questions.
    Globalization Support

Maybe you are looking for

  • Creative Cloud Manager - Download Error - cannot update apps

    This is an ongoing issue for me.  Whether it's AAM or the new CCM, when I attempt to access apps and updates I receive a Download Error message (see pic) which will not allow me to update or download apps. After experiencing this with the AAM in May,

  • Installed Tiger on blank hard drive iBook G4, then computer froze.

    I'm pretty new to Macs. I bought a used iBook G4 with no OS installed. I installed OS X Tiger from a CD and everything went fine, but when it restarted after install, after the Apple logo, the screen went black. There's a white light flashing very sl

  • Exception handling for Inbound IDoc

    Hi, I have a Flat File to IDoc Scenario. Flat file is an EDI 210 message. I will serialize and tranform EDI210 into IDoc. I want to capture the exceptions from the flat file during serialization. My schema will have exception structure. How do i deal

  • 64bit Contact sheet II in Bridge CS5

    Hello, Adobe.... are you listening to anybody???? MANY of us use the contact sheet II plugin every day... it is ridiculous to have to restart in 32 bit to use this.... Do any of the developers of this app actually take photographs and deliver them to

  • Webserver response error

    Hello Gurus,                 The scenario is ECC 6.0 (RFC) - > PI7.1---- > WebServer (SOAP Adapter). The request is send from ECC 6.0 server to the web server. The request is going properly, but while sending the response from the Webserver to the EC