call a batch file in the sql scripts

Hi friends,
I'm looking for a way to call any batch file in sql scripts. I avoid using the DBMS_SCHEDULER package because my application server and database server are deparaments.
I use the sql script using the server.plz application.


Ah, I see. Of course, this explains everything.

Now to be serious: there is no way to run a batch SQL script. The Tools that present SQL statements to the database are often able to do; host in SQL * Plus may issue commands to the OS, the host of builtin forms is it too and with dbms_scheduler , you can run a shell script on the database server.

So depending on the tools you use, there are several ways to run the OS commands. So far you didn't tell us what you want to do with what tools in the version you want to do. So to only answer is: it is not possible. You cannot run a simple SQL command script.

see you soon

Tags: Oracle Development

Similar Questions

  • Call of from.mxl under linux .sql script file

    Hello Experts,

    I have a requirement to call the sql script in the maxl file in the linux server. I get EOF file error.

    Could you please say how to achieve this requirement.

    MAXL Script:

    Reel to ' / / essbase02//MaxL//Test_MR.log ';

    the value of message level.

    Set timestamp

    echo 'start logging ';

    login "admin", "password" on 'server '.

    echo "beginning of sh execution."

    MSH ' / / essbase02//MaxL//Test_MR.sh';

    / * Create label * /.

    echo "Completed";

    disconnection;

    spool off;

    Contents of the Test_MR.sh file:

    sqlplus-s user@orcl/password @"' / / essbase02//MaxL//TEST.sql '"


    Journal for the maxl:

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    'Start of logging.

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > login "admin" "admin" on "server1.hq.emirates.com";

    OK/INFO - 1051034 - [admin@Native Directory] user connection.

    OK/INFO - 1241001 - connected to Essbase.

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    "Beginning of HS performance."

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > sqlplus-s user@orcl/password @ "/ essbase02/MaxL/TEST." SQL ".

    2 >

    3 >

    4 >

    essmsh error: end of file breaks the statement

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    "Completed".

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > disconnect;

    The user admin is offline

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    Thank you

    RM

    If you want to execute operating system commands you use Shell, not "msh". MSH is to call an additional MaxL script with MaxL orders only.

    Optionally, there should be no need to store the command shell in a separate file, that is, it should be possible to place the command sqlplus directly inside the MaxL script when you use the Shell.

  • How to accept entries of user of the sql script

    I want to create Tablespace using the sql script, but the location of the data file that I need to accept the user. (for the location of the data file).

    How can I accept the user input to pl/sql.

    Example:
      CREATE TABLESPACE  TSPACE_INDIA LOGGING 
         DATAFILE 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf' 
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED 
         EXTENT MANAGEMENT LOCAL;
    Here, I need to accept the location of the user data file IE: "H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf".

    Maybe something like this...

    declare
      flocation varchar2(300) := '&Enter_The_Path';
    begin
      EXECUTE IMMEDIATE 'CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING DATAFILE '''||flocation||
                        '\SRC_TSPACE_INDI_D1_01.dbf'' SIZE 500M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL';
    end;
    

    You will need to properly explain the quotes in your channel and also make sure you have spaces where they should be (for example, after the key word of the DATA file).

    You'd better start with something like this:

    set serverout on
    declare
      flocation varchar2(300) := '&Enter_The_Path';
      v_sql varchar2(32767);
    begin
      v_sql := 'CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING DATAFILE '''||flocation||
               '\SRC_TSPACE_INDI_D1_01.dbf'' SIZE 500M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL';
      dbms_output.put_line(v_sql);
    end;
    

    and see what SQL it generates. When you're happy it generates a valid statement, then you can replace the statement dbms_output with your immediate statement execution.

  • Effect of NLS_LANG in the SQL scripts

    DB version: 11.2.0.2
    Platform: RHEL 5.6


    We have a software provider who occasionally sends SQL scripts to deploy.

    The scripts contain usually few CFDS and many LMD

    Textpad, I can see, the LMD (inserts, updates) in the SQL Script. It usually contains some non-English characters (Dutch, German, French) as
    'Übersicht Buchungssätze' .
    'Fehler beim Löschen der zugeordneten Referenzen!'
    They always ask us set NLS_LANG as follows.
    export NLS_LANG="AMERICAN_AMERICA.WE8ISO8859P15"
    After INSERTION, I questioned the inserted values of PL/SQL Developer. Values appear exactly as it appears in the SQL Script text file as shown above.
    So, what was the effect of the NLS_LANG setting? What would have happened if I had not set NLS_LANG?


    NLS in the DB Info
    SQL > select * from nls_Database_parameters;
    
    PARAMETER                      VALUE
    ------------------------------ ----------------------------------------
    NLS_LANGUAGE                   ENGLISH
    NLS_TERRITORY                  UNITED KINGDOM
    NLS_CURRENCY                   #
    NLS_ISO_CURRENCY               UNITED KINGDOM
    NLS_NUMERIC_CHARACTERS         .,
    NLS_CHARACTERSET               AL32UTF8
    NLS_CALENDAR                   GREGORIAN
    NLS_DATE_FORMAT                DD-MON-RR
    NLS_DATE_LANGUAGE              ENGLISH
    NLS_SORT                       BINARY
    NLS_TIME_FORMAT                HH24.MI.SSXFF
    NLS_TIMESTAMP_FORMAT           DD-MON-RR HH24.MI.SSXFF
    NLS_TIME_TZ_FORMAT             HH24.MI.SSXFF TZR
    NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH24.MI.SSXFF TZR
    NLS_NCHAR_CHARACTERSET         AL16UTF16
    NLS_DUAL_CURRENCY              ?
    NLS_COMP                       BINARY
    NLS_LENGTH_SEMANTICS           BYTE
    NLS_NCHAR_CONV_EXCP            FALSE
    NLS_RDBMS_VERSION              11.2.0.2.0
    
    20 rows selected.

    If our supplier had chosen to save the script with the UTF-8 encoding, then, we have set NLS_LANG. Right?

    Evil. You need to AMERICAN_AMERICA. AL32UTF8. If you don't set NLS_LANG, it uses default AMERICAN_AMERICA. US7ASCII. Therefore, only pure ASCII 7-bit scripts can be executed in such environment. The Oracle Client does not use the default database character. It uses the platform default (usually US7ASCII) or UTF-16 in the case of JDBC, ODBC (Unicode mode) and ODP .NET pilots.

    -Sergiusz

  • MS-DOS (script) to execute in WindowsXP - batch file 'trap' the errorlevel

    I am writing a Batch MS-DOS (script) file to run in Windows XP.  It run 3 programs: PKZIP for z/OS by PKWARE, FTP (BACK) and an MS-DOS Application with us.  How I 'trap' the errorlevel to each of these programs to ensure that they completed successfully?

    Hello

    Because the problem is related to the batch file, I recommend that you post this question in the MSDN forum.
    http://social.msdn.Microsoft.com/forums/en-us/categories/

  • delay the SQL script

    Hello

    I use oracle10g (10.2.0.4) in windows xp service pack 2. I create a batch file and I want to as the next line of my script to run within a period of 5 to 10 seconds. can someone help me do the command in windows?

    Syntax SQL * Plus on Windows is:

    host sleep 
    

    A better solution would be to use DBMS_LOCK. SLEEP because it is a PL/SQL package that runs in the database and do not depend on some OS executable.

    Edited by: P. Forstmann on 28 Dec. 2010 08:50

  • How to get the log file for the .sql file?

    Friends,

    OS: RHEL AS 3
    DB: 9iR2

    I have a file as sql...
    @/u02/scripts/olback.sql
    exit;
    the olback.sql is to have the user manage backup scripts.
    I saved the code above as weeklybkp.sql
    I have weeklybkp.sh that I call the sql above.
    When I type the olback.sql in the sqlplus manually... I can able to see the result.
    now after the automation... I have to see the output of the script above in a log file.
    How can I save the output of the script above in a log file?

    Thank you

    Slight change in your .sql file.
    coil /u02/weeklybkp.log
    ............ (Here begins your code)
    ............
    ............ (Here ends your code)
    spool off

  • Flashing batch file returns the control too fast

    Hi I have a frustrating problem with a simple batch file that I am running on a W2003 server. For simplicity, it did something like this:

    copy a b
    call runprog.exe
    If errorlevel 0 goto done
    echo "error".
    output
    : fact
    echo 'ok '.

    This has been working for a long time, suddenly and only on 1 times out of 10, while it just started running runprog.exe, control is returned in the batch file and it goes to the error condition. On the other 9 times of 10, she does not return control until runprog.exe has finished (as expected).
    I reloaded runprog and tried a new copy of c:\windows\system32\cmd.exe. I also tried runprog.exe without the call - the same results.

    My conclusion is that something underlying in windows is damaged and he needs fixing with SFC or a recharge, but grateful for any ideas who would not so much here

    Thank you very much

    Hello

    The question you posted would be better suited to the TechNet community. Please visit the link below to find a community that will provide the support you want.

    http://TechNet.Microsoft.com/en-us/WindowsServer/bb512919.aspx

    Hope this information is useful.

  • How to assign the variable in the SQL script?

    I have the below running to generate the XML from the file.
    set long 100
    set pages 0
    set trimspool on
    set serveroutput on
    set echo off
    set terminal off
    variable out CLOB
    begin
            pack.proc('&&1','&&2',:out);
    end;
    /
    spool /dir/loc/file1.xml
    select :out from dual;
    spool off
    I'm queue in the order of the coil, the output to a file named file1.xml. I invoke this SQL script from a shell script, I will pass variable association 3rd since the shell script which I want to use in the file ' & & 3'.xml. Help me set this variable to the DIGITAL field in this SQL script and how can I add to the command of the coil?
    set long 100
    set pages 0
    set trimspool on
    set serveroutput on
    set echo off
    set terminal off
    variable out CLOB
    define var1='&1' -- to allow for more readable code
    define var2='&2'
    define var3 ='&3'
    begin
            pack.proc('&var1','&var2',:out);
    end;
    /
    spool /dir/loc/file&var3..xml -- note the substition variable has  . appended
    print out
    spool off
    

    ------------
    Sybrand Bakker
    Senior Oracle DBA

  • Insert the SQL script for BLOBs

    Hello

    I managed to upload my word and pdf documents in the database using blob support APEX and have these columns in the MY_DOC table

    , VARCHAR2 (400) FILE NAME NOT NULL
    BLOB_CONTENT BLOB
    , VARCHAR2 (48) MIME_TYPE

    Now I want to migrate the data to another environment by using an insert SQL script, how to respond to the BLOB column in the insert script?

    Kind regards

    ADE

    You cannot migrate data blob with insertion of scripts. However, you can achieve this by using the datapump...

    Example:

    expdp sysadm/sysadm tables = dumpfile = dump.dmp logfile = expdp_dump.log patterns =
    Impdp sysadm/sysadm dumpfile = dump.dmp

    BR,

    Nico

  • Automatic execution of the batch file at the connection of the USB drive

    I created a batch file that checks the drive e. the presence of a specific file, and if there, copy it to a location on the hard drive. (Drive E is where all USB drives see the place through my window of Windows Explorer.) I would like to set up my computer so that this batch file is executed whenever such a device is plugged into the USB port. How can I accomplish that?

    Otherwise, is it possible to incorporate the Attaché-USB-player status in the batch file itself and just leave that batch file running at any time? I used "IF EXISTS E:\*.*", but that is not do me much good, because I have to keep control of this condition again and again, and eventually the batch file gets tired of the audit and said that the drive does not exist.

    Hello

    You can ask your question on the TechNet forums for batch files.

    http://social.technet.Microsoft.com/forums/en-us/category/windowsvistaitpro

  • Disorder of batch file - redirect the contents of the directory in a text file

    I wrote a batch file that's used to work (until the upgrade to Win7). The goal of the program is to simply write the contents of a directory in a text file. I currently use the timeout to add to this text file every minute to test the program. That should give me a timeline when the contents of the directory to change throughout the day.

    It's the batch file:

    Here is the result:

    The actual file changes in size throughout the day, but the dir command does not seem to recognize any changes being made to the directory.

    If I go into the directory in Explorer, the file shows the old size and timestamp and update then immediately to the right size and time. After doing this the batch file now saves the change to the directory, but he will be stuck there until I refresh the directory in Explorer again.

    As I said above, it worked on XP but not in Windows 7.

    Does anyone have an idea how do the command dir to refresh the directory before you write in the text file? Or ideas of another method to achieve the same goal? I used to work on a Unix workstation and I used 'touch' to perform this function

    Thanks in advance for any help,

    Tom

    Ask this query in Technet

    http://social.technet.Microsoft.com/forums/Windows/en-us/home?category=w7itpro&filter=AllTypes&sort=lastpostdesc

  • "findstr" is not recognized as internal or external, command an executable program or batch file. in the batch (.bat) Windows file

    my code is below:
    off @echo
    CD. > list.txt
    for /f "delims =" % in (' dir / a-d/b * .txt "") (echo %%i)>>list.txt
    echo. > list.txt

    MD "20".
    for /f "delims =" % in (step.txt) do)
    for /f "delims =" % in ('findstr /c:"%%j" ")

    List.txt'))
    move ' % k ' '20 '.
    )
    )
    pause

    I run it in normal mode and the cmd gets "" findstr"is not recognized as an internal or external command
    operable program or batch file. »

    What is the problem?

    Thank you

    The reason is "environment variables".

    Add 'C:\Windows\System32' on the 'path' of the 'system variables' is OK.

  • How to pass arguments to the SQL Script in command prompt

    I don't know about the ' & nom_de_variable "to request a value in the command line.

    But, how can I pass arguments from the command line for the following script to the command - prompt

    Example:

    ex_proc. SQL

    CREATE OR REPLACE PROCEDURE ex_proc (employee_id NUMBE IN)
    IS
    v_emp_id Number (38);
    BEGIN

    v_emp_id: = employe_id;

    UPDATE emp_employee SET sal = 2000 WHERE emp_id = v_emp_id;

    END;
    /


    call_ex_proc. SQL

    Appellant for procedure above:

    BEGIN

    ex_proc (100); -The employee id is 100.

    END;
    /

    Here are the General controls that we use to run the scripts above-

    SQL > @ex_proc.sql

    SQL > @call_ex_proc.sql



    But my requirement is to pass the employee id as an argument in the command line as.
    SQL > @call_ex_proc.sql 100

    Is it possible to pass command line arguments?

    Usually this question start with reading documentation, wouldn't it?

    Solomon Yakobson showed you the method gross and unreadable.

    You will use best

    set = '& 1' '.

    -use & in the rest of the code

    ----------
    Sybrand Bakker
    Senior Oracle DBA

  • either or in the sql script

    Hi all

    Oracle db 10g

    I have a sql script that is like
    CURSOR c IS
    select s.sid,s.serial#
              from gv$session s, gv$process p, gv$locked_object l
                where l.session_id = s.sid
                and floor(mod(last_call_et,3600)/60) > 3
                and l.object_id in (438239,332790,46237,362927)
                and s.module in ('JSWPKSLIPN','OEXOEORD','ICPCKLOT','JSWPKSHIPHRM','JAINEORD')
                and s.status='INACTIVE'
                and s.paddr = p.addr;
    
    c_row c%ROWTYPE;
    
    l_sql VARCHAR2(100);
    
    BEGIN
    
    OPEN c;
    
    LOOP
    FETCH c INTO c_row;
    EXIT WHEN c%NOTFOUND;
    l_sql := 'alter system kill session '''||c_row.sessionid||','||c_row.serialid||'''';
    EXECUTE IMMEDIATE l_sql;
    END LOOP;
    
    CLOSE c;
    END;
    /
    In the above script as I must include conditions
    s.module in ('JSWPKSLIPN','OEXOEORD','ICPCKLOT','JSWPKSHIPHRM','JAINEORD') and
    s.last_call_et/1800 > 1
    and
    s.action like 'FRM%'
    and
    s.status='INACTIVE'
    So that the cursor c gets all the inactiive and serial No. session id and put loop and kills the session... ? He must check the two conditions and if any condition returns the lines, he should kill?

    Thank you
    Baskar.l

    Loops of slider like the one you posted since out-of-date Oracle 8i over 12 years ago.

    Learn how to process rows tables not simple.
    http://www.morganslibrary.org/reference/array_processing.html

Maybe you are looking for

  • Recovery of the factory from 32 bit to 64 bit with the note system performance

    Recovery of the factory from 32 bit to 64 bit with the note forever system performance, it's about associated wirehttp://forums.computers.Toshiba-Europe.com/forums/thread.jspa?threadID=50433which is closed/locked, and had no correct answer. I just bo

  • Satellite P870 - operational noises

    Various regular intervals, my model emits strange noises, when I first heard them I thought that the unit was defective. Of course, they are difficult to describe, but they are like a rattle, type click noise. Sometimes, they are rather pronounced cl

  • Audio beats missing on HP ENVY 15z

    Hello Like many other users also my audio beats disappeared.  But there is no specific position to ENVY 15z j000, that will help me to restore it. Please provide a solution for my model similar to the following: http://h30434.www3.HP.com/T5/notebook-

  • Get the error message "connection Wireless not found" after re-installation of Windows vista

    Original title: I reinstalled just the OS (Vista) on a Dell laptop and I get a message saying that not found wireless I'm rebvuilding a laptop Dell Inspiron 1525 using the original disks. When I try to connect to the internet, I get a message saying

  • Z10 blackBerry HELP NEEDED

    Since the OS on my Blackberry Z10 has been updated, I had endless problems... at the beginning I was not receiving messages and then when I received that I have to restart my phone to allow me to read and respond... This product whenever I receive an