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?
From a command prompt what does the command
lsnrctl status
display?
David Fitzjarrell
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
Good, then autoregistration is working. Now try this from a command
prompt on the client:
tnsping aftidi
and report what is displayed.
David Fitzjarrell
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
> 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
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.
- 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
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
> 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
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!
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
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!!!
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
oracle@linux-gle:/> lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 06-AUG-2009
14:45:04
> > - 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
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...
> 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
> 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
TNS-01151: missing listener name,10g in LISTENER.ORA
listener failed to start. See the error message above
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
> 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
i have test this listener too, but i have the same error when i try to
start listener 10g
And how are you trying to start listener10g? It should be
$ lsnrctl start listener10g
David Fitzjarrell
When my company needed part-time/backup DBA we used www.zibase.com,
these folks are former Oracle Corp consultants.
yes i used lsnrctl start listener10g