Oracle difference between SID, DB Name, DB Domain, Global Database Name, Service Name, Service Alias and Instance Name

Solution 1:

SID = identifies the database instance (database name + instance number). So if your database name is somedb and your instance number is 3, then your SID is somedb3.

DB Name = Name of the database (database can be shared b/t multiple instances)

DB Domain = Usually the same as your company domain (somecompany.com)

Global Database Name = Database name + database domain (somedb.somecompany.com)

Service Name = A "connector" to one or more instances. It is often useful to create additional service names in a RAC environment since the service can be modified to use particular SIDs as primary or secondary connections, or to not use certain SIDs at all.

Service Alias = An alias to the service name (just like a CNAME, etc). Say you make your service name something meaningful to the dba, but perhaps it's a bit esoteric. Create a service alias and name it something that will be meaningful to the user.

Instance name = same as SID

Solution 2:

The way you describe SID is only the DEFAULT behaviour in a RAC config. The SID (== instance_name) is just that: The name of your instance.

I always look at it like this: An Instance, is an Instance of the RDBMS software. An instance MOUNTS a controlfile, (alter database mount) In this controfile are written the location of the datafiles. the collection of datafiles (okay, and the controlfile(s) ) == the database.

A database has a name, the db_name, and (optionally) a domain (db_domain) --> together global_db_name. Now imagine you're replicating (DataGuard) your database. You'd like to keep the DB_name the same, right? (I mean: data-wise, it's the SAME database) But then how to identify the two 'versions' of your database? Enter ' DB_UNIQUE_NAME'... Yes, it's getting confused...

My personal practice is to name the INSTANCE like the db_unique_name in a DataGuard setup, and stick with the RAC-names (db_name+Instance_Number) in a RAC setup. Then, the db_unique_names I make up, are generally like db_name + 1-letter-suffix (MYDBa MYDBb etc.)

Cheers, Paul