Issue while executing OS script from Oracle

I am trying to execute the scripts provided at :
http://github.com/xtender/XT_SHELL
provided by xtender user.
As required, I have asked my DBAs to grant privileges by executing the following scripts:
Begin
  --change to needed permissions and execute
  dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/factiva/ODS/bin/CVIM_Rpt_ExportCSVFile’, 'read,write,execute' );
end;
/where CVIM_Rpt_ExportCSVFile is my script residing in the Unix server where my Oracle is installed.
The error I am facing when I try to execute the following command is:
select * from table(xt_shell.shell_exec('/var/scripts/CVIM_Rpt_ExportCSVFile',100))
Exception:the Permission (java.io.FilePermission /var/scripts/CVIM_Rpt_ExportCSVFile execute) has not been granted to ODS. The PL/SQL to grant this is dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )I have asked my DBA to also execute the following scripts: - But I still see the same error as above. I am not able to figure out whats going on. Can anyone pls help me out??
EXEC Dbms_Java.Grant_Permission('ODS', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
EXEC Dbms_Java.Grant_Permission(ODS', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )

DUPLICATE
=============================================================
Issue with Executing OS commands from Stored Procedure
============================================================

Similar Messages

  • Error while executing UNIX script from BODS - exit code 127

    I am trying to execute a unix script by calling it in BODS job. It is giving an error saying Program terminated with exit code 127. The same script when i am executing in UNIX it is working fine. I am unable to trace the issue.

    Hi Sabre,
    As per the guidelines provided by the article, i had done below changes..
    InputStream is = null;
    InputStreamReader iStreamReader = null;
    BufferedReader bReader = null;
    String line = null;
    try{
    String fileName ="test.ksh";
    String argValue ="satish"; // value passed to the script
    String exeParam = "/usr/bin/ksh "+fileName+" "+argValue;
    Process proc = Runtime.getRuntime().exec(exeParam);
    is = proc.getErrorStream();
    iStreamReader = new InputStreamReader(is);
    bReader = new BufferedReader(iStreamReader);
    System.out.println("<ERROR>");
    while((line = bReader.readLine()) != null)
    System.out.println("Error is : "+line);
    System.out.println("</ERROR>");
    int exitValue = proc.waitFor();
    sop("Exit Value is : "+exitValue);
    catch(Exception e)
    e.printStackTrace();
    Now , it's showing something like..
    <ERROR>
    </ERROR>

  • File Ownership while executing sql script from stored procedure

    We have a test_command.sql script which is spooling the result into a file. From database we have one Store Procedure(run_sql) which is
    calling and executing the .sql script.
    When we are calling the sql script directly from the database, i e SQL > @/dccops/test_command.sql it is creating the
    file under the Ownership of OS user which is connected to the system.
    The problem we are facing is when we are executing the stored procedure i e exec run_sql(), the file is creating under
    Oracle User.
    Could u please suggest me a solution inorder to create the output file under the user who is logged to the OS.

    First of all, your usage of IM speak is NOT appreciated. Please do not address anyone as if they were a 12-year old.
    'Our Applcation is in C. So we have to call the procedure to run the sql script.'
    This is just utter nonsense!
    Oracle has Pro*C which allows Embedded SQL in C. There is also OCI (Oracle Call Interface) to call Oracle directly in C, and there is OCCI, to do the same in C++.
    Apart from that, Oracle has Ole DB for Windows platforms, to allow for a .NET compatible interface to Oracle.
    There is NO NEED AT ALL to call PL/SQL to run a SQL script.
    Sybrand Bakker
    Senior Oracle DBA

  • ORA-01017 encountered while executing shell scripts

    Hi,
    While executing backup scripts for one of my databases, the script contains a login section which fails as shown below
    Script login section:
    sqlplus / << END > /tmp/$PROGRAM.tmp
    Error generatedf in logfile:
    SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 10 11:32:06 2013
    Copyright (c) 1982, 2011, Oracle. All rights reserved.
    ERROR:
    ORA-01017: invalid username/password; logon denied
    Couple of points to be noted:
    1) There are two other databases in the same server and they don't have any issue
    2) I am able to login into this database as "/"
    3) I am able to connect to the same databases as sysdba from another server
    4) The script runs successfully when I modify it as: sqlplus / as sysdba << END > /tmp/$PROGRAM.tmp

    if you connect sqlplus as
    $ sqlplus /You're not identifying that's why you got ORA-01017
    instead if you connect as "sqlplus / as sysdba" , check:
    sqlplus / as sysdba--how it works
    ===========================================
    please mark your threads as answered when you got the correct answer:
          866746     
    Handle:      866746 
    Status Level:      Newbie
    Registered:      Jun 18, 2011
    Total Posts:      3
    Total Questions:      3 (3 unresolved)Edited by: Fran on 12-abr-2013 3:47

  • Issue While executing the Query for Pagination using ROWNUM with like

    Issue While executing the Query for Pagination using ROWNUM with like.
    Database is Oracle11G.
    Oracle Database Table contains 8-9 lakh records
    1) SQL equal (=)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920'
    Execution Time:- 0.00869245 seconds
    Returns 2 resultsets
    2) SQL like (one %)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920%'
    Execution Time:- 0.01094301 seconds
    Returns 2 resultsets
    3) SQL like (two%)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE like '%KMF22600920%'
    Execution Time:- 6.43989658 seconds
    Returns 2 resultsets
    In Pagination, we are using Modified version of SQL Query 3) with ROWNUM as mentioned below :-
    4) SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) WHERE RNUM > 0
    Execution Time:- Infinite
    ResultSets:- No as execution time is infinite
    a) Instead of like if we use = in the above query it is returning the 2 resultsets (execution time 0.02699282 seconds)
    b) Instead of two % in the above query, if use one example REFERENCE like 'KMF22600920%' it is returning the 2 resultsets (execution time 0.03313019 seconds)
    Issue:- When using two % in like in the above query i.e. REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) , it is going to infinite.
    Could you please let us know what is the issue with two % used in like and rownum
    5) Modified version of Option1 query (move out the RNUM condition AND RNUM <= 20)
    SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' ) WHERE RNUM > 0 AND RNUM <= 20
    Execution Time:- 7.41368914 seconds
    Returns 2 resultsets
    Is the above query is best optimized query which should be used for the Pagination or still can improve on this ?

    This would be easier to diagnose if there was an explain plan posted for the 'good' and 'bad' queries. Generally speaking using '%' on both sides precludes the use of any indexes.

  • Issue with Executing OS commands from Stored Procedure

    I am trying to execute the scripts provided at :
    http://github.com/xtender/XT_SHELL
    provided by xtender user.
    As required, I have asked my DBAs to grant privileges by executing the following scripts:
    Begin
      --change to needed permissions and execute
      dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/factiva/ODS/bin/CVIM_Rpt_ExportCSVFile’, 'read,write,execute' );
    end;
    /where CVIM_Rpt_ExportCSVFile is my script residing in the Unix server where my Oracle is installed.
    The error I am facing when I try to execute the following command is:
    select * from table(xt_shell.shell_exec('/var/scripts/CVIM_Rpt_ExportCSVFile',100))
    Exception:the Permission (java.io.FilePermission /var/scripts/CVIM_Rpt_ExportCSVFile execute) has not been granted to ODS. The PL/SQL to grant this is dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )I have asked my DBA to also execute the following scripts: - But I still see the same error as above. I am not able to figure out whats going on. Can anyone pls help me out??
    EXEC Dbms_Java.Grant_Permission('ODS', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC Dbms_Java.Grant_Permission(ODS', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )

    DUPLICATE
    ===============================================================
    Issue with Executing OS commands from Stored Procedure
    ==============================================================

  • Issue with running a script in Oracle test manager

    Tool - Open Script 9.0.1 , OTM
    Hi All
    I am facing issue while executing a open script with Oracle Test Manager , I have a script which was made with open script 9.0.1 and which is running very fine with the Open Script UI ,
    problem occurs once I am trying to run this with OTM.Issue looks that playback was so fast in OTM so that script was not able to recognize some of the objects.
    Is there anyway so that I can control the speed of playback at any particular step when I am using OTM
    Thanks

    Hi Kumar,
    Regarding your query below is the suggestion:
    You have to configure the job server with the repository. While configuring the adapter, you have to configure the job server in management console also..
    Still if you are facing issue then please share Job Server logs available in BODS Job Server Folder and error screenshot to debug the issue.
    Thanks,
    Daya

  • Error while executing the script adgetlnxver.sh

    Error while executing the script adgetlnxver.sh on apps&db tier during upgrade from 11.5.9 to 11.5.10.2
    -bash: [: -lt: unary operator expected
    [aptinst@dba5 TINST_dba5]$ sh adapcctl.sh restart
    adapcctl.sh version 115.55
    /u01/app/tinst/tinstappl/ad/11.5.0/bin/adgetlnxver.sh: line 123: [: -lt: unary operator expected
    Apache Web Server Listener :httpd ( pid 8645 ) is running.
    Restarting the Apache Web Server Dedicated HTTP Listener..
    Apache Web Server Listener (PLSQL) :httpd ( pid 8673 ) is running.
    Restarting the Apache Web Server Dedicated PLSQL Listener..
    adapcctl.sh: exiting with status 0
    In adgetlnxver.sh: line 123 says
    if [ ${setflag}x = "x" -a $os = "RH" ]; then
    redhatver=`grep -oP "Enterprise Linux [a-z A-Z 0-9]* release [0-9]+" /etc/redhat-release | sed 's/Enterprise Linux [a-z A-Z 0-9]* release //g'`
    if [ $redhatver -lt 5 ]; then
    LD_ASSUME_KERNEL="2.4.19"
    export LD_ASSUME_KERNEL
    fi
    fi
    Thanks,
    Vamsi

    Hi Vamsi.
    The exactly erro refers to a problems when you try upgrade from these version to 11.5.10.
    Can you read this note and apply solution? The note refers a patch, but the problem is the same.
    After Patch 4334965, adstrtal.sh & adstpall.sh is failing with errors [ID 360046.1]
    BR Rafael Ceolim

  • ORA-27092 Error while executing any query from client

    Hello
    I am getting following error while executing any query from client remotly.
    IAMDBA@TEST_OAT.ABCD > select userid from dual;
    select userid from dual
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01116: error in opening database file 1
    ORA-01110: data file 1: '/u01/prod/system/system01.dbf'
    ORA-27092: size of file exceeds file size limit of the process
    Additional information: 131071
    Additional information: 286209
    But while local connection,its working.

    hi,
    ulimit command- Limit user resources
    su - oracle
    ulimit -n (this command will show you the current value for ulimit the default value is 1024)
    to increase its value:---
    ulimit -n <some value> ( this command will change value for current session only)
    example
    ulimit -n 101062
    once done check the value as:--
    ulimit -n( for verification)
    search in google for more explanation or revert back to me for any suggestions.... :)
    Edited by: varun4dba on Jan 31, 2011 4:09 PM

  • Issues while running batch file from SAP

    Dear Experts,
    I am executing a script from SAP which is running fine on my PC. But when I execute the same on user's PC he is getting the following error:
    1. "Open File - Security Warning" pop-up appears when I execute the code on user's PC. The same does not appear on mine. I click on "Run" then it executes.
    2. After the script gets run, SAP is not moving to another screen and gets hanged. It displays a message below "Running Script.bat' (and waiting)'...". Again this issue is only replicated on user's PC.
    Regards,
    Ashish
    Also guys let me know how to insert screen shots in SDN messages.
    Moderator message: not directly related to ABAP development.
    Edited by: Thomas Zloch on Apr 25, 2011 10:41 PM

    Not an ABAP issue...contact your Helpdesk.

  • How to execucte/calll a shell script from oracle

    hi all
    i want to execute a shell script from oracle...... how do i do that can any one send me a good link which i can refer and learn
    or if any one has already implemented anything like this plz let me know the code
    Regards

    Here u goooooo
    http://www.experts-exchange.com/Database/Oracle/Q_21908413.html
    Regards,
    http://www.oracleracexpert.com
    Send email using UTL_MAIL in oracle.
    http://www.oracleracexpert.com/2009/11/send-email-using-utlmail-in-oracle-10g.html
    Migrate Non-ASM Database to ASM using RMAN
    http://www.oracleracexpert.com/2009/10/migrate-database-to-asm-using-rman.html]

  • How does execute PHP Script from SAP?

    I've already installed SAPRFC and run SAP Function from PHP successfully. But failed when tried execute PHP script from SAP (SM59). Anyone can help me for a clear instruction for this problem?
    Thanks

    Hi Max,
    here is the Source:
    [code]
    #!/usr/bin/php -q
    <?php
    // SAPRFC - Server example
    // PHP server function RFC_READ_REPORT
    // Require: CGI version PHP, RFC destination defined in SAP R/3 (SM59)
    // http://saprfc.sourceforge.net
    // Interface definiton for RFC_READ_REPORT
    // (generated by saprfc.php - option Generate PHP)
       $DEF_RFC_READ_REPORT = array (
                             array (
                                     "name"=>"SYSTEM",
                                     "type"=>"EXPORT",
                                     "optional"=>"0",
                                     "def"=> array (
                                             array ("name"=>"","abap"=>"C","len"=>8,"dec"=>0)
                             array (
                                     "name"=>"TRDIR",
                                     "type"=>"EXPORT",
                                     "optional"=>"0",
                                     "def"=> array (
                                             array ("name"=>"NAME","abap"=>"C","len"=>40,"dec"=>0),
                                             array ("name"=>"SQLX","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"EDTX","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"VARCL","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"DBAPL","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"DBNA","abap"=>"C","len"=>2,"dec"=>0),
                                             array ("name"=>"CLAS","abap"=>"C","len"=>4,"dec"=>0),
                                             array ("name"=>"TYPE","abap"=>"C","len"=>3,"dec"=>0),
                                             array ("name"=>"OCCURS","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"SUBC","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"APPL","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"SECU","abap"=>"C","len"=>8,"dec"=>0),
                                             array ("name"=>"CNAM","abap"=>"C","len"=>12,"dec"=>0),
                                             array ("name"=>"CDAT","abap"=>"D","len"=>8,"dec"=>0),
                                             array ("name"=>"UNAM","abap"=>"C","len"=>12,"dec"=>0),
                                             array ("name"=>"UDAT","abap"=>"D","len"=>8,"dec"=>0),
                                             array ("name"=>"VERN","abap"=>"C","len"=>6,"dec"=>0),
                                             array ("name"=>"LEVL","abap"=>"C","len"=>4,"dec"=>0),
                                             array ("name"=>"RSTAT","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"RMAND","abap"=>"C","len"=>3,"dec"=>0),
                                             array ("name"=>"RLOAD","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"FIXPT","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"SSET","abap"=>"C","len"=>1,"dec"=>0),
                                             array ("name"=>"SDATE","abap"=>"D","len"=>8,"dec"=>0),
                                             array ("name"=>"STIME","abap"=>"C","len"=>6,"dec"=>0),
                                             array ("name"=>"IDATE","abap"=>"D","len"=>8,"dec"=>0),
                                             array ("name"=>"ITIME","abap"=>"C","len"=>6,"dec"=>0),
                                             array ("name"=>"LDBNAME","abap"=>"C","len"=>20,"dec"=>0)
                             array (
                                     "name"=>"PROGRAM",
                                     "type"=>"IMPORT",
                                     "optional"=>"0",
                                     "def"=> array (
                                             array ("name"=>"","abap"=>"C","len"=>40,"dec"=>0)
                             array (
                                     "name"=>"QTAB",
                                     "type"=>"TABLE",
                                     "optional"=>"0",
                                     "def"=> array (
                                             array ("name"=>"LINE","abap"=>"C","len"=>72,"dec"=>0)
    // Create list of PHP server functions
       $GLOBAL_FCE_LIST[RFC_READ_REPORT] = saprfc_function_define(0,"RFC_READ_REPORT",$DEF_RFC_READ_REPORT);
    // PHP server function
       function RFC_READ_REPORT ($fce)
           $REPORT = saprfc_server_import ($fce,"PROGRAM");
           saprfc_table_init ($fce,"QTAB");
           $fd = fopen ($REPORT,"r");
           if (!$fd)
               return ("NOTFOUND");     // raise exception "NOTFOUND"
           while (!feof($fd))
               $LINE = fgets ($fd,73);
               saprfc_table_append ($fce,"QTAB",array("LINE"=>$LINE));
           fclose ($fd);
           saprfc_server_export ($fce,"SYSTEM","PHP");
           return (true);
    // Call script with: ./server.php -a phpgw -g hostname -x sapgw00
       $rfc = saprfc_server_accept ($argv);
    // Dispatch one function call
       $rc = saprfc_server_dispatch ($rfc,$GLOBAL_FCE_LIST);
       saprfc_close ($rfc);
    ?>
    [/code]
    Regards
    Gregor
    Message was edited by: Gregor Wolf

  • Run Shell script from oracle plsql

    OS--> Linux
    Version--Oracle 10g
    I want to run a shell script from oracle PL/sql. I know dbms_scheduler can be used to create job , enable job and run it .
    But I have a requirement where I need to know if my script ran successfully or not. Something like a return code back to oracle.
    So that I can run appropriate code depending on return code of executed Script.
    Kindly help !!

    Online documentation was invented for a reason.
    And this reason was not would look it, as a volunteer, on your behalf, and post it in this forum.
    All procedures are documented. There are examples for most facitlities on Asktom, and there is Morgan's Library at [http://www.psoug.org]
    Sybrand Bakker
    Senior Oracle DBA

  • Can we call shell script from oracle 9i?

    Hi experts,
    I wanted to know can we call shell script from oracle 9i procedures? If yes,how
    Thanks
    Shaan

    No. I can't think of a way to do this...
    If you want you can use DBMS_SCHEDULER to call OS SHELL scripts within.
    For e.g.
    CREATE PROGRAM
    begin
    dbms_scheduler.create_program
    program_name => 'CHECK_TIME',
    program_type => 'EXECUTABLE',
    program_action => '/opt/oracle/chk_date.sh',
    enabled => TRUE,
    comments => 'Check the Time'
    end;
    CREATE A SHELL SCRIPT
    opt/oracle> cat chk_date.sh
    #!/usr/bin/ksh
    echo "The date is :`date`"
    CREATE SCHEDULE
    begin
    dbms_scheduler.create_schedule
    schedule_name => 'EVERY_30_MINS',
    repeat_interval => 'FREQ=MINUTELY; INTERVAL=30',
    comments => 'Every 30-mins'
    end;
    CREATE JOB
    begin
    dbms_scheduler.create_job
    job_name => 'RUN_CHECK_TIME',
    program_name => 'CHECK_TIME',
    schedule_name => 'EVERY_30_MINS',
    comments => 'Run the program CHECK_TIME every 30 minutes',
    enabled => TRUE
    end;
    MANUALLY RUN A JOB
    exec dbms_scheduler.run_job('RUN_CHECK_TIME');

  • Can I call host file ( Unix Shell script ) from Oracle 10g trigger

    Hi,
    I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
    thanks & regards
    parag

    user12009546 wrote:
    Hi,
    I am new to Oracle 10g. Can I call host file ( unix shell script ) from Oracle 10g trigger ?. I know it is possible. Pl explain me with small example
    thanks & regards
    paragIf you are in 10g, you can simple call shell script from DBMS_SCHEDULER:
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'TEST_SCRIPT',
    job_type => 'EXECUTABLE',
    job_action => 'PATH_OF_YOUR_SCRIPT',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=MINUTELY; INTERVAL=1',
    enabled => TRUE,
    comments => 'Shell script from Oracle'
    END;
    /

Maybe you are looking for

  • Ipod Not Being Read

    Hello. I was having issues with my ipod, as it was freezing. I then read through the five "R"'s and after trying numerous times to restart my ipod. Then, seeing as the problem, which was my ipod kept freezing. Then, I downloaded the ipod update softw

  • Advice on RAID Sets, Volume Sets, and RAID Levels of the Volume Sets using an Areca Controller

    I have read through a lot of information on disk usage, storage rules for an editing rig, users inquiries/member responses in this forum and I thank each and every one of you – especially Harm. In building my new workstation, I purchased five (5) WD

  • Align portlet in a region right

    Hello You can align items to the right or left in a portal region. How do I do this with portlets? For eg: How do I align the 'set language' portlet to the right in one of my regions? Regards, Chrigel

  • Unexpected Signal

    does anybody have idea about this? or encountered with this before? my program is doing fine for months and suddenly this error occured. if anyone have an idea on how to fix this problem please tell me.. thank you so much... Unexpected Signal : 11 oc

  • Refine edge in masks CS6

    every time i try to refine the edge of a mask, it begins to erase my picture instead of adding in the hair etc. i tried this on several computers at school and it did the same thing, so it isnt my computer/software. my teacher has sat down with me se