質問

Background

I am working a new job and trying to set up my local environment. At the moment, I cannot debug our web solutions on visual studio 2008 because I believe I did not configure oracle 11g correctly when I installed it (getting an ORA-1254-TNS: could not resolve identifier specified" error. TNS is not an issue because doing direct connect in the solution). So I am pretty sure I need to reconfigure or reinstall my local 11g oracle with the right installation parameters.

Problem

All previous developers have left before I even came. Nothing is documented. I do, however, have access to one of the machines where a developer was working. I am trying to figure out what parameters this developer used when used oracle 11g 11.2.0 on their machine.

Additional Details

There are at least 50 websites and most of them were written in visual studio 2008. So when I load the vs 2008 solutions, I need a way to connect to whatever servers they made for these websites (in order to debug a site).

I need to make sure my local development environment allows me to debug. So I am talking about software installation of Oracle 11g. It is a client side installation. This is because I need a way for my client 11g to be able to connect to whatever servers they have developed.I do not have access to the local database on their machine that they created (and I believe that was only used for local development of websites. They called it client1, but I don't know how the username or password).

Edits

When I didn't have oracle 11g I got the following error:

  1. System.Exception: System.Data.OracleClient requires Oracle client software version 8.1.7 or greater

So after installing the client, I then get the error:

  1. ORA-1254: TNS: could not resolve the connect identifier specified

Here is code for the connection settings:

      public static DataSet ExecuteQuery(string sql)
        {
            OracleConnection oraConnection = new OracleConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
            OracleCommand oraCommand = new OracleCommand(sql, oraConnection);
            oraConnection.Open();
}

Here is the error message for the code above:

Exception Details: System.Data.OracleClient.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified

Source Error:

Line 391:            OracleConnection oraConnection = new OracleConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
Line 392:            OracleCommand oraCommand = new OracleCommand(sql, oraConnection);
Line 393:            oraConnection.Open();
Line 394:
Line 395:            OracleDataAdapter oraAdapter = new OracleDataAdapter(oraCommand);

Source File: c:\projects\websiteNew\App_Code\CatalogDB.cs    Line: 393 

Stack Trace: 


[OracleException (0x80131938): ORA-12154: TNS:could not resolve the connect identifier specified
]
   System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc) +310694
   System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +683
   System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +133
   System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +40
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +29
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +72
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +457
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +100
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +116
   System.Data.OracleClient.OracleConnection.Open() +40
   Catalog.CatalogDB.ExecuteQuery(String sql) in c:\projects\websiteNew\App_Code\CatalogDB.cs:393
   Catalog.CatalogDB.GetCompanyInfo(String portal_id) in c:\projects\websiteNew\App_Code\CatalogDB.cs:367
   Global.CompanyInfo() in c:\projects\websiteNew\App_Code\Global.asax.cs:69
   Global.Session_Start(Object sender, EventArgs e) in c:\projects\websiteNew\App_Code\Global.asax.cs:55
   System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) +8878884
   System.Web.SessionState.SessionStateModule.CompleteAcquireState() +237
   System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +504
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +66
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Here is the connection string. I edited it to have fake names/passwords/etc for security:

  <connectionStrings>
    <remove name="ConnectionString"/>
    <add name="ConnectionString" connectionString="Data Source=ZARDOZ;Persist Security Info=True;User ID=fake1;Password= f8k3r;Unicode=True" providerName="System.Data.OracleClient"/>
    <add name="ZARDOZPubsConnectionString" connectionString="Data Source=ZARDOZ-DB2.were.not.in.oz;Initial Catalog=COMM2000;Persist Security Info=True;User ID=fake2;Password=f8k3r" providerName="System.Data.SqlClient"/>
    <add name="ADConnectionString" connectionString="LDAP://were.not.in.oz/DC=were,DC=not,DC=in,DC=oz"/>
  </connectionStrings>

Edit

I have determined that the previous devs' are using tnsnames, put they were in ~/network/admin/ directory. I changed my *.ora files to look like theirs. I am now getting the following error:

ORA-12638: Credential retrieval failed

I will give upvotes to whoever comments and helps me fix this. I need to be able to debug code so that I can do my job, at the moment, I can't do that. :(

Thanks, GeekyOmega

役に立ちましたか?

解決

What exactly have you changed in *.ora files? Could you publish their current content? Try to play with this file: NETWORK\ADMIN\sqlnet.ora I'd recommend to set

SQLNET.AUTHENTICATION_SERVICES = (NONE) 

If that won't help, then just try different values (but for me NONE worked perfectly). Also check this one NETWORK\ADMIN\tnsnames.ora you need record for your database there.

Also I experienced some difficulties when I had only x64 version of client. They were partially gone after I installed x86 version as well.

他のヒント

Here is a simple explanation of what I did to fix the problem. The key was to look in the following directory NETWORK\ADMIN\:

  1. tnsnames.ora Added information that was present in the old dev machines. That is, we connected to two databases

  2. sqlnet.ora As stated by another user here. It is essential that SQLNET.AUTHENTICATION_SERVICE = (NTS) is changed to SQLNET.AUTHENTICATION_SERVICE = (NONE).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top