Running sql script from unix using

Hello!
When i run the following sql, it doesn't executes any statement after the 1st SQL.
anyone know the reason?
#!/bin/bash
set -x
echo test
sqlplus /nolog << EOF
set serveroutput on size 1000000
conn userid/pwd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=10.92.xxx.xxx)(Port=1521))(CONNECT_DATA=(SID=oradbid)))
select '1st sql output' from dual;
exit
EOF.
sqlplus /nolog << EOF
set serveroutput on size 1000000
conn userid/pwd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=10.92.xxx.xxx)(Port=1521))(CONNECT_DATA=(SID=oradbid)))
select '2nd sqloutput' from dual;
exit
EOF
--------------------------------

You have to remove . (dot) after first EOF.
Best regards
Maxim

Similar Messages

  • Calling SQL scripts from subdirectories using SQL*Plus 9.2.0.1

    Is it possible to run an SQL script that in turn calls other SQL scripts from subdirectories? This seemed to work fine using SQL*Plus 8.1.7
    Did it break in 9.2.0.1?
    Any fixes available?

    Ryan,
    What exactly is your problem? Can you tell me any errors you are seeing? Platform?
    Alison

  • Running sql script from pl/sql

    Is there any standard way to run an external sql script from pl/sql
    I really appreciate any assistance.

    If you want, I did start writing a function reading and executing statements out of sql script with utl_file.
    can I issue this command in PL/SQL: EXECUTE IMMEDIATE '@filename.sql';
    the function could be extended for DDL, session setting, etc...
    Regards
    Laurent

  • Running  sql scripts from different directory

    Hi
    I have sql scripts in different directories as follows:
    D:\myapp\sql
    - load.sql
    - init.sql
    D:\myapp\sql\schema
    -users.sql
    -structure.sql
    D:\myapp\sql\populate\
    - data1.sql
    - data2/sql
    load.sql call all the other scripts as below:
    @init.sql
    @schema\users.sql
    @schema\structure.sql
    @populate\data1.sql
    @populate\data2.sql
    All my scripts run correctly when I run load.sql from D:\myapp\sql on comand prompt.
    I need a way to run this script from a different directory say D:\ or C:\
    I am writing a installer which will execute from a different directory.
    Right now I get a file not found error for scripts within schema an populate folder.
    Please let me know how can I make this work from a different directory.
    Thanks
    kelvin

    Hi peter. i think you cannot run files spread across different locations.
    --the method which u specified always looks to the defined path                                                                                                                                                                                                                                                                                       

  • Need command to run sql script from sql prompt

    Hi,
    I am beginner in sql i need a command to run sql file from sql prompt.In notepad i have write 10 to 15 tables creation and saved as .sql i want to run this file from sql promp pls some one help.I am very great full to all users in this forum.

    You can also use the 'start' command.
    You may also want to look in the SQLPlus User Guide and Reference (for your release) at the set command for commands to set the number of lines per page, turn headings on or off, and so on:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/toc.htm
    HTH -- Mark D Powell --

  • Is it Possible to Run SQL Script from Java prog

    Hello
    Is there any API by which we can run SQl Script file ,
    Just by giving database configration parameters and SQL Script file Path ,it will execute that script automatically

    You can excute SQL statemetns throught JDBC, but that doesn't have a facility to read those statements from a file. You'd have to write code to read the file and create and execute statements through JDBC. That should be pretty straightforward though.
    It's conceivable that there's a third party library out there that does it, if you know what to look for.
    If you're not familiar with JDBC, check out http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/

  • Running SQL scripts from a unix directory

    DB version: 11.2
    os Version : Solaris 5.10
    We have a set of scripts used by DBAs for displaying Tablespace free space info, file size info...etc
    Currently these .sql files (say free_Space.sql) are stored in directory /u02/dba_scripts/ . To execute these scripts a dba has to navigate to this directory and then login to sql* plus and from there execute it like
    SQL > @free_Space.sqlI've recently come across an environment where you can login to SQL*Plus from any directory and you can execute scripts like above from any directory . How is this possible? What settings should i set for this?

    Herbaceous wrote:
    DB version: 11.2
    os Version : Solaris 5.10
    We have a set of scripts used by DBAs for displaying Tablespace free space info, file size info...etc
    Currently these .sql files (say free_Space.sql) are stored in directory /u02/dba_scripts/ . To execute these scripts a dba has to navigate to this directory and then login to sql* plus and from there execute it like
    SQL > @free_Space.sqlI've recently come across an environment where you can login to SQL*Plus from any directory and you can execute scripts like above from any directory . How is this possible? What settings should i set for this?environmental variable SQLPATH

  • Running SQL scripts from CF server

    Hi,
    I'm new to ColdFusion, but not to database or web
    development. I'm wondering if there's anyway I can run a SQL script
    on a database from my CF server. I'm running CF 5 on a 2003 Windows
    server with a couple Oracle 9i DBs on the backend. I want to move
    data from one DB to the other, but can't use a DB link between the
    two, so a colleague suggested using CF to migrate the data. Is this
    possible?
    Thanks

    It's possible. For each db, cold fusion needs a connection
    and sufficient permissions.

  • Run SQL Script from a a Batch File

    I'm trying to schedulling a SQL Script by Windows Scheduler:
    START 
    "C:\Program Files\Microsoft SQL Server\100\DTS\Binn\dtexec.exe" /FILE "C:\Users\tstjs\TESTESTESTES.sql" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF  /REPORTING EWCDI
    PAUSE
    However, when I run the batch file it giving the error below:
    ...sql" due to error 0xC00CE556 "Invalid at the top level of the document. Line 1, Column 1". This happens when loading a package and the file cannot be opened o r loaded correctly into an XML document. This can be the result of either provid
    ing an incorrect file name to the LoadPackage method or the XML file specified h aving an incorrect format. End Error
    How can I solve that problem?
    Thanks!

    Hi SaQvl,
    As Scott metioned, you shall use sqlcmd to execute a tsql script. You can reference the below link
    Use the sqlcmd Utility
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Run sql script from database

    Is this possible in some form?
    <cfquery name="name" datasource="dsn">
    #query.sqlstatement#</cfquery>

    Yes, if you mean creating a query as a string, then using
    that in a cfquery. Usually you would need to enclose the query text
    within a PreserveSingleQuotes() function if you have parameters
    that are enclosed within single quotes, something like this
    <cfquery name="name" datasource="dsn">
    #PreserveSingleQuotes(sqlstatement)#
    </cfquery>
    Phil

  • How to run sql scripts using batch file for a web dynpro data dictionary

    Hi,
    I want to develop a sql script to be executed on the server alongwith the installation of a product to pre-populate web dynpro data dictionary tables required for the application.
    I further require to make the scripts independent of the database name,so that it can be run at any client environment.
    Your help will be appreciated and rewarded.

    See shoblock's answer
    call sql script from unix
    masterfile.sql:
    @file1 &1
    @file2 &2
    @file3 &3
    @file4 &4
    then just call the master script:
    sqlplus userid/password @masterfile <p1> <p2> <p3> <p4>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Sql script in UNIX

    When I run a sql script in unix using sqlplus command, the process halts at some point. No matter how long I wait, it does not finish (it does not bring the command prompt back). There are no problems in SQL*PLUS. This process usually takes about 30 mins when I run from SQL * PLUS. Any ideas why it hangs in UNIX?
    sqlplus -s userid @script
    Thanks

    Are you specifying a password ?
    Have you set the ORACLE_SID ?

  • Getting windows error during running the sql scripts from form 6i

    I made a little form application. The purpose of this application is to generate explain plan for a particular SQL. Some sql scripts run internally in order to populate the result on form’s screen after pressing the form’s button but I am getting windows error during running the sql scripts from form 6i.
    I am using forms 6i with patch 17 with Oracle 10G database on windows 2000 professional on same computer.
    This application runs fine with 8i.
    Please inform me where the problem is and how to overcome it.
    Zafri.

    I am using Text_IO in my form's when button press trigger , inorder to create the
    text file, then in the same when button press triger
    I am calling RMAN via host command in order to run the script which was created by text_IO.
    Below you find some of the code. I will appreciate if you solve the problem.
    when button press trigger:
    Declare
    in_file3 Text_IO.File_Type;
    linebuf3 VARCHAR2(1800);
    output11 varchar2(1000);
    BEGIN
         output11:='C:\EXPLAIN_PLUS\misc\rm_file.bat ';
    Host(output11,no_screen);
    :sql.execution_plan:= 'Working........................';
    synchronize;
    in_file3 := Text_IO.Fopen('c:\explain_plus\misc\create_table.txt', 'w');
    Text_IO.Put_Line(in_file3, linebuf3);
    Text_IO.put_line(in_file3,' ');
    Text_IO.put_line(in_file3,' run { sql "create table PLAN_TABLE (statement_id,...object_name varchar2(30),object_instance numeric,object_type varchar2(30),optimizer varchar2(255),search_columns number,id .....partition_start varchar2(255),partition_stop  varchar2(255),partition_id numeric,other long,distribution varchar2(30)) "; } ');
    Text_IO.put_line(in_file3,' ');
    Text_IO.put_line(in_file3,' ');
    Text_IO.FCLOSE(in_file3)
              Declare
    un VARCHAR2(80);
    pw VARCHAR2(80);
    cn VARCHAR2(80);
    output VARCHAR2(1000);
    output2 VARCHAR2(1000);
    dummy varchar2(40);
    in_file Text_IO.File_Type;
    linebuf VARCHAR2(1800);
    BEGIN
         Get_Connect_Info(un,pw,cn);
         /* for Plan_table Begg. Second INNER BLOCK */
         declare
              dummy2 varchar2(40);
         begin
         select table_name into dummy2 from all_tables where table_name='PLAN_TABLE';
         if dummy2 = 'PLAN_TABLE' then
         output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\MISC\TRUNC2.txt ' ;
    Host(output2,no_screen);
         end if;
         exception
         when no_data_found     then
    output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\misc\create_table.txt ';
    Host(output2,no_screen);
         end; --

  • How to run a script from Oracle Form (Beside using HOST command)

    I would like to run a script from Forms 6.0. I know that we can actually issue this command :
    host('plus80.exe' username/password@connect_string @c:\scriptname);
    BUT, is there any other alternative ?

    Sqlplus is a different program, so one way or the other you have to leave Forms to run sqlplus. What is you objection against HOST?
    You can also run sqlplus from the database, but again you need a stored java procedure to call sqlplus (sort of HOST command that runs in the database).
    Francois' solution works if your script just has a query to run, but if you have specific sqlplus commands (spool etc.) forms_ddl is probably not a solution.

  • Running a sql script from stored procedure

    Hi everyone!
    Has anybody tell me how to execute a sql script from a stored
    procedure!
    Thanks in advance!
    Sasa

    >
    Hi everyone!
    Has anybody tell me how to execute a .sql file from a stored
    procedure!
    Thanks in advance!
    Sasa Sorry, a .sql file!!

Maybe you are looking for

  • A suggestion about statspack...

    Hi , I need a suggestion in statspack and sql tuning/db performance when an application runs...... Imagine that I run some forms/reports e.t.c. developed with Developer Suite 10.2 , say form1 , form2 , form3 , form4 .... form15 in a time of 10 minute

  • Passing data to IP address and PORT???

    Hi, I am trying to do a scenario, where in I need to make a synchronous call to a IP address and Port. The scenarion is SAP--> XI --> IP address/Port. Has anyone done this scenario, wherin you pass the string of data to a IP address and port? Regards

  • "Prices of good Movement wiil be Negative."

    While Doing GR i am getting error as "Prices of Goods Movement Will Be Negative" What could be the Possible Reason, Can it be somwhat related to Currency Conversion Factor but in this Case this may not be the Reason. Please Suggest. Thank you in Adva

  • My safari keeps crashing when I open it.

    Everytime I open safari, it crashes right after the homepages loads. Can anyone help me out with this? Please and thank you! Process:         Safari [299] Path:            /Applications/Safari.app/Contents/MacOS/Safari Identifier:      com.apple.Safa

  • Regarding sourcing application.

    hai everyone,            i am using classic scenario.suppose i have configured in img : sourcing for product category (sourcing alwyas carried out).my question is when a user entered the particular product category in shopping cart what will happens?