In my environment, however, nearly every database has a db_unique_name value that contains an underscore, which we use to denote the datacenter location. For example, in our dataguard configuration for "prod", prod_ny would be in New York where as prod_sf would be in San Francisco. The fact that it is part of a dataguard configuration is irrelevant, we have this configuration with standalone databases (e.g. staging1_ny) as well just to be consistent. In the first example, both databases have a db_name and ORACLE_SID of "prod", and the second example would have an ORACLE_SID of staging1.
However when you add this to Oracle Restart by the typical default syntax, you'll run into a problem. When the instance_name is not specified, srvctl will use the db_unique_name but strip out any underscore characters. This results in an instance_name value of "staging1ny" in the following example, when we were running under just "staging1" previously:
$ srvctl add database -d staging1_ny \
> -o /oracle/app/product/11.2 \
> -p /mnt/staging1/pfile/spfilestaging1.ora \
> -r PHYSICAL_STANDBY -s open -t immediate
$ srvctl config database -d staging1_ny
Database unique name: staging1_ny
Database name:
Oracle home: /oracle/app/product/11.2
Oracle user: oracle
Spfile: /mnt/staging1/pfile/spfilestaging1.ora
Domain:
Start options: open
Stop options: immediate
Database role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
Database instance: staging1ny
Disk Groups:
Services:
The solution is simply to either use -i to specify the instance_name when adding the database, or use the "srvctl modify database" command to specify it afterward, like this:
$ srvctl modify database -d staging1_ny -i staging1
$ srvctl config database -d staging1_ny
Database unique name: staging1_ny
Database name:
Oracle home: /oracle/app/product/11.2
Oracle user: oracle
Spfile: /mnt/staging1/pfile/spfilestaging1.ora
Domain:
Start options: open
Stop options: immediate
Database role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
Database instance: staging1
Disk Groups:
Services: