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
==============================================================

Similar Messages

  • Problem with execute SSIS package from stored procedure

    Hi,
    I would like to execute SSIS package from stored procedure. Therefore, I implemented sp which exec SSISDB.CATALOG.CREATE_EXECUTION method. When I try to test it from SSMS on remote server, I got error that
    I was able to solve by adding “WITH EXECUTE AS …”. Then I got another error: The server principal "Domain\user" is not able to access the database "SSISDB" under the current security context. On Internet, I found a couple post that describe
    how to access SSIS catalog (one of them by Ke Yang -
    http://blogs.msdn.com/b/mattm/archive/2012/03/20/ssis-catalog-access-control-tips.aspx). It didn’t help. I’m still getting the error message.
    How to debug this issue?
    Any suggestion?
    Thanks
    SQL Server 2014 BI

    SSMS does not propagate user credentials thus the error
    Arthur
    MyBlog
    Twitter

  • Executing SQLPLUS command from Stored Procedure

    Hi,
    I am trying to execute the SQLPLUS command (CONNECT) from the stored procedure.
    It is throwing below error message.
    Stored Procedure:
    SQL> select user from dual
    2 ;
    USER
    SYS
    SQL> create or replace
    2 PROCEDURE PROCEDURE1 AS
    3 BEGIN
    4 sqlplus sys/sys@D as sysdba;
    5 --execute immediate 'create user 'kkk' identified by 'kkk';
    6 END PROCEDURE1;
    7 /
    Warning: Procedure created with compilation errors.
    SQL> show err
    Errors for PROCEDURE PROCEDURE1:
    LINE/COL ERROR
    3/9 PLS-00103: Encountered the symbol "SYS" when expecting one of the
    following:
    := . ( @ % ;
    The symbol ":=" was substituted for "SYS" to continue.
    3/22 PLS-00103: Encountered the symbol "AS" when expecting one of the
    following:
    . ( * @ & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || member SUBMULTISET_
    The symbol ". was inserted before "AS" to continue.
    Please let me know whether it is possible to do or not.
    If there is possiblility how can does this be done?
    Edited by: NGK246 on Aug 28, 2012 2:21 AM

    NGK246 wrote:
    Hi,
    I am trying to execute the SQLPLUS command (CONNECT) from the stored procedure.
    It is throwing below error message.
    It would not. It will always throw an error. SQLPLUS is a Utility and not a Command/Construct, that it would be available for a Stored Procedure
    >
    SQL> select user from dual
    2 ;
    USER
    SYSWhich Database are you onto? Is it DMIP?
    SQL> create or replace
    2 PROCEDURE PROCEDURE1 AS
    3 BEGIN
    4 sqlplus sys/sys@DMIP as sysdba;
    5 --execute immediate 'create user 'kkk' identified by 'kkk';
    6 END PROCEDURE1;
    7 /
    Warning: Procedure created with compilation errors.
    SQL> show err
    Errors for PROCEDURE PROCEDURE1:
    LINE/COL ERROR
    3/9 PLS-00103: Encountered the symbol "SYS" when expecting one of the
    following:
    := . ( @ % ;
    The symbol ":=" was substituted for "SYS" to continue.
    3/22 PLS-00103: Encountered the symbol "AS" when expecting one of the
    following:
    . ( * @ & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || member SUBMULTISET_
    The symbol ". was inserted before "AS" to continue.
    Please let me know whether it is possible to do or not.
    If there is possiblility how can does this be done?If you are at DMIP, you need not Login again. You can Login Manually to the Database and Execute the Procedure (in which you intend to create a User 'kkk').
    However, if you are trying to Create a User in a Different Database, You will first require a DB Link to exist to connect to the Remote Database. You will also require Explicit privileges to create any user (Although I am not sure if you can create User onto a different Database.)
    I would like to ask you, why are you creating a User on a Remote database? Can you not execute the same procedure on the Remote database and create User? Also, you are using SYS login to perform the activity. Ideally it should not be allowed. You must create a user and grant DBA rights to perform such activities.

  • How to execute Operating System commands from Stored procedure.

    Any help on how to execute Operating System commands from stored procedures will be appreciated.
    Nanditha.

    Search the forums for 'External Procedure' and you will find example code that has been posted before.

  • How to execute unix command from ODI Procedure

    Hi,
    I am trying to execute below unix command from ODI Procedure (Command on Target tab) but I am getting the error "java.io.IOException: Cannot run program "cd": error=2, No such file or directory" but when I try to execute the same command using OdiOSCommand, it is executing successfully. I don't want to use shell script to execute this command. Is there any specific syntax am I missing to execute this command from ODI procedure?
    cd /project3/tmt/;ls *.dmp > dmplist.lst
    Please help me on this...
    Thanks
    MT

    Hi nahlikh,
    Thank you for the reply.
    I used below command in Procedure but still getting the same error as "java.io.IOException: Cannot run program "OdiOSCommand": error=2, No such file or directory".
    OdiOSCommand "-COMMAND=cd /project3/tmt/;ls *.dmp > dmplist.lst"
    as I mentioned earlier if I use the command cd /project3/tmt/;ls *.dmp > dmplist.lst in OdiOSCommand tool it is executing successfully without any issues.
    any thoughts appreciated to get a solution for this issue.
    Thanks
    MT

  • Executing OS command from sql procedure

    i want to execute an OS command from the procedure, can i do this way? looks like it is not executing the command move....
    declare
    begin
    dbms_output.put_line(' moving...');
    host;
    move c:\file1\test.txt C:\moved
    exit;
    /

    True. But that job is going to run in a separate session, some time after the current transaction commits (depending on the number of jobs queued up to run). So if you need to pass information back from the job, or you want the procedure to handle exceptions thrown by the job, or you want to tie job related failures back to a particular application level event, or you want the rest of your procedure to wait for the operating system command to finish, using the DBMS_SCHEDULER for this sort of thing is going to require a fair amount of additional coordination/ monitoring/ infrastructure code. It's certainly not a Herculean task to write that additional code, and it's reasonable in some situations, but the Java stored procedure approach strikes me as substantially easier to deal with in most cases.
    Justin

  • Issue with XSL transformation in Java Stored Procedure

    Hi,
    Am having issue applying XSL transformation in Java Stored procedure. I have loaded the java class as well as .XSL files through loadjava uility and their status in DB is VALID.
    Below is the code in the java stored procedure:
    public static String tranform(String strInputXML ){
    URL url = ClassLoader.getSystemClassLoader().getResource(first.xsl);
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(new ByteArrayInputStream (strInputXML.getBytes("UTF-8")));
    TransformerFactory tFactory = TransformerFactory.newInstance();
    StreamSource stylesource = new StreamSource(url.openStream());
    Transformer transformer = tFactory.newTransformer(stylesource);
    When I run this procedure, am getting following errors:
    {color:#ff0000}*ERROR: 'No such file or directory'*
    FATAL ERROR: 'Could not compile stylesheet'{color}
    My first.xsl file has reference to other excel file (Ex: &lt;xsl:include href="second.xsl"/&gt;) which seems to be causing this error. When I remove the reference, procedure is working fine.
    Pls let me know how to resolve this and read the .XSL file with references.
    Thanks,

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

  • Issues with Executing Javascript command in Captivate

    Hi,
    I am having issues with executing javascript for a button in adobe captivate 5.  Let me explain what I am trying to do.  I am working on a WBT that has three skill checks throught the course. These skill checks are not graded or tracked for completion.  I currently have an image button that has the command "Open another project" The first image button is pointed to SkillCheck1 and I have the html file and swf file in the published root folder.  This currently works fine.
    However I want to use javascript to open a new window 800X600 with not toolbars at the top.  I got this part working with the code below:
    window.open('http://www.adobe.com','mywin',
    'left=40,top=40,width=800,height=600,toolbar=1,resizable=0');
    My only problem is, once the popup opens, my WBT goes to a page that says [object] and thats it.  I am uploading two images to show what I have.  Can someone help resolve my issue of the WBT going to

    Ok so I took this link and viewed over it.  I am new to Javascript and know very little about it.  Therefore this script kind of makes no sense to me.
    <script language="JavaScript"><!--
    var windowHandle = '';
    function myOpen(url,name,attributes) {
        windowHandle = window.open(url,name,attributes);
    //--></script>
    <a href="javascript:myOpen('page.htm','windowName','height=100,width=100')">text link</a>
    I chose the option to exectute javascript.  Does captivate need all of this including <script language=JavaScript">  Here is how I edited the script.  Should I make any changes to what is in bold?
    var windowHandle = ''; 
    function myOpen(url,name,attributes) {
        windowHandle = window.open(url,name,attributes);
    <a href="javascript:myOpen('http://www.adobe.com','Adobe Website','height=600,width=800')">text link</a>

  • Executing a Operating System command from Stored Procedure ??

    I want to execute a Operating System command from a PL/SQL Stored Procedure, can anyone suggest me how can I do this ??
    I am on Sun-Solaris with Oracle 8.1.7 database.
    Please do email me at [email protected]
    Thanks in Advance,
    Ramesh L.

    Are you using a webserver? If so, you could make your operating system script into a CGI program, then execute it from pl/sql using utl_http.request.

  • Issue with sending mail through java stored procedure in Oracle

    Hello
    I am using Oracle 9i DB. I created a java stored procedure to send mail using the code given below. The java class works fine standalone. When its run from Java, mail is sent as desired. But when the java stored procedure is called from pl/sql "Must issue a STARTTLS command first" error is thrown. Please let me know if am missing something. Tried the same code in 11.2.0.2 DB and got the same error
    Error:
    javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. va6sm31201010igc.6
    Code for creating java stored procedure: (T1 is the table created for debugging)
    ==================================================
    create or replace and compile java source named "MailUtil1" AS
    import java.util.Enumeration;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class MailUtil1 {
    public static void sendMailwithSTARTTLS(String host, //smtp.projectp.com
    String from, //sender mail id
    String fromPwd,//sender mail pwd
    String port,//587
    String to,//recepient email ids
    String cc,
    String subject,
    String messageBody) {
    try{
    Properties props = System.getProperties();
    props.put("mail.smtp.starttls.enable", "True"); // added this line
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.user", from);
    props.put("mail.smtp.password", fromPwd);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.auth", "true");
    #sql { insert into t1 (c1) values ('1'||:host)};
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    #sql { insert into t1 (c1) values ('2')};
    InternetAddress[] toAddress = new InternetAddress[1];
    // To get the array of addresses
    for( int i=0; i < toAddress.length; i++ ) { // changed from a while loop
    toAddress[i] = new InternetAddress(to);
    //System.out.println(Message.RecipientType.TO);
    for( int i=0; i < toAddress.length; i++) { // changed from a while loop
    message.addRecipient(Message.RecipientType.TO, toAddress);
    if (cc!=null) {
    InternetAddress [] ccAddress = new InternetAddress[1];
    for(int j=0;j<ccAddress.length;j++){
    ccAddress[j] = new InternetAddress(cc);
    for (int j=0;j<ccAddress.length;j++){
    message.addRecipient(Message.RecipientType.CC, ccAddress[j]);
    message.setSubject(subject);
    message.setText(messageBody);
    message.saveChanges();
    #sql { insert into t1 (c1) values ('3')};
    Enumeration en = message.getAllHeaderLines();
    String token;
    while(en.hasMoreElements()){
    token ="E:"+en.nextElement().toString();
    #sql { insert into t1 (c1) values (:token)};
    token ="ConTyp:"+message.getContentType();
    #sql { insert into t1 (c1) values (:token)};
    token = "Encod:"+message.getEncoding();
    #sql { insert into t1 (c1) values (:token)};
    token = "Con:"+message.getContent();
    #sql { insert into t1 (c1) values (:token)};
    Transport transport = session.getTransport("smtp");
    #sql { insert into t1 (c1) values ('3.1')};
    transport.connect(host, from, fromPwd);
    #sql { insert into t1 (c1) values ('3.2')};
    transport.sendMessage(message, message.getAllRecipients());
    #sql { insert into t1 (c1) values ('3.3')};
    transport.close();
    #sql { insert into t1 (c1) values ('4')};
    catch(Exception e){
    e.printStackTrace();
    String ex= e.toString();
    try{
    #sql { insert into t1 (c1) values (:ex)};
    catch(Exception e1)
    Edited by: user12050615 on Jan 16, 2012 12:18 AM

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

  • 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

  • Issue with executing Business Rules from Planning web

    Hi,
    We are using Hyperion Planning 9.3.0.1 and we keep getting an issue with the Business Rules. We get an error if we try to run the rules from Planning web. The same rules validates and executes fine if we run it from AAS. This issue gets resolved if we restart the Planning and RMI service. But this issue keeps happening randomly. Is there a permanent resolution to it? Is it a bug or I am missing something here?
    Thanks and Regards,
    Amol
    Edited by: user638718 on Apr 7, 2009 5:20 PM

    Hi,
    Have you installed any of the patches for 9.3.0.1, I think it goes up to 9.3.0.1.09
    One of the fixes was :-
    8-665086601 (6588823) – When the Business Rules connection to the relational database is lost, Business Rules does not reconnect to it. To solve this problem, an optional property, HBR_CONNECTION_VALIDATE_TIME, was added to HBRServer.properties. This property specifies a time interval for checking the connection between Business Rules and the relational database. If the connection is not valid, a new connection is established. The time interval is specified in milliseconds and defaults to 300,000 (five minutes).
    Though I know there has been more attention to fixing known issues on 9.3.1 than 9.3.0.1
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Invoking BPEL with large request payload from stored procedure

    Hi all,
    I have a stored procedure which invoke BPEL process. It is working fine with small payload (around 3000 characters). But some of the payload are as large as 75 to 100 thousand characters. I used the clob datatype for my soap envelop variable so that it can take more characters. But I am getting error if the payload size is large. Can someone help me figure how I am able to do this. Thanks.

    Hi James,
    Thanks for your response. What I need to do is, if any of the instance is failed in the first invokation, user can manual re-invoke the same process from the dashboard. I tried invoking bpel from ADF 11g and finally found out that it is not supported with SOA 10.1.3.4. (I can't use Data control as the payload is already in the database).
    I am invoking an Asynchronous process. So, it is not the timeout error. The same procedure went fine with the same process if the payload is small. I include one output parameter to send the message from the procedure back to ADF, and what Ifound out was if the payload is big, I got the exception right after "utl_http.write_text(l_http_request, l_soap_envelope);". Any hope that I can still use this without going to ODI?
    Thanks.
    SHY

  • Call unix commands from stored procedures

    My stored procedure requires to call unix commands HOW DO I DO IT?
    null

    i do not know pl sql but in java you can use:
    Runtime.getRuntime().exec("YOUR UNIX COMMAND");
    real example:
    Runtime.getRuntime().exec("ls");
    but you must be careful with using that...
    especially if you want to wait till the process finishes..
    rgds,

  • 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
    ============================================================

Maybe you are looking for

  • Property change listener error with jtabbedpane

    Greetings I have a property change listener on my jtabbedpane (2 panes (index 0 of course and index 1). my problem is when i want to run my app it gives me a java null pointer exception. I believe it is b/c it is starting the app and it see the prope

  • Trade-in problem at store 552

    Hello. I have problem trade-in my tablet under the current "Get a guaranteed minimum $50 gift card" promotion.  I went to store 552 on 6/20 with a like-new 1st gen Kindle fire. I was told the trade-in must include cable and charger. The lady at custo

  • Where can I get Russian Typeface Font for Mac?

    I'm desperately trying to get hold of some Russian Constructivist Typeface (Font) which I need for a project I'm working on. Does anyone know any software that has this on which is readily available? Be grateful for any help. Pluginbaby

  • IM failed to invoke Report 9i from form9i, how can i invoke it

    I m calling report 9i from form 9i but im alway failed to run report in form9i by using RUN_PRODUCT() builtin and RUN_REPORT_OBJCT() builtin how can i run a report ?

  • Slimtype BD E DS6E2SH not working on Win8 Pro

    Hi all, I installed Win 8 Pro and I noticed that my Blu-ray Optical drive is not working anymore like with Win7. I have an ASUS N56VZ and I have not found anything on the ASUS page. In the System it is recognized as "Slimtype BD E", but when I put a