Actually, there is always confusing between where to set the database name, Tns name in the dataguard parameter which parameter used what to specify the configuration of parameter in configuring the dataguard environment in oracle.
Which parameter use TNS names and DB name?
Following table give the use of parameter:
| Uses | Parameters |
|---|---|
| DB_NAME | DB_NAME |
| DB_UNIQUE_NAME | DB_UNIQUE_NAME, LOG_ARCHIVE_CONFIG |
| TNS Service Name | LOG_ARCHIVE_DEST_2, FAL_SERVER |
| None (Path/Format) | CONTROL_FILES, LOG_ARCHIVE_DEST_1, REMOTE_LOGIN_PASSWORDFILE, LOG_ARCHIVE_FORMAT, DB_FILE_NAME_CONVERT, LOG_FILE_NAME_CONVERT, STANDBY_FILE_MANAGEMENT |
Consider the following entry for more clarity:
| Role | DB_UNIQUE_NAME | TNS Service Name |
|---|---|---|
| Primary Database | chicagodb | chicagotns |
| Standby Database | bostondb | bostontns |
Parameter used in database:
DB_NAME=chicago
DB_UNIQUE_NAME=chicagodb
LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicagodb,bostondb)'
CONTROL_FILES='/arch1/chicago/control1.ctl', '/arch2/chicago/control2.ctl'
LOG_ARCHIVE_DEST_1=
'LOCATION=USE_DB_RECOVERY_FILE_DEST
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=chicagodb'
LOG_ARCHIVE_DEST_2=
'SERVICE=bostontns ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=bostondb'
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
Overview of parameter used in Oracle Dataguard:
| Parameter | Purpose | Uses | Example / Notes |
|---|---|---|---|
DB_NAME | Name of the database as created originally. | ✅ DB_NAME | Same on primary and standby. E.g., DB_NAME=chicago |
DB_UNIQUE_NAME | Unique identifier for each database in the configuration. | ✅ DB_UNIQUE_NAME | E.g., DB_UNIQUE_NAME=chicago, DB_UNIQUE_NAME=boston |
LOG_ARCHIVE_CONFIG | Enables Data Guard and lists all participating databases. | ✅ DB_UNIQUE_NAME | E.g., LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)' |
CONTROL_FILES | Path to control files for database recovery. | ❌ None | E.g., CONTROL_FILES='/oradata/control01.ctl','/oradata/control02.ctl' |
LOG_ARCHIVE_DEST_1 | Local archive destination for redo logs. | ❌ None | E.g., LOCATION=/arch1/chicago/ |
LOG_ARCHIVE_DEST_2 | Remote destination for redo logs (standby). | ✅ TNS Service Name | E.g., SERVICE=boston (TNS entry for standby) |
REMOTE_LOGIN_PASSWORDFILE | Enables remote authentication for redo transport. | ❌ None | Set to EXCLUSIVE or SHARED |
LOG_ARCHIVE_FORMAT | Format for archived redo log filenames. | ❌ None | E.g., LOG_ARCHIVE_FORMAT=log_%t_%s_%r.arc |
FAL_SERVER | TNS name of the primary database used by standby to fetch missing logs. | ✅ TNS Service Name | E.g., FAL_SERVER=boston (TNS entry of primary) |
DB_FILE_NAME_CONVERT | Converts primary data file paths to standby paths. | ❌ None | E.g., ('/oradata/chicago/','/oradata/boston/') |
LOG_FILE_NAME_CONVERT | Converts primary redo log file paths to standby paths. | ❌ None | E.g., ('/log/chicago/','/log/boston/') |
STANDBY_FILE_MANAGEMENT | Automatically manages standby files when primary changes. | ❌ None | Set to AUTO |