Execution of SQL Script thru shell script

Execution of SQL Script thru shell script

Post by Sridh » Thu, 04 Sep 2003 02:07:50



hi all,
I have a piece of SQL code(some insert statement). Unix server. Oracle
DB.
I need to execute the sql code in the unix shell ... as in as a part
of a batch process...

i have a loginid password... for oracle
i believe that there is some sql command that can be embeded in the
shell script ? ne one aware ?

something like
sqlplus username/password ...
statement to execute sql file...
i need exact syntax...

Any help is appreciated !
regards

 
 
 

Execution of SQL Script thru shell script

Post by j.. » Thu, 04 Sep 2003 02:24:27



> I have a piece of SQL code(some insert statement). Unix
> server. Oracle DB.  I need to execute the sql code in the unix shell
> ... as in as a part of a batch process...

> i have a loginid password... for oracle i believe that there is some
> sql command that can be embeded in the shell script ? ne one aware ?

> something like
> sqlplus username/password ...
> statement to execute sql file...
> i need exact syntax...

If you don't get an answer here, try an Oracle oriented newsgroup,
they probably do this kind of thing all the time there. For example

comp.databases.oracle.misc
comp.databases.oracle.server
comp.databases.oracle.tools

Joe

 
 
 

Execution of SQL Script thru shell script

Post by Kevin Rodger » Thu, 04 Sep 2003 03:09:13



> hi all,
> I have a piece of SQL code(some insert statement). Unix server. Oracle
> DB.
> I need to execute the sql code in the unix shell ... as in as a part
> of a batch process...

> i have a loginid password... for oracle
> i believe that there is some sql command that can be embeded in the
> shell script ? ne one aware ?

> something like
> sqlplus username/password ...
> statement to execute sql file...
> i need exact syntax...

Here's how I do it in one of my scripts:


        INSERT ...;
        exit
        _sql

--
Kevin Rodgers

 
 
 

Execution of SQL Script thru shell script

Post by Dan Merce » Thu, 04 Sep 2003 03:19:54


: hi all,
: I have a piece of SQL code(some insert statement). Unix server. Oracle
: DB.
: I need to execute the sql code in the unix shell ... as in as a part
: of a batch process...
:
: i have a loginid password... for oracle
: i believe that there is some sql command that can be embeded in the
: shell script ? ne one aware ?
:
: something like
: sqlplus username/password ...
: statement to execute sql file...
: i need exact syntax...
:
: Any help is appreciated !
: regards

There are plenty of scripts on the server that use sqlplus.
Just find/grep under the oracle install for sqlplus and you
should see plenty of examples.

Dan Mercer

 
 
 

Execution of SQL Script thru shell script

Post by Bill Marcu » Thu, 04 Sep 2003 05:57:01


On 2 Sep 2003 10:07:50 -0700, Sridhar

> hi all,
> I have a piece of SQL code(some insert statement). Unix server. Oracle
> DB.
> I need to execute the sql code in the unix shell ... as in as a part
> of a batch process...

> i have a loginid password... for oracle
> i believe that there is some sql command that can be embeded in the
> shell script ? ne one aware ?

> something like
> sqlplus username/password ...
> statement to execute sql file...
> i need exact syntax...

man sqlplus
apropos sql

--
Commander Spiral Pyjama Pseudo-Rhinocerous Feline Thingamajig Bill Marcum
(the First)
Ozy and Millie Name Generator http://heifong.phase.org/omname.php

 
 
 

Execution of SQL Script thru shell script

Post by Stein Arne Storslet » Thu, 04 Sep 2003 19:40:30




>> hi all,
>> I have a piece of SQL code(some insert statement). Unix server. Oracle
>> DB.
>> I need to execute the sql code in the unix shell ... as in as a part
>> of a batch process...

>> i have a loginid password... for oracle
>> i believe that there is some sql command that can be embeded in the
>> shell script ? ne one aware ?

>> something like
>> sqlplus username/password ...
>> statement to execute sql file...
>> i need exact syntax...

> Here's how I do it in one of my scripts:


>    INSERT ...;
>    exit
>    _sql

sqlplus -s /nologin << END

  <do you magic>;
  exit
END

--
Stein Arne

 
 
 

Execution of SQL Script thru shell script

Post by Stein Arne Storslet » Thu, 04 Sep 2003 19:46:56





>>> hi all,
>>> I have a piece of SQL code(some insert statement). Unix server. Oracle
>>> DB.
>>> I need to execute the sql code in the unix shell ... as in as a part
>>> of a batch process...

>>> i have a loginid password... for oracle
>>> i believe that there is some sql command that can be embeded in the
>>> shell script ? ne one aware ?

>>> something like
>>> sqlplus username/password ...
>>> statement to execute sql file...
>>> i need exact syntax...

>> Here's how I do it in one of my scripts:


>>        INSERT ...;
>>        exit
>>        _sql

> sqlplus -s /nologin << END

>  <do you magic>;
>   exit
> END

I were supposed to comment my reply as well...

Using the method described above your login information will not show in
the process list (ps -ef).

--
Stein Arne

 
 
 

Execution of SQL Script thru shell script

Post by Kevin Rodger » Fri, 05 Sep 2003 02:41:06




>>sqlplus -s /nologin << END

>> <do you magic>;
>>  exit
>>END

> I were supposed to comment my reply as well...

> Using the method described above your login information will not show in
> the process list (ps -ef).

Thanks for the tip!

--
Kevin Rodgers

 
 
 

Execution of SQL Script thru shell script

Post by Sridh » Sat, 06 Sep 2003 05:52:48


GREAT Guys !
thank _ALL_ of you for the great follow ups !!
they are totally invaluable !
Thanks a Lot !
Sridhar
 
 
 

Execution of SQL Script thru shell script

Post by Sune A » Sat, 06 Sep 2003 07:40:04


Hi Sridhar (and others)

You migth want to look at is this very good 5 page article:
Oracle Programming - The UNIX way. By Ian Craig. Interacting with
Oracle via the UNIX Korn shell
http://www.oracle.com/oramag/webcolumns/2001/op_unixway.html

Regards Sune


Quote:> GREAT Guys !
> thank _ALL_ of you for the great follow ups !!
> they are totally invaluable !
> Thanks a Lot !
> Sridhar