ORA-12154: TNS:could not resolve service

Posts   
 
    
Romi
User
Posts: 11
Joined: 21-Aug-2009
# Posted on: 22-Aug-2009 00:10:20   

Hi All,

I have been struggling with this error since long time.

my application is using LLBLGen 2.0.0.0 version to connect to Oracle database (10.2.0.4). We have oracle client with version 9.2.0.4 installed in the application server.

The problem is that my application some times (not consistence) throws ORA-12154: TNS:could not resolve service exception. Some times it works fine and some times we get this error message in different pages. Once this error start occouring it keep occouring and after some time it starts working by itself. Some times so happens that our application keep getting this error and our application is down, then we have to restart our IIS, which fixes the problem for couple of hours.

My connection string is Data Source=DatabaseSID.DOMAIN NAME; User Id=XYZ; Pwd=ABC I am successfully being able to use TNSping. TNSping uses sqlnet.ora files which points to sqlnet.names. Sqlnet.names uses NAMES.DIRECTORY_PATH = (TNSNAMES, ONAMES). I think if i am able to use TNSping that indicates the sqlnet.ora/sqlnet.names file is fineconfused .

I have below question as i have observed that when traffic increases the number of above exception increases. Q 1) I can see in the helper class generated by LLBL, it uses System.Data.OracleClient.oracleConnection to establish a connection. OracleConnection represents an open connection. I do not find in any place, the connection is beeing closed. For every save that i hit a transaction is being used, we are closing that transaction, but not connectin.

Q2) After we get exception on a page we are login the error in a table. To my surprise if i get TNS error, even after that the error is being loged in the database. I am unable to understand if the system could not resolve service name for request then how could it establish connection to database to log error? I am providing the stack trace below. Please help me get rid of this problem.cry

Thread account name: NT AUTHORITY\NETWORK SERVICE Is impersonating: False Stack trace: at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OracleClient.OracleConnection.Open() at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.ExecuteMultiRowRetrievalQuery(IRetrievalQuery queryToExecute, ITransaction containingTransaction, IEntityCollection collectionToFill, Boolean allowDuplicates, IEntityFields fieldsUsedForQuery) at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.PerformGetMultiAction(ITransaction containingTransaction, IEntityCollection collectionToFill, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, Int32 pageNumber, Int32 pageSize) at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, Int32 pageNumber, Int32 pageSize) at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations)

Romi
User
Posts: 11
Joined: 21-Aug-2009
# Posted on: 22-Aug-2009 02:15:52   

Further information :-

  1. We have only one oracle client installed on our server. The oracle client components are a. Oracle base network config 1.01 b. Oracle Net 9.2.0.4.0 c. oracle provider for OLEDB 9.2.0.4.0 d. Oracle data provider for .Net 9.2.4.0 e. ODBC Driver 9.2.0.54

  2. locatin of Sqlnet.ora file is C:\Oracle\v9204\network\ADMIN My sqlnet.name file looks like DISABLE_OOB = OFF USE_DEDICATED_SERVER = OFF SQLNET.EXPIRE_TIME = 2147483647 SQLNET.AUTHENTICATION_SERVICES=(NONE) TRACE_LEVEL_CLIENT = OFF TRACE_UNIQUE_CLIENT = OFF TRACE_DIRECTORY_CLIENT = c:\oracle\network\traces TRACE_FILE_CLIENT = sqlnet.trc LOG_DIRECTORY_CLIENT = c:\oracle\network\traces LOG_FILE_CLIENT = sqlnet.log TNSPING.TRACE_LEVEL = OFF TNSPING.TRACE_DIRECTORY = c:\oracle\network\traces NAMES.DIRECTORY_PATH = (TNSNAMES, ONAMES) NAMES.DEFAULT_DOMAIN = domain name NAMES.PREFERRED_SERVERS = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = onames01) (Port = 1522) ) (ADDRESS = (PROTOCOL = TCP) (Host = onames02) (Port = 1522) ) (ADDRESS = (PROTOCOL = TCP) (Host = oranms01.hou281) (Port = 1522) ) (ADDRESS = (PROTOCOL = TCP) (Host = oranms02.hou281) (Port = 1522) ) (ADDRESS = (PROTOCOL = TCP) (Host = oranms01.sr) (Port = 1522) ) (ADDRESS = (PROTOCOL = TCP) (Host = oranms02.sr) (Port = 1522) )

    )

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-Aug-2009 07:10:36   

Do you have any tsnames.ora on that folder?

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39882
Joined: 17-Aug-2003
# Posted on: 22-Aug-2009 10:09:56   

Additionally: these kind of errors are thrown by the Oracle client which is called by System.Data.OracleClient, so it's likely we can't do much about it. That said, we will try to help you out, in case we think of something that might lead to the solution. It's indeed strange that you see something logged in the DB if it's an error to connect to the DB! simple_smile

Connections are closed in DaoBase. I'm not sure which runtime version you're using, please download the latest build of 2.0.0.0's runtime lib from the customer area to make sure any bugs in the runtime lib are at least covered.

Any name of the server in the tnsnames file has to be looked up. This could fail (i.e. network error, dns error), a connection to the oracle service could fail (e.g. too busy)...

Frans Bouma | Lead developer LLBLGen Pro
Romi
User
Posts: 11
Joined: 21-Aug-2009
# Posted on: 24-Aug-2009 18:46:35   

Hi,

Thanks for your quick response. we have one more sqlnet.ora file in C:\Oracle\v9204\network\ADMIN\SAMPLE we have one more TNSNAMES.ORA in C:\Oracle\v9204\network\ADMIN\SAMPLE

we are using sqlnet.ora file located in C:\Oracle\v9204\network\ADMIN

Please suggest cry

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39882
Joined: 17-Aug-2003
# Posted on: 24-Aug-2009 19:20:00   

Do you have an Oracle support contract? If so, could you please contact oracle as well to see if they have suggestions? The reason for this is that our code simply uses the connection string given and opens a connection. If that fails for some reason due to network errors or other problems in the Oracle client, we can't do anything about that unfortunately.

Frans Bouma | Lead developer LLBLGen Pro