title: Error connecting Oracle - ORA-12638: Credential retrieval failed
body: <p>I am getting the following error while using linked server in sql to connect and external oracle db</p>
  
  <pre><code>Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "xxxx".
  OLE DB provider "OraOLEDB.Oracle" for linked server "xxx" returned message "ORA-12638: Credential retrieval failed".
  </code></pre>
  
  <p>I am having this issue around 4 out 5 times. So it works only sometimes.</p>
  
  <p>In my case, the test and live oracle DB(external) is on the same physical server with different SID/db instance.</p>
  
  <p>The test connection using OraOLEDB works consistently, it's the live linked server that's the problem.</p>
  
  <p>Also to take out the network from equation I tried connecting oracle live from our test environment and oracle test from our live. Connection to oracle test works fine irrespective and live doesn't.</p>
  
  <p>I can connect to the application fronting the External Oracle DB fine using the live login credentials that are used for the live linked server. So that to me takes the login account out of the question.</p>
  
  <p><strong>Question 1</strong>:- Is there any other way to connect to external Oracle DB from either via sql or C#?</p>
  
  <p>I used openrowset as below and get an error:</p>
  
  <pre><code>SELECT *
  FROM OPENROWSET('OraOLEDB.Oracle', 'Data Source=external_Oracle_serverIP;Initial Catalog=bbinstance;User id=xxx; Password=xx;',
  'SELECT * FROM dbname')
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>OLE DB provider "OraOLEDB.Oracle" for linked server "(null)" returned message "ORA-12560: TNS:protocol adapter error". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "(null)".
  </code></pre>
  
  <p><strong>Question 2</strong>: What am I doing wrong above?</p>