Create unique DB_NAME and DB_DOMAIN for an Oracle 11g instance I am somewhat confused by these terms in the init.ora file:


db_domain
db_name
instance_name


plus the database name which is provided to the create database command. I do not completely understand how they sum up. I have read the Oracle docs several times but still failed to understand.
As far as I understand, a database can be mounted and used by several instances in a RAC which I do not use. This means that db_name has to be the same as in create database?!

This is my setup:

I have 2 machines host1, host2. Both are in the same subdomain dom1.company.net. Both have an instance which hosts the same database but one in for the production system and the other one is the test system.

If I name both data, do I have a name collision?

Thanks for clearing up.
No, you do not have a name collision.  Your DB_DOMAIN, DB_NAME, and INSTANCE_NAME can all be identical as long as the databases are on different hosts (as you have indicated).  However, as others have stated using the same DB_NAME is a bad idea for anything other than perhaps a recovery operation.  A policy enforcing distinct passwords will be broken.  Connections will be confused.  Most things you can do to ensure that changes are not inadvertently made on production are probably worth the hassle.

Here is the relevant documentation:

DB_DOMAIN


  In a distributed database system, DB_DOMAIN specifies the logical
  location of the database within the network structure. You should set
  this parameter if this database is or ever will be part of a
  distributed system. The value consists of the extension components of
  a global database name, consisting of valid identifiers (any
  alphanumeric ASCII characters), separated by periods.
  
  Note: Oracle recommends that you specify DB_DOMAIN as a unique string
  for all databases in a domain.
  
  This parameter allows one department to create a database without
  worrying that it might have the same name as a database created by
  another department. If one sales department's DB_DOMAIN is
  JAPAN.ACME.COM, then their SALES database (SALES.JAPAN.ACME.COM) is
  uniquely distinguished from another database with DB_NAME = SALES but
  with DB_DOMAIN = US.ACME.COM.
  
  If you omit the domains from the name of a database link, Oracle
  expands the name by qualifying the database with the domain of your
  local database as it currently exists in the data dictionary, and then
  stores the link name in the data dictionary. 


DB_NAME


  DB_NAME specifies a database identifier of up to 8 characters. This
  parameter must be specified and must correspond to the name specified
  in the CREATE DATABASE statement.
  
  If you have multiple databases, the value of this parameter should
  match the Oracle instance identifier of each one to avoid confusion
  with other databases running on the system. The value of DB_NAME
  should be the same in both the standby and production initialization
  parameter files.


INSTANCE_NAME


  In a Real Application Clusters environment, multiple instances can be
  associated with a single database service. Clients can override
  Oracle's connection load balancing by specifying a particular instance
  by which to connect to the database. INSTANCE_NAME specifies the
  unique name of this instance.
  
  In a single-instance database system, the instance name is usually the
  same as the database name.