Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

Speaking to an Oracle base

Paul Murray
Occasional Contributor

Speaking to an Oracle base

Dear Gurus,

I am trying to write a small script that will insert a row into an Oracle table on a central database server host.

Problem is, I want to execute this script on a number of different servers, some of which do not have Oracle installed.

Can you give me some pointers on how to speak to remote databases

Many thanks in advance,

Paul M.

PS -- Oracle v7.3.4.4, HPUXv11.
My Brain Hurts !!!!!
John Palmer
Honored Contributor

Re: Speaking to an Oracle base


You'll need to run the Oracle client 'sqlplus' somewhere.

This can either be:-
- locally on the server where the database is running
- on a remote server with Oracle client installed and with TNS configured so that Oracle's networking software can reach the database.

If you don't have Oracle client installed on a server then can you configure 'remsh' so that you can run a script on one that has?

Rhonda Thorne
Frequent Advisor

Re: Speaking to an Oracle base


Are you wanting to run this script at a UNIX level? IF so, hen you can do an if statement to check for pmon. If pmon is running, then oracle exists and is running on this server.

Hope this is helpful, but needed more information to offer more


Sharing my knowledge of UNIX flavors
Carl Stehman
Occasional Visitor

Re: Speaking to an Oracle base

If the scenario is that you want to connect to the
Oracle Host and execute a script that resides on the Oracle host to modify the database, you can do that a couple of ways. If you are running from a unix machine, you can use remsh to login and run a script that will connect to the instance and call sqlplus with the name of the script on the command line, or you can use the
ftp "quote SITE EXEC program" feature to invoke a script
that will call sqlplus with the name of the sql script on
the command line.

Hope this helps.
Patience Persists
Honored Contributor

Re: Speaking to an Oracle base

Hello Paul,

you have to install and configure "Oracle SQL*Net V2"
on the *other* machine. Installation is relatively simple
(except for mount the CD-Rom - check pfs_mount), and
the configuration on the client machine consists of just
one file: "$ORACLE_HOME/network/admin/tnsnames.ora"
or - if it exists there - "/etc/tnsnames.ora".

The content would be something like:

You havw to exchange the lower case words with your
own values: "name" is the name you will have to use as
"connect string" or "host string" in your command line
for "sqlplus" (see below), "hosts" is the name of your
Oracle-server machine, and "instance" must be the name
of the instance running on the server (usually in upper

Be logged in as user "oracle" for the following commands.

Test it with "tnsping":
tnsping name
where "name" is the "name" of the paragraph in your
"tnsnames.ora". You must have started the "listener"
on the server machine before "pinging" it.

Use it with "sqplus":
sqplus user/password@name
where "name" is as before, "user" is the oracle-user
and "password" is his/her password. If you omit it,
you will be asked interactively. But you still need the
"@" character in front of "name" - and *NO* spaces
in between!

On your server machine you must have installed the
server part of "SQL*net V2" and it is only one config
file, again: "listener.ora" - same directories as for the

The file would look like:



Of course, you have to put in your own values...
And you have to start the listener, after that:
lsnrctl start

Check for the running "tnslsnr" process:
ps -ef | grep tns