title: How does Oracle database know the global database name and the location of database files merely from ORACLE_HOME and ORACLE_SID?
body: <p>How does Oracle database know the global database name merely from ORACLE_HOME and ORACLE_SID?</p>
  
  <p>My <code>ORACLE_SID</code> is <code>foosid</code> and my database name is <code>foogdn</code>. In fact, the global database name is <code>foogdn.example.com</code>. This is demonstrated in the shell and sqlplus session below.</p>
  
  <pre><code>$ export ORACLE_SID=foosid
  $ export ORACLE_HOME=/home/ora/app/ora/product/12.1.0/dbhome_1
  $ "$ORACLE_HOME/bin/sqlplus" / as sysdba
  
  SQL*Plus: Release 12.1.0.2.0 Production on Tue Aug 2 12:20:19 2016
  
  Copyright (c) 1982, 2014, Oracle.  All rights reserved.
  
  Connected to an idle instance.
  
  SQL&gt; startup
  ORACLE instance started.
  
  Total System Global Area  419430400 bytes
  Fixed Size          2925120 bytes
  Variable Size         285216192 bytes
  Database Buffers      125829120 bytes
  Redo Buffers            5459968 bytes
  Database mounted.
  Database opened.
  SQL&gt; show con_name
  
  CON_NAME
  ------------------------------
  CDB$ROOT
  SQL&gt; select * from global_name;
  
  GLOBAL_NAME
  --------------------------------------------------------------------------------
  FOOGDN.EXAMPLE.COM
  
  SQL&gt; select name from v$controlfile;
  
  NAME
  --------------------------------------------------------------------------------
  /home/ora/app/ora/oradata/foogdn/control01.ctl
  /home/ora/app/ora/fast_recovery_area/foogdn/control02.ctl
  
  SQL&gt; select name from v$datafile;
  
  NAME
  --------------------------------------------------------------------------------
  /home/ora/app/ora/oradata/foogdn/system01.dbf
  /home/ora/app/ora/oradata/foogdn/sysaux01.dbf
  /home/ora/app/ora/oradata/foogdn/undotbs01.dbf
  /home/ora/app/ora/oradata/foogdn/pdbseed/system01.dbf
  /home/ora/app/ora/oradata/foogdn/users01.dbf
  /home/ora/app/ora/oradata/foogdn/pdbseed/sysaux01.dbf
  /home/ora/app/ora/oradata/foogdn/pdborcl/system01.dbf
  /home/ora/app/ora/oradata/foogdn/pdborcl/sysaux01.dbf
  /home/ora/app/ora/oradata/foogdn/pdborcl/pdborcl_users01.dbf
  
  9 rows selected.
  
  SQL&gt; 
  </code></pre>
  
  <p>Two questions:</p>
  
  <ol>
  <li>How did the database figure out that the <code>GLOBAL_NAME</code> for <code>ORACLE_SID=foosid</code> is <code>foogdn.example.com</code>? The only pieces of clues I provided were <code>ORACLE_SID</code> and <code>ORACLE_HOME</code> and then started the database. Then the database seems to have figured out on its own that the global database name is foogdn.example.com. How did it do that? Where does it store the mappings of <code>ORACLE_SID</code> to <code>GLOBAL_NAME</code>?</li>
  <li>How did the databae figure out the location of the database files? Where is this information stored?</li>
  </ol>