LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Oracle Connection problem (https://www.linuxquestions.org/questions/linux-software-2/oracle-connection-problem-334389/)

nelnel 06-16-2005 08:31 PM

Oracle Connection problem
 
I am doing a school project. Try to make a database application program in linux to connect remote oracle database server(LAN).
Actually, i am the newbie of the oracle database. I have downloaded the oracle 9i release 2 from Oracle.com. And i have installed the Oracle 9i clientto the linux. But how could i connect the remote server??
Do i need to specify the IP and User/PWD of the Oracle Database Server in the Oracle 9i Client Config.?
Also, are there any GUI Management Interface for the Oracle Client to test some SQL statement, like the window one?

I have read the Oracle Admintration Guide and Installation Guide, but still don't have idea of the above questions...

Thx for ur help!!

bentz 06-17-2005 03:49 PM

You need to configure tnsnames.ora, which is buried somewhere in the oracle installation directory. psql is a command line utility that you can use to query the server, and I don't believe it's hard to use (but it does have it's quirks). Also, if you've installed all the GUI stuff, you can start up the Net9 Assistant and punch in the values you need to connect to the remote server in a GUI interface. This will set up your tnsnames.ora file for you.

duliano 06-17-2005 09:12 PM

Typically though, tnsnames.ora and listener.ora are setup to allow connections to port 1527 by default. Unless you have more than one instance of oracle running on the machine you should not have to adjust those files. Can you connect to oracle via sqlplus? Did you doing a ps -ef |grep lsnctrl ? if the listener is not running you will not be able to connect remotely even though you can connect via sqlplus.

Hope this helps

nelnel 06-20-2005 03:00 AM

first of all, thanks for ur help.

i already get the Remote Oracle Database Name and IP, also the User/pwd. but i don't know where to input the ip.
I know in Window, i can input the info. into the connection dialog box, but in linux i can't find this config.

Now i try to use SQLPLUS to connect the DB, but no place to input the ip and server name.

I follow bentz said, i find the tnsnames.ora and sqlnet.ora in the ORACLE_HOME/ network/admin/samples/ folder. but not in the outside. i don't know it is my setup problem or the other problem.... :(

About the net 9.... i can't find it to run....>_<

Sorry to asking this kind of stupid question. Are there any book can be suggested to me to learn the setting of the ORacle Clients in LINUX???

THX ALOT AGAIN!!!

sadun 06-22-2005 02:57 AM

Hi,

It is simple. Just why are you bothering with ip. Oracle uses its internal mechanism to connect. You just need to enter your username your password and database sid to connect. For example you have a database named orcl in the host machine which has a name dbserver and your sys password is oracle then at sqlplus screen u need to write

connect sys as sysdba/oracle@orcl

Or at the sqlplus screen there are three tabs. First tab your name. Second tab your password. Third tab at this example u need to write orcl@hostname

If however you cant login with that way than you need to check your tnsnames.ora, listener.ora and sqlnet.ora to ensure with your network settings. At that point if you get any error then post it here. Your hostname and ip settings are in tnsnames.ora and listener.ora.

If you need deeper technical explanation just ask. For documentation visit Oracle documentation center


Best regards

nelnel 06-27-2005 03:21 AM

thx for ur help

when i type ur mentioned command , it shows

ORA-12154: TNS:could not resolve service name

What problem of it???

sadun 06-27-2005 04:17 AM

Hi,

Which operating system do you have? The error message is clear. It says that you dont have orcl service running. Post the contents of your sqlnet.ora listener.ora and tnsnames.ora. Looking inside sqlnet.log and listener.log may show the problem. Also explaining your network architecture may be helpful. So I can point the exact problem. Anyway if you want to do it yourself (As this is school work :)). Try these

At command prompt or shell type

lsnrctl status

see if the listener exists and type

lsnrctl stop
and
lsnrctl start

to restart listener if that doesnt help then you can start netmanager utility and create new listener.ora tnsnames.ora and sqlnet.ora. If all fails you need to take sqlnet and listener trace.

You can take it by applying following lines to your sqlnet.ora and listener.ora

TRACE_LEVEL_<CLIENT/LISTENER/SERVER>=16

TRACE_DIRECTORY_<CLIENT/LISTENER/SERVER>=<directory name>

LOG_DIRECTORY_<CLIENT/LISTENER/SERVER>=<directory name>

This will produce a trace which will point the exact problem

Best Regards,

nelnel 06-27-2005 05:02 AM

thx

whe i type lsnrctl status
it shows this message

Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused

i have copy the tnsnames.ora ans sqlnet.ora from my partner computer(He is doing the Window Client side program to connect the same oracle database. He is successfully connect to the database)
And put them to my Linux .....still fail, what's problem of it????

my sqlnet.ora:
NAMES.PREFERRED_SERVERS =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = DD5)(PORT = 1575))
(ADDRESS = (PROTOCOL = TCP)(HOST = DD6)(PORT = 1575))
)

SQLNET.EXPIRE_TIME = 0
NAMES.DIRECTORY_PATH= (ONAMES, TNSNAMES)
~

my tnsnames.ora:

SPDCBACK =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dd1)(PORT = 1521))
(CONNECT_DATA = (SID = s01))
)

i try to run this command but fail: sqlplus ouser/12345@SPDCBACK
B.R.

sadun 06-27-2005 06:03 AM

You didnt give me the requested information either way...

1-
Quote:

Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNSrotocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Means you have no listener. You said i copied tnsnames.ora and sqlnet.ora. What about listener.ora check if you have it and if properly configured. If possible post your listener.ora here.

2-You can delete all three files and type

netmgr

at shell to create your net setting automatically.


Quote:

NAMES.PREFERRED_SERVERS =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = DD5)(PORT = 1575))
(ADDRESS = (PROTOCOL = TCP)(HOST = DD6)(PORT = 1575))
)
This means you are using oracle name service authentication. It is unusual for testing purposes. Are you sure for that? That is why i asked for your network architecture. It is like you have some other oracle application like OAS or you have multiple servers.

Quote:

SQLNET.EXPIRE_TIME = 0
Just delete that line from your sqlnet.ora as it is tricky for catching errors.

Quote:

SPDCBACK =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dd1)(PORT = 1521))
(CONNECT_DATA = (SID = s01))
)

i try to run this command but fail: sqlplus ouser/12345@SPDCBACK
The correct syntax need to be sqlplus ouser/12345@s01
Listener.ora handles the s01 description (Your database service)

nelnel 06-27-2005 08:07 PM

unlucky, when i try netmgr, it displays another error on the screen:

[oracle@H733-00011 9.2.0]$ netmgr
/opt/oracle/jre/1.1.8/bin/../lib/i686/native_threads/libzip.so: symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time reference (libzip.so)
Unable to initialize threads: cannot find class java/lang/Thread
Could not create Java VM

i try to search from google, i find that it may need older version of JVM or the multi-JVM in the same system problem.

But i don't know how to solve it.....

About the Listener...as the Database Admin. has gone to the trip, i can't ask him now......and i see my partner's Window version is working well.... i think the listener is OK...but don't know where is fail .....

BR

nelnel 06-28-2005 12:43 AM

thanks sadun, i have solved the solution...after i reinstall the Oracle Client....may be some error occur during last installations

sadun 06-28-2005 02:01 AM

Great!! Sorry couldnt help much.

joerifeyen 03-28-2006 06:35 AM

Hello, im having the same stupid problem can you guys help me?
I have Linux Suse 10 , im running Oracle 9 (Database on network) and PHP 5.
I have done the connection on a windows machine and it worked but on linux...

When i type ./lsnrctl status:
LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 28-MAR-2006 14:31:52

Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=GM75P0J)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directoryv

When i try to lsnrctl stop:
onnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=GM75P0J)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory


When i try to start:


Starting /home/oracle/u01/app/oracle/product/9.2.0//bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 9.2.0.4.0 - Production
NL-00280: error creating log stream /home/oracle/u01/app/oracle/product/9.2.0/network/log/listener.log
NL-00278: cannot open log file
SNL-00016: snlfohd: error opening file
Linux Error: 13: Permission denied

Listener failed to start. See the error message(s) above...

When i type netmgr:
ernie:/home/oracle/u01/app/oracle/product/9.2.0/bin # ./netmgr
/home/oracle/jre/1.1.8/bin/../bin/i686/native_threads/jre: relocation error: /home/oracle/jre/1.1.8/bin/../lib/i686/native_threads/libjava.so: symbol __libc_wait, version GLIBC_2.0 not defined in file libc.so.6 with link time reference

I hope you can help me..

sadun 03-29-2006 05:13 AM

Hi there,

It is so clear that you couldnt do oracle installation right. Oracle is not certified on Suse 10. It is certified with SLES9. It is possible installing with SUSE10 but you need to double check pre-installation requirements.

Pls post your installlation log for clarifying the situation.

Best Regards,

joerifeyen 03-29-2006 06:12 AM

I dont know its done right. Im a stagair and have to make something with php and oracle. Its installed. I can access sqlplus...
My listener is not working, im not having a database local its remote. :scratch: There is ann oracle account:s. Where is the installation log?


All times are GMT -5. The time now is 08:17 PM.