Call Shell Script from within PL/SQL - using DBMS_PIPE

Hi all

I'm trying to run a shell script inside my PL/SQL using DBMS_PIPE block (not sure if this is the right way or not)

Pl Sql script

==========

Set serveroutput size 100000

declare

cursor c1 is select * from mag_images

where nom_image like '% comp2.

v_path varchar2 (100): = ' / home/maguzzi/DOCUMENTS_DIR / ";

v_result number: = 0;

v_in_filename varchar2 (100): = v_path | ' test_file.jpg';

v_out_filename varchar2 (100): = v_path | ' test_file_out.jpg';

v_script varchar2 (100): = "tst_convert.sh";

v_command varchar2 (200): = 'sh'. v_path | v_script | » '|| v_in_filename | » '|| v_out_filename;

Start

A1 to c1 loop

dbms_output.put_line ('v_command: ' | v_command);

write_to_file ('test_file.jpg', 'DOCUMENTS_DIR', a1. Content);

dbms_output.put_line (' file write result: ' | v_result);

v_result: = exec_host_command (v_command);

dbms_output.put_line (' resize result :'|| file v_result);

end loop;

end;

Result DBMS_OUTPUT

====================

v_command: /home/maguzzi/DOCUMENTS_DIR/tst_convert.sh test_file.jpg test_file_out.jpg

Result of the entry of the file: 0

Result of resizing the file: 0

PL/SQL procedure successfully completed.

Function exec_host_command

=======================

FUNCTION to CREATE or REPLACE exec_host_command (lc_cmd IN VARCHAR2)

RETURN INTEGER IS

ln_status NUMBER;

lc_errormsg VARCHAR2 (80);

lc_pipe_name VARCHAR2 (30);

BEGIN

lc_pipe_name: = 'Maguzzi_PIPE ';

DBMS_PIPE. PACK_MESSAGE (lc_cmd);

ln_status: = dbms_pipe.send_message (lc_pipe_name);

RETURN ln_status;

END;

/

The Image of the BLOB is written to the correct location on the server "test_file.jpg", and although the exec_host_command function returns a value of 0, the shell script (tst_convert.sh) is not executed (i.e. no output file is created - outfile.txt and the image is not copied/converted to a new file name "" test_file_out.jpg" )

Shell script

========

tst_convert.sh

echo 'Here' > outfile.txt

Echo $1 > > outfile.txt

Echo $2 > > outfile.txt

resizing to convert $1 - $200 2

Could this be problems with permissions on files?

test_file1.jpg has permission - rw-rw-r-

test_convert.sh a permission rwxrwxrwx

When I run the script manually and pass in 2 parameters ($1 = infilename and $2 = outfilename), it works...

I'd appreciate if someone can point out my mistake or suggest another method that works.

Thanks in advance

How long does it take to create the converted file? Remember that the external Scheduler is running asynchronously, so it is possible that the converted file does not exist yet when the PL/SQL block subsequently tries to open it.

Try to add some delay seconds to the routine to ensure that the external task is completed:

    begin
      dbms_scheduler.create_job(
          job_name => 'MAG_IMAGE_CONVERT2'
        , job_type => 'EXECUTABLE'
        , job_action => '/home/oracle/DOCUMENTS_DIR/tst_convert2.sh' );--  '/home/oracle/DOCUMENTS_DIR/tst_convert.sh');
      dbms_scheduler.enable('MAG_IMAGE_CONVERT2');
      dbms_lock.sleep(3);
    end;

This probably isn't really a viable solution in the long term if it turns out that this is really the problem.

Tags: Database

Similar Questions

  • Call a script from a function sql file.

    Hello
    I need to call a script file sql from a user-defined function. Currently I am doing this in Oracle SQL Developer. I tried to call with
    @ {filename}, EXECUTION IMMEDIATE etc, but nothing worked. I get the compile error.

    Basically, my need is to call catldap.sql file so that DBMS_LDAP package gets loaded and then I can call this API functions.
    Please let me know if this is possible to do in a PL/SQL function.

    Thank you
    NGO

    user784520 wrote:

    I need to call a script file sql from a user-defined function.

    Not possible... and it seems that you do not fully understand the client-server in the context of Oracle.

    All SQL and PL/SQL are parsed and executed by an Oracle server process. Engines SQL and PL/SQL is expecting a single command at a time block. Any of these can accept a series of commands in a single call and then runs them in turn. The SQL engine expects a single SQL statement at a time. PL engine provides an anonymous PL/SQL block for both.

    This server process can not also enter the local file system to access the script files. Nor can he hack it on the network to access the script on the client files.

    So that the server process to access local files, a Directory object must be created and the current Oracle schema must read or a write access to this directory object. Sound security principles apply.

    There is no PL/SQL command to run a script. Do not confuse SQL * more (this customer has a very limited vocabulary) orders with PL/SQL commands. SQL * Plus runs its own orders... and send SQL and PL/SQL commands (a statement block a time) either repaired and running Oracle server process.

    It's also a very bad idea to run the external script content from within an Oracle server process - as this script resides outside and so outside the Oracle security mechanisms. This means that it is fairly easy for a person to access this script, compromise and then you inject and execute the contents of this script in the database.

    It is not good security.

    Latest issue - it's even worse to have the PL/SQL application dynamically create (or try to create) parts of the Oracle data dictionary and calling PL/SQL interface.

    The database must be installed correctly - and that includes loading and execution of the required rdbms/admin scripts during installation. It makes no sense at all for the application code to try to run these scripts. It raises many questions, including getting to allow the full application and full SYS code access to the instance database. A very serious breach of security.

    I agree at all with the approach to use.

  • Calling shell script program SQL and passing parameters

    Hi guys,.
    Greetings from Toronto. Is it possible to move one or more strings as parameters to a sql from shell script program?

    Shell script
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
     
    sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    SQL program (rd_test.sql)
    -- Accept system input parameters
    define p_user_id = &1
    define p_job_id = &2
    
    -- Wondering if its possible to pass these 3 parameters from a shell script program.
    -- (1) rd_test-$p_job_id-3-1.lis
    -- (2) RD_PRINTER(rd_test,3)
    -- (3) t_data
    
    select
    t_data=''rd_test-'||'''$p_job_id'''||'-1-1.txt''
    t_data_dir=''.''
    ksh $RD_PATH/another_shell_prog.sh $p_user_id $p_job_id '||a.rd_value||' '
    ||b.rd_value||' rd_test-$p_job_id-3-1.lis $RD_PRINTER(rd_test,3) '||
    '$t_data $t_data_dir'||'
    exit_status=$?
    check_command'
    from rd_job_parameter b, rd_job_parameter a
    where a.job_id = &2
    and a.jp_module_id = 'RDTEST'
    and b.job_id = a.job_id
    and b.module_id = a.module_id
    /
    As always, this is not something I have to solve that minute. Any help would be appreciated
    and I will think of the problem.

    Thank you
    REDA

    Published by: Raj404261 on June 25, 2009 11:40

    Published by: Raj404261 on June 25, 2009 17:29

    OK, just a few pointers possible if you need to go the way of shell script.

    I suggest that you have a separate SQL script for each of your options, which retains the fairly well-defined lines and keeps the maintenance as simple as possible. Therefore, in your shell script, you can have something like:

    #!/bin/ksh
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
    
    # Deduce which script you'll call here
    # using if statements, or even a case:
    
    if [[ p_job_id -eq 1 ]]
    then
      SQL_SCRIPT=sql_script1.sql
    else
      SQL_SCRIPT=sql_script2.sql
    fi
    
    # Or using case
    
    case $2
      in
        1)     SQL_SCRIPT=sql_script1.sql;
    
        2)     SQL_SCRIPT=sql_script2.sql;
    
        3)     SQL_SCRIPT=sql_script3.sql;
    
        *)     SQL_SCRIPT=sql_script4.sql;
    esac
    
    export ${SQL_SCRIPT}
    
    #If you need to query the database at all to deduce which script to cal
    #Then something like this:
    
    SCRIPT_VAR=`sqlplus -s username/password << EOF
    set heading off
    set feedback off
    set verify off
    SELECT * FROM DUAL;
    EOF`
    
    export {SCRIPT_VAR}
    
    SQL_SCRIPT=sql_script${SCRIPT_VAR}.sql
    
    # Then just call your script:
    sqlplus. -s $p_user_id/password @${SQL_SCRIPT}
    
  • DBMS_SCHEDULER - trying to create and run a UNIX shell script from Oracle

    How can I run Script Shell Unix from Oracle using DBMS_SCHEDULER?

    After reading many examples online, I finished the 3 steps below.
    Create program, create jobs, run task. On my 3rd stage, I get the following error.
    How can I make sure that the work was created?

    ORA-27475: "APPS. POSPAY_FILE_CHECK_JOB' must be work

    (1) create the program
    BEGIN
      dbms_scheduler.create_program(
         program_name => 'POSPAY_FILE_CHECK_PROG',
         program_type => 'EXECUTABLE',
         program_action => '/home/ldcgroup/ldccbc/POSPAY_USC2_CHECK.sh',
         number_of_arguments => 0,
         enabled => TRUE,
         comments => 'Test Program'
         );
    END;
    (2) create jobs
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
       job_name          =>  'POSPAY_CHECK_FILE_JOB',
       program_name      =>  'POSPAY_CHECK_FILE_PROG',
       enabled           =>   TRUE);
    END;
    /
    (3) the job (not calendar, I'll run this a concurrent request of EBS)
    BEGIN
       DBMS_SCHEDULER.run_job (
         job_name => 'POSPAY_FILE_CHECK_JOB');
    END;
    /

    Of [documentation | http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/scheduse002.htm#i1009668]

    The job is created disabled. You must enable it with DBMS_SCHEDULER.ENABLE before the Scheduler will automatically run it.
    
    Jobs are set to be automatically dropped by default after they complete. Setting the auto_drop attribute to FALSE causes the job to persist.
    
  • Order urgent WLST: calling shell script

    Hello

    Is it possible to call wlst cript i.e shell command can I call wlst.sh (present in Weblogic home/common/bin) and call then the following commands to connect to the shell script weblogic server, if yes then how.

    Concerning
    Rahul

    Yes, you can...
    Java weblogic. WLST filePath.py arg1 arg2 arg3 arg4

    And filePath.py access these arguments as below:

    domainName = sys.argv [1]
    host name = sys.argv [2]
    users = sys.argv [3]
    groups = sys.argv [4]

  • Call a script from a plugin

    Hello

    Is it possible to call a script existing since an Illustrator plugin?

    Thank you

    I close the topic because I think I used a bad word. In fact, I don't want to call a script but an action performed by a user.

  • ExtendToolscript opens when I call the script from photoshop

    Hey,.

    I asked this question on in general discussions by mistake if I though I would ask new here.

    I have a Javascript that I wrote which generates an interface of buttons in groups organized according to the contents of some folders. Everything works fine, but when you call it from photoshop and extendtoolscript it is not always executed it opens. I wrote many scripts with interfaces and I've never had this problem. This isn't a huge problem for me, as I usually have this program open anyway, but I intend to have a team of people using this script, so if I could stop, somehow, it would be much better.

    If anyone has experienced this before? Or maybe functions extendscript causes to open?

    I don't see anything unusual in the script...

    Any help would be appreciated!

    Thank you

    Mark

    var strtRulerUnits = app.preferences.rulerUnits;
    var strtTypeUnits = app.preferences.typeUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    app.preferences.typeUnits = TypeUnits.PIXELS;
    
    
    
    
    var templatepath = "~/Desktop/BANNERS/";
    
    
    var bannerfile = ""
    var docRef = app.activeDocument;
    
    
    
    
    var fileArray = new Array();
    
    
                    var sourceFolder = Folder (templatepath + "MAIN/");
    
    
                    var extRE = /\.(?:png|gif|jpg|bmp|tif|psd)$/i;
                    
                    // get all files in source folder
                    var docs = sourceFolder.getFiles();
                    var len = docs.length;
                    for (var i = 0; i < len; i++) {
                                    var doc = docs[i];
    
    
                                    // only match files (not folders)
                                    if (doc instanceof File) {
                                                    // store all recognized files into an array
                                                    var docName = doc.name;
                                                    if (docName.match(extRE)) {
                                                                    fileArray.push(doc);
                                                    }
                                    }
                    }
                
                
                var w = new Window ("dialog", "Choose a Banner");
                w.preferredSize = [400, 100];
                w.orientation = 'row';
                w.alignChildren = "left"
                w.alignChildren = [ "fill", "fill"];
                
                w.btnPnl = w.add('panel', undefined, 'MAIN');
                
                w.btnPnl.btn = w.add ("group");
                w.btnPnl.btn.alignChildren = "left"
                
                var buttonarray = new Array ();
                var key = {};
                
                
                
                for (var i = 0; i < fileArray.length ; i++) {
                    
                    var delimeter = '/';
                    var string = String (fileArray[i]);
                    var splitted = string.split(delimeter);
                    var thelength = ((splitted.length) - 1);
                    var bannername = splitted[thelength];
                    var delimeter = '.';
                    var splitted = bannername.split(delimeter);
                    var bannername = splitted[0];
                    
                    
                    var checkdelim = "%20";
                    var checkthat =  bannername.indexOf(checkdelim);
                    if (checkthat == "-1") {}
                    else {
                        
                    var delimeter = '%20';
                    var splitted = bannername.split(delimeter);
                    var counter = 0;
                    while (counter < splitted.length){
                    
                    if (counter == 0){
                    var bannername = (splitted[counter] + " ");    
                    }
                    else if (counter == ((splitted.length) - 1)){
                    var bannername = (bannername + splitted[counter]);
                    }
                    else{
                    var bannername = (bannername + splitted[counter] + " ");
                    }
                    var counter = (counter + 1);
                    }
                
                    }
                if (fileArray.length > 6){
                        var divider = 2
                        }
                    else{
                        var divider = 1
                        }
                    
                    var remainder = (i % divider);
                    if (remainder == 0){  
                    w.btnPnl.btn = w.btnPnl.add ("group");
                    w.btnPnl.btn.alignChildren = "left"
                    } else {
                    //x is not a multiple of y
                    }
                    
                    key = (String (fileArray[i]));
                    w[key] = w.btnPnl.btn.add("button", undefined ,bannername ); 
                    w[key].alignment = 'left';
                    buttonarray.push(w[key]);
                    
                    w.btnPnl.btn.addEventListener('click', button_pressed);
                    
                    function button_pressed (e)
                    {
                   if (e.target.type == "button")
                    $.writeln (e.target.text + " from panel " + e.target.parent.text);
                    w.close()
                    ////////////////////
                    var buttonname = e.target.text;
                    var checkdelim = " ";
                    var checkthat = buttonname.indexOf(checkdelim);
                    if (checkthat == "-1") {}
                    else {
                        
                    var delimeter = ' ';
                    var splitted = buttonname.split(delimeter);
                    var counter = 0;
                    while (counter < splitted.length){
                    
                    if (counter == 0){
                    var buttonname = (splitted[counter] + "%20");    
                    }
                    else if (counter == ((splitted.length) - 1)){
                    var buttonname = (buttonname + splitted[counter]);
                    }
                    else{
                    var buttonname = (buttonname + splitted[counter] + "%20");
                    }
                    var counter = (counter + 1);
                    }
                }
                
                    ///////////////////////
                    
                    bannerfile = new File (templatepath + "MAIN/" + buttonname + '.png');
                    
                     }
                 }
             
     ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
    
    var fileArrayneon = new Array();
    
    
                    var sourceFolder = Folder (templatepath + "NEON/");
    
    
                    var extRE = /\.(?:png|gif|jpg|bmp|tif|psd)$/i;
                    
                    // get all files in source folder
                    var docs = sourceFolder.getFiles();
                    var len = docs.length;
                    for (var i = 0; i < len; i++) {
                                    var doc = docs[i];
    
    
                                    // only match files (not folders)
                                    if (doc instanceof File) {
                                                    // store all recognized files into an array
                                                    var docName = doc.name;
                                                    if (docName.match(extRE)) {
                                                                    fileArrayneon.push(doc);
                                                    }
                                    }
                    }
                
                
                
                
                w.btnPnl = w.add('panel', undefined, 'NEON');
                
                w.btnPnl.btn = w.add ("group");
                
                var buttonarray = new Array ();
                var key = {};
                
                
                
                for (var i = 0; i < fileArrayneon.length ; i++) {
                    
                    var delimeter = '/';
                    var string = String (fileArrayneon[i]);
                    var splitted = string.split(delimeter);
                    var thelength = ((splitted.length) - 1);
                    var bannername = splitted[thelength];
                    var delimeter = '.';
                    var splitted = bannername.split(delimeter);
                    var bannername = splitted[0];
                    
                    
                    var checkdelim = "%20";
                    var checkthat =  bannername.indexOf(checkdelim);
                    if (checkthat == "-1") {}
                    else {
                        
                    var delimeter = '%20';
                    var splitted = bannername.split(delimeter);
                    var counter = 0;
                    while (counter < splitted.length){
                    
                    if (counter == 0){
                    var bannername = (splitted[counter] + " ");    
                    }
                    else if (counter == ((splitted.length) - 1)){
                    var bannername = (bannername + splitted[counter]);
                    }
                    else{
                    var bannername = (bannername + splitted[counter] + " ");
                    }
                    var counter = (counter + 1);
                    }
                
                    }
                
                if (fileArrayneon.length > 6){
                        var divider = 2
                        }
                    else{
                        var divider = 1
                        }
                    
                    var remainder = (i % divider);
                    if (remainder == 0){  
                    w.btnPnl.btn = w.btnPnl.add ("group");
                    w.btnPnl.btn.alignChildren = "left"
                    } else {
                    //x is not a multiple of y
                    }
                    
                    key = (String (fileArrayneon[i]));
                    w[key] = w.btnPnl.btn.add("button", undefined ,bannername ); 
                    w[key].alignment = 'left';
                    buttonarray.push(w[key]);
                    
                    w.btnPnl.btn.addEventListener('click', button_pressed);
                    
                    function button_pressed (e)
                    {
                   if (e.target.type == "button")
                    $.writeln (e.target.text + " from panel " + e.target.parent.text);
                    w.close()
                    ////////////////////
                    var buttonname = e.target.text;
                    var checkdelim = " ";
                    var checkthat = buttonname.indexOf(checkdelim);
                    if (checkthat == "-1") {}
                    else {
                        
                    var delimeter = ' ';
                    var splitted = buttonname.split(delimeter);
                    var counter = 0;
                    while (counter < splitted.length){
                    
                    if (counter == 0){
                    var buttonname = (splitted[counter] + "%20");    
                    }
                    else if (counter == ((splitted.length) - 1)){
                    var buttonname = (buttonname + splitted[counter]);
                    }
                    else{
                    var buttonname = (buttonname + splitted[counter] + "%20");
                    }
                    var counter = (counter + 1);
                    }
                }
                
                    ///////////////////////
                    
                    bannerfile = new File (templatepath + "NEON/" + buttonname + '.png');
                    
                     }
                 } 
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
    var fileArray180 = new Array();
    
    
                    var sourceFolder = Folder (templatepath + "180/");
    
    
                    var extRE = /\.(?:png|gif|jpg|bmp|tif|psd)$/i;
                    
                    // get all files in source folder
                    var docs = sourceFolder.getFiles();
                    var len = docs.length;
                    for (var i = 0; i < len; i++) {
                                    var doc = docs[i];
    
    
                                    // only match files (not folders)
                                    if (doc instanceof File) {
                                                    // store all recognized files into an array
                                                    var docName = doc.name;
                                                    if (docName.match(extRE)) {
                                                                    fileArray180.push(doc);
                                                    }
                                    }
                    }
                
                
                
                
                w.btnPnl = w.add('panel', undefined, '180');
                
                w.btnPnl.btn = w.add ("group");
                
                var buttonarray = new Array ();
                var key = {};
                
                
                
                for (var i = 0; i < fileArray180.length ; i++) {
                    
                    var delimeter = '/';
                    var string = String (fileArray180[i]);
                    var splitted = string.split(delimeter);
                    var thelength = ((splitted.length) - 1);
                    var bannername = splitted[thelength];
                    var delimeter = '.';
                    var splitted = bannername.split(delimeter);
                    var bannername = splitted[0];
                    
                    
                    var checkdelim = "%20";
                    var checkthat =  bannername.indexOf(checkdelim);
                    if (checkthat == "-1") {}
                    else {
                        
                    var delimeter = '%20';
                    var splitted = bannername.split(delimeter);
                    var counter = 0;
                    while (counter < splitted.length){
                    
                    if (counter == 0){
                    var bannername = (splitted[counter] + " ");    
                    }
                    else if (counter == ((splitted.length) - 1)){
                    var bannername = (bannername + splitted[counter]);
                    }
                    else{
                    var bannername = (bannername + splitted[counter] + " ");
                    }
                    var counter = (counter + 1);
                    }
                
                    }
                        
                   if (fileArray180.length > 6){
                        var divider = 2
                        }
                    else{
                        var divider = 1
                        }
                    
                    var remainder = (i % divider);
                    
                    
                    if (remainder == 0){  
                    w.btnPnl.btn = w.btnPnl.add ("group");
                    w.btnPnl.btn.alignChildren = "left"
                    } else {
                    //x is not a multiple of y
                    }
                    
                    key = (String (fileArray180[i]));
                    w[key] = w.btnPnl.btn.add("button", undefined ,bannername ); 
                    w[key].alignment = 'left';
                    buttonarray.push(w[key]);
                    
                    w.btnPnl.btn.addEventListener('click', button_pressed);
                    
                    function button_pressed (e)
                    {
                   if (e.target.type == "button")
                    $.writeln (e.target.text + " from panel " + e.target.parent.text);
                    w.close()
                    ////////////////////
                    var buttonname = e.target.text;
                    var checkdelim = " ";
                    var checkthat = buttonname.indexOf(checkdelim);
                    if (checkthat == "-1") {}
                    else {
                        
                    var delimeter = ' ';
                    var splitted = buttonname.split(delimeter);
                    var counter = 0;
                    while (counter < splitted.length){
                    
                    if (counter == 0){
                    var buttonname = (splitted[counter] + "%20");    
                    }
                    else if (counter == ((splitted.length) - 1)){
                    var buttonname = (buttonname + splitted[counter]);
                    }
                    else{
                    var buttonname = (buttonname + splitted[counter] + "%20");
                    }
                    var counter = (counter + 1);
                    }
                }
                
                    ///////////////////////
                    
                    bannerfile = new File (templatepath + "180/" + buttonname + '.png');
                    
                     }
                 }   
      
    
    
    
     ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
    
    
    var fileArraymisc = new Array();
    
    
                    var sourceFolder = Folder (templatepath + "MISC/");
    
    
                    var extRE = /\.(?:png|gif|jpg|bmp|tif|psd)$/i;
                    
                    // get all files in source folder
                    var docs = sourceFolder.getFiles();
                    var len = docs.length;
                    for (var i = 0; i < len; i++) {
                                    var doc = docs[i];
    
    
                                    // only match files (not folders)
                                    if (doc instanceof File) {
                                                    // store all recognized files into an array
                                                    var docName = doc.name;
                                                    if (docName.match(extRE)) {
                                                                    fileArraymisc.push(doc);
                                                    }
                                    }
                    }
                
                
                
                
                w.btnPnl = w.add('panel', undefined, 'MISC');
                
                w.btnPnl.btn = w.add ("group");
                
                var buttonarray = new Array ();
                var key = {};
                
                
                
                for (var i = 0; i < fileArraymisc.length ; i++) {
                    
                    var delimeter = '/';
                    var string = String (fileArraymisc[i]);
                    var splitted = string.split(delimeter);
                    var thelength = ((splitted.length) - 1);
                    var bannername = splitted[thelength];
                    var delimeter = '.';
                    var splitted = bannername.split(delimeter);
                    var bannername = splitted[0];
                    
                    
                    var checkdelim = "%20";
                    var checkthat =  bannername.indexOf(checkdelim);
                    if (checkthat == "-1") {}
                    else {
                        
                    var delimeter = '%20';
                    var splitted = bannername.split(delimeter);
                    var counter = 0;
                    while (counter < splitted.length){
                    
                    if (counter == 0){
                    var bannername = (splitted[counter] + " ");    
                    }
                    else if (counter == ((splitted.length) - 1)){
                    var bannername = (bannername + splitted[counter]);
                    }
                    else{
                    var bannername = (bannername + splitted[counter] + " ");
                    }
                    var counter = (counter + 1);
                    }
                
                    }
                    if (fileArraymisc.length > 6){
                        var divider = 2
                        }
                    else{
                        var divider = 1
                        }
                    
                    var remainder = (i % divider);
                    if (remainder == 0){  
                    w.btnPnl.btn = w.btnPnl.add ("group");
                    w.btnPnl.btn.alignChildren = "left"
                    } else {
                    //x is not a multiple of y
                    }
                    
                    key = (String (fileArraymisc[i]));
                    w[key] = w.btnPnl.btn.add("button", undefined ,bannername ); 
                    w[key].alignment = 'left';
                    buttonarray.push(w[key]);
                    
                    w.btnPnl.btn.addEventListener('click', button_pressed);
                    
                    function button_pressed (e)
                    {
                   if (e.target.type == "button")
                    $.writeln (e.target.text + " from panel " + e.target.parent.text);
                    w.close()
                    ////////////////////
                    var buttonname = e.target.text;
                    var checkdelim = " ";
                    var checkthat = buttonname.indexOf(checkdelim);
                    if (checkthat == "-1") {}
                    else {
                        
                    var delimeter = ' ';
                    var splitted = buttonname.split(delimeter);
                    var counter = 0;
                    while (counter < splitted.length){
                    
                    if (counter == 0){
                    var buttonname = (splitted[counter] + "%20");    
                    }
                    else if (counter == ((splitted.length) - 1)){
                    var buttonname = (buttonname + splitted[counter]);
                    }
                    else{
                    var buttonname = (buttonname + splitted[counter] + "%20");
                    }
                    var counter = (counter + 1);
                    }
                }
                
                    ///////////////////////
                    
                    bannerfile = new File (templatepath + "MISC/" + buttonname + '.png');
                    
                     }
                 }  
    
    
    
    
    
       
                     
     w.show();
    
    
    
    
    
    
    
    
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
    
     if (bannerfile == ""){}
     else{
    
    var targetDocumentName =  docRef.name;
    var tempfile = app.open (bannerfile);
    var sourceDocumentName = app.activeDocument.name;
    
    
    
    
    var thewidth = tempfile.width;
    var theheight  = tempfile.height;
    
    
    
    
    app.activeDocument = docRef;
    docRef.resizeImage (null, theheight, null, ResampleMethod.BICUBIC);
    
    
    if ((String(thewidth)) == (String(docRef.width))){
    var thelayer = docRef.activeLayer;
    copyLayers(sourceDocumentName, targetDocumentName );
    docRef.activeLayer = thelayer;
    }
    else {
    alert ("Document width Incorrect")   
    
    
    docRef.activeLayer.name = "main";
    var thelayer = docRef.activeLayer;
    docRef.resizeCanvas (thewidth, null, AnchorPosition.BOTTOMCENTER);
    copyLayers(sourceDocumentName, targetDocumentName );
    docRef.activeLayer = thelayer;
     }
      imageView ("FtOn");
     }
    
    
    
    
    
    
    
    
    
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////
    
    
    
    
     function copyLayers(sourceDocumentName, targetDocumentName) {
      var sourceDoc = app.documents[sourceDocumentName];
      var targetDoc = app.documents[targetDocumentName];
      var sourceLayer, targetLayer, sourceGroup;
    
    
      if (app.activeDocument != sourceDoc) {
        app.activeDocument = sourceDoc;
      }
    
    
    var thelayer = tempfile.layers[0];
    var layersToCopy = thelayer.name;
    
    
      if ( typeof layersToCopy === 'string' ) {
        sourceGroup = tempfile.layers[0];
        targetLayer = sourceGroup.duplicate( targetDoc, ElementPlacement.PLACEATBEGINNING )
      }
      else if ( Object.prototype.toString.call( layersToCopy ) === '[object Array]' ) {
        for (var i = 0; i < layersToCopy.length; i++) {
          sourceLayer = sourceDoc.artLayers.getByName( layersToCopy[i] );
          targetLayer = sourceLayer.duplicate( targetDoc, ElementPlacement.PLACEATBEGINNING );
        }
      } 
    tempfile.close(SaveOptions.DONOTSAVECHANGES);
    }
    
    
    
    
    
    
    function imageView (view) {
        desc= new ActionDescriptor();
            ref = new ActionReference();
          if (view.length < 5){
             var viewID = charIDToTypeID( view );
          }else{
             var viewID = stringIDToTypeID( view );
          }
          ref.putEnumerated( charIDToTypeID( "Mn  " ), charIDToTypeID( "MnIt" ), viewID );
        desc.putReference( charIDToTypeID( "null" ), ref );
       executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
    };
    
    

    $.writeln (written) the text specified in the JavaScript Console to ExtendScript Toolkit.

    You will probably need to 4 occurrences of the following line, apparently used for purposes of debugging in comment:

    $.writeln (e.target.text + " from panel " + e.target.parent.text);

  • SOA Gateway - timeout when calling a web service custom Pl/SQL using SOAP

    Hello

    I developed and deployed my PL/SQL web service custom repository integration SOA Gateway.

    The web service works well, but sometimes its execution time exceeds 60 seconds, and I get the following time-out error: java.net.SocketTimeOutException: Read timed out

    Here's my env:

    Oracle E-Business Suite integrated SOA Gateway
    12.1.3
    IBM AIX on POWER Systems (64-bit)
    6.1

    I would like to know if there is a way to increase this time-out?

    EDIT:

    I took a quick glance at this doc errors of timeout in Web Services deployment (Doc ID 1073270.1( )

    and modified the $ORA_CONFIG_HOME/10.1.3/opmn/conf/opmn.xml file

    then bounced oacore, oafm, but it did not work.

    EDIT 2:

    I tried to change the timeout setting in the file httpd.conf ( $IAS_ORACLE_HOME/Apache/Apache/conf/httpd.conf )

    restart apache and the server, but it didn't work.

    Thank you

    Kind regards

    Simon

    In fact, I tried to play with the values that you mentioned, I put the maximum Heap space in JAVA to 2048M and in Apache timeout to 3600 seconds and after a wait of cca. 20 minutes I got the answer I needed the SOAP service.

    Kind regards

    Ognjen

  • will not appear sql statemnt in shell script

    Hello

    I have a shell script with an unfavourable sql she calls another script where I connect to dabase.

    In the journal of the script, I see the sql statement and I wish that that do not show me anything. How I make these?

    Thank you

    Hello

    2650697 wrote:

    Hello

    I have a shell script with an unfavourable sql she calls another script where I connect to dabase.

    In the journal of the script, I see the sql statement and I wish that that do not show me anything. How I make these?

    Thank you

    Your postal code.  It is very difficult to tell what you're doing wrong without knowing what you are doing.

    You can have SQL statements directly in your shell script.  They must be in a script by themselves, said fubar.sql, and shell script must contain

    @fubar

    instead of real SQL statements.

  • Shell scripts

    I am new to shell scripting, I've heard of him, but that's all.

    Can a DBA, someone recommend me to websites that I can learn UNIX shell script from the point of view of Oracle DBA?

    I would like to see what I can do with UNIX Shell script as a DBA.

    http://www.orafaq.com/wiki/scripts#Unix_Shell_Scripts

    A good collection of Shell script for oracle dba.

    HTH
    Girish Sharma

  • Need to call the Shell script that uses SQL loader in APex4.1 / 11g

    Hello!

    I have a requirement in which I need to call a shell script that connects to an external server, FTP to a file and then use sqlloader to load data into our table. We have now the ftp script that accomplishes this task to another program, but is a scheduled task. I wanted to call the script ftp in the APEX. Any suggestions on how this can be done, what is the logic of PL/SQL can we use? I saw online some people using DBMS Scheduler for this?

    Thank you
    Sun

    Hello

    Create some sh script on your computer host oracle where you can join in the external server and run the process.
    something like:

    run_external_sh.sh

    #!/bin/sh
    ssh ext_user@ext_host ./sqlloader/import/import.sh
    

    Then create an external TASK to call it via ORACLE (PL/SQL)

    -Shell Script call.

    BEGIN
      DBMS_SCHEDULER.create_program (
        program_name        => 'external_call_sh',
        program_type        => 'EXECUTABLE',
        program_action      => '/local_host/call_external/sh/run_external_sh.sh',
        number_of_arguments => 0,
        enabled             => TRUE,
        comments            => 'Call external SH script');
    END;
    /
    

    You can now create a regular / or unplanned WORK
    -Job defined by the calendar and an existing program.

    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name      => 'jb_external_call_sh',
        program_name  => 'external_call_sh',
        schedule_name => 'external_call_scheduler', -- created scheduler
        enabled       => TRUE,
        comments      => 'Job defined by an existing external_call_sh program and schedule.');
    END;
    /
    

    You can now call the WORK in the APEX in the process of PL/SQL.

    BEGIN
      -- Run job synchronously.
      DBMS_SCHEDULER.run_job (job_name            => 'jb_external_call_sh');
    END;
    

    Concerning
    J :D

  • Call the PL/SQL shell script

    Hi all

    I've seen several links and options for calling a PL/SQL shell script. I was wondering if there is something like DBMS_SCHEDULER. CREATE_PROGRAM-> executable that calls an external program in 11 GR 2.

    Here's what I have to. I have 11 GR 2 database with Dataguard. I have START triggering who begins a DBMS_SERVICE when the role becomes PRIMARY. In the same instance, I would stop the VIP on the former primary database and start the VIP on the new primary database.

    Thanks for the advice and assistance.

    Jan S.

    The URL below links to ask Tom. Inside, he talks about creating a Java procedure in your database that allows you to execute commands from the host OS (PL/SQL calls the proc of Java that runs the host command). There are several ways to run the OS commands, but this one is very flexible. I needed to use it for a task that I have who didn't fit one of the other methods very well.

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:no:P11_QUESTION_ID:3069633370832

  • Using the shell script sql variable

    OS: Oracle Linux 5.10

    DB Oracle 11.2.0

    I have need to query the database and assign the return value to a variable of shell, but it does not work.

    create table imr_env (key varchar2(1000), value varchar2(1000) ;
    insert into imr_env values('TblspcUsagePct','90');
    commit;
    

    Here is the shell script:

    #!/bin/bash
    echo "in script"
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 ; export ORACLE_HOME
    ORACLE_SID=IMR1 ; export ORACLE_SID
    export PATH=$PATH:$ORACLE_HOME/bin
    
    pct=`sqlplus -S app/manager <<END
           set serveroutput on
           declare
              output_val number ;
           BEGIN
              select value into output_val from imr_env where key = 'TblspcUsagePct' ;
              dbms_output.put_line('output_val: ' || to_char(output_val)) ;
           END ;
           /
           exit;
    END`
    
    ## another sqlplus connection, use $pct in the where clause
    
    echo "var value is $pct"
    
    

    Here is the result:

    SQL> ./test.sh
    in script
    var value is 
    
    output_val: 90
    

    Why isn't the shell variable is populated with the value retrieved from the database?

    I need to use $pct in another query that will be storage spaces that are at least 90% full.

    I had to change to a korn shell - I couldn't get the "READ" command in shell or bash.

    But it is not only "READ" command:

    SQL > select * from IMR_ENV;

    THE KEY VALUE

    ------------------------- -----

    TblspcWarningLimit 90

    TblspcUsagePct 50

    SQL > exit

    Disconnected from the database to Oracle 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    $ cat test.sh

    VAL = $(sqlplus-S test/test)<>

    Set feedback off

    set the position

    Select (value) from imr_env, including the key to_number = "TblspcUsagePct";

    Select (value) from imr_env, including the key to_number = "TblspcWarningLimit";

    "exit";

    EXPRESSIONS OF FOLKLORE

    )

    set $VAL

    Echo $1

    Echo $2

    $./test.sh

    50

    90

    $ echo $SHELL

    / bin/bash

    $

  • Call the batch file and not the shell script using measures of the event

    Can I use EVENTACTIONS at the door of gold like

    eventactions (SHELL, /path-to-batch-file/test1.bat)

    will this work? I am on a windows machine, so I need to run a batch file and not a shell script

    In GGSCI, you can shell OUT to the BONE and call a command/executable file.

    For example on Windows:

    GGSCI (WIN2003) 2 > shell dir

    Volume in drive C has no label.

    Volume serial number is 8CCC-9E58

    Directory of C:\ggs

    18/08/2012 07:23

    .

    18/08/2012 07:23

    ...

    2010-10-15 06:37 bcpfmt.tpl 426

    2010-10-15 06:37 bcrypt.txt 1 725

    22/04/2011 03:41 2 560 category.dll

    05/11/2011 10:43

    cfg

    2010-10-15 07:15 739 chkpt_ora_create.sql

    ...

    What were the results when you tried this in an EVENTACTIONS clause?

  • Coil PL/SQL parameter value using shell script

    Hello

    I execute PL/SQL procedure using shell script. I want the value of parameter in a coil OUTPUT text file. to_msg is the IN OUT parameter in the script below. Is this possible?

    sqlplus test/***@db < < EOFSQL
    COIL Status.txt
    HEAD off SET
    SET SERVEROUTPUT ON
    declare
    to_msg varchar2 (8000): = 'status ';
    EXEC P_Status (to_msg);
    SPOOL off
    "exit";
    EOFSQL

    AravindhK wrote:
    Thanks for your reply. When I roll the result, sql statements is also copied to the text file. How can I eliminate the sql statements.

    What are the results when you do as below

    sqlplus-s

Maybe you are looking for

  • Satellite M70 356: is it possible to change the graphics card

    Hello I want to buy Windows Vista (Home Premium). But I also want to activate Vista Aero Glass Style. I downloaded a Microsoft tool, who told me that my (INTEL 915GM Express) installed is not supported... Is it possible to change the interface? How m

  • Problem: Screen size is smaller in playing games.

    Detail: I loaded my games but his cheek in a small screen (800 X 600) with the rest of the laptop screen blacked out.I tried to play with the game options and laptop screen resolutions has also changed and nothing seems to work. But when I connect my

  • Remove 'confirmed' e-mail address for the hijacker to my account information

    My msn account has been hacked several times.  I have taken possession each time, but can not remove the hijackers of my account info email address as it is 'confirmed' and whenever I try to enter an e-mail, I get a message stating an email will be s

  • Blue screen - Unknown stop code

    everytime I open a game in windows vista the BSOD comes out and restarts the computer laptop while advice on how to solve the prob, so I can PLAY!and thx in advance

  • Not able to launch Movie Maker

    Original title: disappointment movie maker Why is not a Director run it please help it is urgent