4 Replies Latest reply: Jan 14, 2012 4:35 AM by kordirko RSS

    which is the best way to run unix script through database

    malik_Rahul
      Dear ALL

      Please help to resolve one issue. I am scheduling the unix script in DBMS_SCHEDULER. which one should i choose to run unix script

      1) I am calling a procedure which indeed calling java to execute unix script on same unix box and using SSH to run unix script on the remote server.

      2) Queue the items in oracle AQ. and then using the OCI to dequeue it and execute the script.The OCI c fuction keep looking into queue after every 5 second and whenever data is there it execute the script with the parameter in database
        • 1. Re: which is the best way to run unix script through database
          Billy~Verreynne
          ma**** wrote:

          1) I am calling a procedure which indeed calling java to execute unix script on same unix box and using SSH to run unix script on the remote server.

          2) Queue the items in oracle AQ. and then using the OCI to dequeue it and execute the script.The OCI c fuction keep looking into queue after every 5 second and whenever data is there it execute the script with the parameter in database
          The better one of these depends entirely on the one that meets your requirements the best. Think in terms of manageability, security, logging, scalability, robustness, functionality and so on.

          The AQ option is a bit more complex as it has more moving parts (requiring a server process to dequeue and execute commands). I prefer solutions with as few moving parts as possible, as these are easier to support and manage (and code). So my selection from a pure technical perspective (ignoring specific business and user requirements) would be the 1st option.
          • 2. Re: which is the best way to run unix script through database
            malik_Rahul
            Dear Billy,

            I was able to execute the scripts on the oracle unix box. now I enabled the ssh between oracle user and the other unix box user.
            If i login as oracle user then do the ssh command i able to execute the script

            but if i do this through database by java ..
            it shows me error...

            exec(/usr/local/libexec/ssh-askpass): No such file or directory
            ssh_askpass: exec(/usr/local/libexec/ssh-askpass): No such file or directory
            ssh_askpass: exec(/usr/local/libexec/ssh-askpass): No such file or directory
            Permission denied (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive).

            Is the user is oracle?
            where I am missing something?
            • 3. Re: which is the best way to run unix script through database
              kordirko
              ma**** wrote:
              but if i do this through database by java ..
              it shows me error...

              exec(/usr/local/libexec/ssh-askpass): No such file or directory
              ssh_askpass: exec(/usr/local/libexec/ssh-askpass): No such file or directory
              ssh_askpass: exec(/usr/local/libexec/ssh-askpass): No such file or directory
              Permission denied (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive).

              Is the user is oracle?
              where I am missing something?
              Try to grant permissions on these directories and files to oracle user (not 'oracle' on the system, but your user-schema name- on oracle) or to PUBLIC, for example:
              call dbms_java.grant_permission('PUBLIC', 'java.io.FilePermission', '/usr/local/libexec/ssh-askpass/*', 'read,execute');
              Edited by: kordirko on 2012-01-14 11:34
              • 4. Re: which is the best way to run unix script through database
                malik_Rahul
                Thanks problem resolved.