title: Can connect to database with sqlplus directly, but not when setting ORACLE_SID
body: <p>I am trying to connect to a database in a shell script.  I can connect fine if I use this:</p>
  
  <pre><code>sqlplus user/pass@db_service_name
  </code></pre>
  
  <p>However, when I try something like this, it is not working:</p>
  
  <pre><code>ORACLE_SID=db_sid
  export ORACLE_SID
  sqlplus /nolog
  connect user/pass
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>ERROR:
  ORA-12545: Connect failed because target host or object does not exist
  </code></pre>
  
  <p>Obviously I am missing something, but this is an area I am not fully familiar with, so I am not sure where I am going wrong.  My assumption was that if I set the ORACLE_SID, that I would not need to identify my db when connecting in sqlplus.  Is my assumption incorrect?  Or am I missing some required step or configuration?</p>