experienced the following things useful - on unix/bsd/linux -
sqlplus / << EOF
connect sys as sysdba
startup 
EOF

things like that can be put into shell scripts - eg as startup scripts, for cron jobs 
doing e.g. reports into .pdf's to store on a webserver,....

perl's expect will most likely work like the unix expect. consider autoexpect as a 
beginner.

we have oracle on NT as well. but it will be migrated to solaris and shut down within 
weeks. basically everything that works on unix/linux works in MS as well. if you can 
and want you can install cygwin or unixtools for nt. OR you use perl altogehter - but 
won't find to many tested ready scrits for it. 

my 5€c.
kr MReger



>>> [EMAIL PROTECTED] 12/09 10:29  >>>
On Tue, 9 Dec 2003, Yong Huang wrote:

> Speaking of Perl versus shell, Perl may still be quite primitive in supporting
> two-way communication with an external program e.g. sqlplus. (I have an example
> at www.stormloader.com/yonghuang/computer/OracleAndPerl.html#2waytosqlplus 
> using IPC::Open2). But I think a KornShell coprocess (not a here document) does
> it nicely, i.e. piping a SQL command in and reading the result back, piping
> another command in, reading again, without exiting your sqlplus session. If you
> use Perl DBI (or the old OraPerl), Jared may know this but I'm not sure if you
> can send any arbitary SQL command such as explain plan, shutdown... and read
> its output.

I think Perl with Expect.pm could likely do this without much effort. Expect allows 
you to interact with just about anything that uses a terminal. One fun case comes to 
mind. We have this LED sign (think large rectangular array of LEDs), with an 
undocumented serial interface protocol. All that came with it to control it was this 
old DOS program which would talk to the sign over a serial port. So I whipped up a 
Perl script which used Expect to interact with dosemu (a Linux DOS emulator) to run 
the program, which interacted with the sign, all running on Linux. Works pretty good.

Expect.pm is also nice to interact with network hardware that offers telnet/shell 
command interfaces. Interacting with sqlplus via Expect.pm would be pretty easy as 
well, I would think. It basically works like this:

- Spawn the program you want to interact with
- Expect a particular regex of output from the spawned process
- Act based on that output (send commands, run processes, annoy the NT admin with net 
send packets, etc)
- Wash, rinse, repeat.

-- Dan
========================================================================
   Daniel Hanks - Systems/Database Administrator
   About Inc., Web Services Division
========================================================================
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net 
-- 
Author: Daniel Hanks
  INET: [EMAIL PROTECTED] 

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com 
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Markus Reger
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to