Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

configure listener.ora and tnsnames.ora

448 views
Skip to first unread message

ilbmbo

unread,
Aug 5, 2009, 9:45:28 AM8/5/09
to
hy, my system have a Database Oracle on a server Linux distro Suse
with Oracle Entarprise Manager 10g


I'm doing a little programm in Visual c++ that do a query on the
database from an other pc with windows in a network with the linux pc.


But i have a problem with the connection to the Db, infact when i open
the database i have this error on oracle Db:

ORA-12505: TNS:listner does not currently know of SID given in connect
descriptor (DBD ERROR: OCI ServerAttach)


and my software connect to database only sometimes.....


so i think that my file listener and tnsname are wrong...

the listener.ora is empty, end the tnsname.ora is:

# tnsnames.ora Network Configuration File: /opt/oracle/product/10.2/
db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

AFTIDI =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux-gle.Id)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = AFTIDI)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = AFTIDI)
(PRESENTATION = RO)
)
)

can you help me?

ddf

unread,
Aug 5, 2009, 9:49:43 AM8/5/09
to

From a command prompt what does the command

lsnrctl status

display?


David Fitzjarrell

ilbmbo

unread,
Aug 5, 2009, 9:55:03 AM8/5/09
to
oracle@linux-gle:/> lsnrctl services

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 05-AUG-2009
15:48:11

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "AFTIDI" has 1 instance(s).
Instance "AFTIDI", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:93 refused:0 state:ready
LOCAL SERVER
Service "AFTIDIXDB" has 1 instance(s).
Instance "AFTIDI", status READY, has 1 handler(s) for this
service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: linux-gle, pid: 7725>
(ADDRESS=(PROTOCOL=tcp)(HOST=linux-gle.Id)(PORT=53184))
Service "AFTIDI_XPT" has 1 instance(s).
Instance "AFTIDI", status READY, has 1 handler(s) for this
service...
Handler(s):
"DEDICATED" established:93 refused:0 state:ready
LOCAL SERVER
The command completed successfully

this is the result of your comand....

thanks for help


ddf

unread,
Aug 5, 2009, 10:18:44 AM8/5/09
to

Good, then autoregistration is working. Now try this from a command
prompt on the client:

tnsping aftidi

and report what is displayed.


David Fitzjarrell

ilbmbo

unread,
Aug 5, 2009, 10:32:01 AM8/5/09
to
hy, i have test your command with this results:


oracle@linux-gle:/> tnsping aftidi

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 05-
AUG-2009 16:32:47

Copyright (c) 1997, 2005, Oracle. All rights reserved.

Used parameter files:
/opt/oracle/product/10.2/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST


= linux-gle.Id)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = AFTIDI)))

OK (0 msec)

thanks a lot

Viktor Zacek

unread,
Aug 5, 2009, 10:44:23 AM8/5/09
to
ilbmbo <ilb...@gmail.com> wrote:

> oracle@linux-gle:/> tnsping aftidi

David Fitzjarrell asked for the test on the client...

linux-gle is the database server, I think you wrote about a windows
client.


Best regards,
Viktor

ilbmbo

unread,
Aug 5, 2009, 10:56:23 AM8/5/09
to
On win pc (client) if i use the command C:\ tnsping aftidi i have
this:


File id parametri utilizzati:
c:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora

TNS-03305 Impossibile risolvere il nome


the file sqlnet.ora in linux pc is:

# sqlnet.ora Network Configuration File: /opt/oracle/product/10.2/db_1/
network/admin/sqlnet.ora


# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)


thanks, luca.

Viktor Zacek

unread,
Aug 5, 2009, 11:19:13 AM8/5/09
to
Ok... just for recapitulation:

- Client: Windows: Connect via Visual C++
- Server: Linux: runs database
- Client: tnsnames.ora not configured
- Server: tnsnames.ora / listener.ora / sqlnet.ora configured

How do you connect with Visual C++? Directly with hostname + port +
servicename? Or via alias (which would presume a working oracle client)


Best regards,
Viktor

ilbmbo

unread,
Aug 5, 2009, 11:23:58 AM8/5/09
to
On 5 Ago, 17:19, usenet2...@zacek.de (Viktor Zacek) wrote:
> Ok... just for recapitulation:
>
> - Client: Windows: Connect via Visual C++ OK
> - Server: Linux: runs database OK
> - Client: tnsnames.ora not configured OK
> - Server: tnsnames.ora / listener.ora / sqlnet.ora configured OK but listener.ora is empty file.

>
> How do you connect with Visual C++? Directly with hostname + port +
> servicename? Or via alias (which would presume a working oracle client)
>
> Best regards,
> Viktor

in my software in visual C++ use:
String^ connectionString = gcnew String ("Data Source=(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST= linux-gle)(PORT=1521))(CONNECT_DATA=
(SERVICE_NAME=AFTIDI)));User Id=XXXXXXXX;Password=XXXXXX");
System::Data::OracleClient::OracleConnection^ conn = gcnew
System::Data::OracleClient::OracleConnection(connectionString);
conn->Open();

so in this mode i can connect but sometimes i have error in
TNS:listener

Viktor Zacek

unread,
Aug 5, 2009, 11:37:22 AM8/5/09
to
ilbmbo <ilb...@gmail.com> wrote:

> in my software in visual C++ use:
> String^ connectionString = gcnew String ("Data Source=(DESCRIPTION=
> (ADDRESS=(PROTOCOL=TCP)(HOST= linux-gle)(PORT=1521))(CONNECT_DATA=
> (SERVICE_NAME=AFTIDI)));User Id=XXXXXXXX;Password=XXXXXX");
> System::Data::OracleClient::OracleConnection^ conn = gcnew
> System::Data::OracleClient::OracleConnection(connectionString);
> conn->Open();
>
> so in this mode i can connect but sometimes i have error in
> TNS:listener


Interesting...

I would do the following during development (you have to talk with your
DBA about corresponding steps):

- shutdown the database
- delete all logfiles on server and client
- sync time between client and server (or just note the difference)
- start the database
- use program only to test the connect (simply a loop which connects
every 10 seconds, and disconnects, print time if connect not successful)
- check logfiles on server (esp. listener and alert log and client (esp.
sqlnet.log) at printed times for errors


I only delete the logfiles for pure lazyness... its easier to search in
nearly empty logfiles ;-)


Best regards,
Viktor

ilbmbo

unread,
Aug 5, 2009, 11:57:22 AM8/5/09
to
On 5 Ago, 17:37, usenet2...@zacek.de (Viktor Zacek) wrote:


now i can't do this, because my DBA is on holiday....


but for me the problem is in listener.ora in server because is empty
and if i try to configure it the listener don't work when i start it!


ddf

unread,
Aug 5, 2009, 12:23:35 PM8/5/09
to
> and if i try to configure it the listener don't work when i start it!- Hide quoted text -
>
> - Show quoted text -

How are you trying 'to configure it the listener'? Show us your
listener.ora file after you've modified it to 'configure' the listener
so we can see if you have any syntax errors.


David Fitzjarrell

ilbmbo

unread,
Aug 6, 2009, 3:44:08 AM8/6/09
to


with this listener.ora i can't start the listener from OEM:


# listener.ora Network Configuration File: /opt/oracle/product/10.2/
db_1/network/admin/listener.ora


# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = AFTIDI)
(ORACLE_HOME = /opt/oracle/product/10.2/db_1)
(PROGRAM = extproc)
)
)

LISTENER =
(DESCRIPTION_LIST =


(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux-gle.Id)(PORT = 1521))

)
)

if i type this command :

oracle@linux-gle:/> lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-AUG-2009
09:34:00

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /opt/oracle/product/10.2/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /opt/oracle/product/10.2/db_1/network/admin/
listener.or
a
Log messages written to /opt/oracle/product/10.2/db_1/network/log/
listener.log
TNS-01150: The address of the specified listener name is incorrect

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


- if i use a listener.ora empty i have:

oracle@linux-gle:/> lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-AUG-2009
09:39:05

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /opt/oracle/product/10.2/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /opt/oracle/product/10.2/db_1/network/admin/
listener.or a
Log messages written to /opt/oracle/product/10.2/db_1/network/log/
listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-gle.Id)
(PORT=1521) ))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 -
Production
Start Date 06-AUG-2009 09:39:05
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/10.2/db_1/network/admin/
listener.o ra
Listener Log File /opt/oracle/product/10.2/db_1/network/log/
listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux-gle.Id)(PORT=1521)))
The listener supports no services
The command completed successfully
oracle@linux-gle:/> lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-AUG-2009
09:40:07

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully


but when i use EOM to start database and when i try to connect at Db
with my Visual c++ software I have the problem that i have write
yesterday.....

and my sqlnet.ora is:

# sqlnet.ora Network Configuration File: /opt/oracle/product/10.2/db_1/
network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

thanks a lot!!!

ddf

unread,
Aug 6, 2009, 8:15:55 AM8/6/09
to
> > David Fitzjarrell- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -

>
> - Show quoted text -

You must define the LISTENER before you can define the
SID_LIST_LISTENER so reverse thos entries in your listener.ora:

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux-gle.Id)(PORT = 1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = AFTIDI)
(ORACLE_HOME = /opt/oracle/product/10.2/db_1)
(PROGRAM = extproc)
)
)


David Fitzjarrell

ilbmbo

unread,
Aug 6, 2009, 8:46:05 AM8/6/09
to
using your Listener.ora i have this error:


oracle@linux-gle:/> lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-AUG-2009

14:45:04

Viktor Zacek

unread,
Aug 6, 2009, 10:33:18 AM8/6/09
to
Greetings!

> > - Client: Windows: Connect via Visual C++
> OK
> > - Server: Linux: runs database
> OK
> > - Client: tnsnames.ora not configured
> OK
> > - Server: tnsnames.ora / listener.ora / sqlnet.ora configured
> OK but listener.ora is empty file.


Could you try to copy the tnsnames.ora from the server to the client?
If you do a tnsping <dbname> you will get the directory where to put it
(sqlnet.ora and tnsnames.ora are in the same directory).

What happens, if you then try to connect?


Best regards,
Viktor

ilbmbo

unread,
Aug 6, 2009, 10:38:29 AM8/6/09
to
I have already try this, but i can't to connec in thsi way

to connect on my database from client i type comand http://linux-gle:1158/em
in the browser and i have access to OEM of my database...

Viktor Zacek

unread,
Aug 6, 2009, 10:46:04 AM8/6/09
to
ilbmbo <ilb...@gmail.com> wrote:

> I have already try this, but i can't to connec in thsi way

What error do you get? From postings in this thread I could not you
already tried this.


> to connect on my database from client i type comand http://linux-gle:1158/em
> in the browser and i have access to OEM of my database...

Yeah... well... connecting to enterprise manager is not the same as
connecting with a locally installed client. You connect to a web
interface on the server, and the webserver connects locally to the
database (simplified).


Best regards,
Viktor

Viktor Zacek

unread,
Aug 6, 2009, 10:46:04 AM8/6/09
to
ilbmbo <ilb...@gmail.com> wrote:

> using your Listener.ora i have this error:

We usually name our listeners... so try the following one, which I
copied from a 10g server on a SLES9 machine:


LISTENER10g =


(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux-gle.Id)(PORT = 1521))
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = AFTIDI)
(ORACLE_HOME = /opt/oracle/product/10.2/db_1)
(PROGRAM = extproc)
)
)


Listener would be started with:
"lsnrctl start 10g"


Best regards,
Viktor

ilbmbo

unread,
Aug 6, 2009, 12:01:23 PM8/6/09
to
when a try start listener 10g i have this error:

TNS-01151: missing listener name,10g in LISTENER.ORA

listener failed to start. See the error message above

sybr...@hccnet.nl

unread,
Aug 6, 2009, 3:25:33 PM8/6/09
to
On Thu, 6 Aug 2009 16:46:04 +0200, usene...@zacek.de (Viktor Zacek)
wrote:

Actually this file is incorrect

It should be

LISTENER10g =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux-gle.Id)(PORT = 1521))
)


SID_LIST_LISTENER10g =


(SID_LIST =
(SID_DESC =
(SID_NAME = AFTIDI)
(ORACLE_HOME = /opt/oracle/product/10.2/db_1)
(PROGRAM = extproc)
)
)

--
Sybrand Bakker
Senior Oracle DBA

Viktor Zacek

unread,
Aug 6, 2009, 4:32:37 PM8/6/09
to
<sybr...@hccnet.nl> wrote:

> Actually this file is incorrect
>
> It should be
>
> LISTENER10g =
> (DESCRIPTION =
> (ADDRESS = (PROTOCOL = TCP)(HOST = linux-gle.Id)(PORT = 1521))
> )
>
>
> SID_LIST_LISTENER10g =
> (SID_LIST =
> (SID_DESC =
> (SID_NAME = AFTIDI)
> (ORACLE_HOME = /opt/oracle/product/10.2/db_1)
> (PROGRAM = extproc)
> )
> )

Indeed.

Sorry, my fault!


Best regards,
Viktor

ilbmbo

unread,
Aug 7, 2009, 3:37:48 AM8/7/09
to
On 6 Ago, 22:32, usenet2...@zacek.de (Viktor Zacek) wrote:


i have test this listener too, but i have the same error when i try to
start listener 10g

ddf

unread,
Aug 7, 2009, 7:50:19 AM8/7/09
to
> start listener 10g- Hide quoted text -

>
> - Show quoted text -

And how are you trying to start listener10g? It should be


$ lsnrctl start listener10g

David Fitzjarrell

ekonic2

unread,
Aug 7, 2009, 8:27:46 AM8/7/09
to

When my company needed part-time/backup DBA we used www.zibase.com,
these folks are former Oracle Corp consultants.

ilbmbo

unread,
Aug 7, 2009, 8:33:06 AM8/7/09
to

yes i used lsnrctl start listener10g


0 new messages