Creating an Oracle Data Guard Standby
Database Using DBCA and DGMGRL
Oracle 12c release 2 introduces the ability to simplify the creation of a Physical Standby
Database using the Database Configuration Assistant (DBCA). This significantly reduces the
manual steps previously involved, such as copying datafiles, creating password files, and
configuring initialization parameters.
In this guide, we walk through creating a standby database (orcl_stby) from a primary database
(orcl) using DBCA and subsequently configuring Oracle Data Guard Broker
(DGMGRL) for management and monitoring.
Environment Details
Step 1: Prepare tnsnames.ora on Both Hosts
Ensure both entries exist in the tnsnames.ora:
orcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST=hostname01)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
orcl_stby =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST=hostname02)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl_stby)
)
)
Step 2: Run DBCA on the Standby Host
Prerequisites
The following are the prerequisites for using the createDuplicateDB command:
• The database to be duplicated is in the archivelog mode.
• If the database to be duplicated is in a remote server, then there must be connectivity
from the system where DBCA is running to the remote server.
Syntax and Parameters
dbca -createDuplicateDB
-gdbName global_database_name
-primaryDBConnectionString easy_db_connection_string
-sid database_system_identifier
[-initParams initialization_parameters
[-initParamsEscapeChar initialization_parameters_escape_character]]
[-sysPassword SYS_user_password]
[-policyManaged | -adminManaged]
[-policyManaged
-serverPoolName server_pool_names
[-pqPoolName pq_pool_name]
[-createServerPool new_server_pool_name
[-pqPoolName new_pq_pool_name]
[-force]
[-pqCardinality pq_cardinality_of_the_new_server_pool]
[-cardinality cardinality_of_the_new_server_pool]]]
[-adminManaged]
[-nodelist database_nodes_list]
[-datafileDestination data_files_directory]
[-recoveryAreaDestination recovery_files_directory
[-recoveryAreaSize fast_recovery_area_size]]
[-databaseConfigType {SINGLE | RAC | RACONENODE}
[-RACOneNodeServiceName service_name_for_RAC_One_Node_database]]
[-useOMF {true | false}]
[-storageType {FS | ASM}
[-asmsnmpPassword ASMSNMP_password]
-datafileDestination database_files_directory]
[-createListener new_database_listener]
[-createAsStandby
[-dbUniqueName db_unique_name_for_standby_database]]
[-customScripts custom_sql_scripts_to_run_after_database_creation]
[-useWalletForDBCredentials {true | false}
-dbCredentialsWalletPassword wallet_account_password
-dbCredentialsWalletLocation wallet_files_directory]
[-configureTDE <true | false> ]
[-primaryDBTdeWallet value]
[-sourceTdeWalletPassword value]
[-tdeWalletRoot tde_wallet_root_init_parameter]
[-pdbTDEPassword pdb_tde_wallet_password]
[-tdeWalletModeForPDB pdb_keystore_type]
[-tdeAlgorithm TDE_algorithm]
[-tdeWalletLoginType type_of_wallet_login]
[-sourcePdbTDEPassword source_pdb_TDE_wallet_password]
[-tdeWalletPassword TDE_wallet_password]
Example
dbca -silent -createDuplicateDB \
-gdbName orcl \
-primaryDBConnectionString hostname01:1521/orcl \
-sid orcl_stby \
-createAsStandby \
-dbUniqueName orcl_stby \
-sysPassword YourSysPassword
This automatically:
• Creates the auxiliary instance
• Restores the database using RMAN
• Copy the SPFILE and password file
Monitor progress via the DBCA log:
/u02/app/oracle/cfgtoollogs/dbca/orcl_stby/orcl.log
Step 3: Enable Data Guard Broker on Both Nodes
SQL> ALTER SYSTEM SET dg_broker_start=true SCOPE=BOTH;
Step 4: Configure Data Guard Broker
dgmgrl
DGMGRL> CONNECT /
DGMGRL> CREATE CONFIGURATION 'orcl_dg' AS PRIMARY DATABASE IS 'orcl' CONNECT
IDENTIFIER IS 'orcl';
DGMGRL> ADD DATABASE 'orcl_stby' AS CONNECT IDENTIFIER IS 'orcl_stby';
DGMGRL> ENABLE CONFIGURATION;
Step 5: Add Standby Redo Logs (SRLs)
On Primary:
ALTER DATABASE ADD STANDBY LOGFILE '+REDO/ONLINELOG/standy_redo1.log' SIZE
200M;
-- Repeat for standy_redo2.log to standy_redo4.log
On Standby:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
-- Add SRLs
ALTER DATABASE ADD STANDBY LOGFILE '+REDO/ONLINELOG/standy_redo1.log' SIZE
200M;
-- Repeat for other logs
ALTER DATABASE OPEN;
Step 6: Enable Redo Apply and Verify Configuration
DGMGRL> EDIT DATABASE 'orcl_stby' SET STATE='APPLY-ON';
DGMGRL> SHOW CONFIGURATION;
Configuration - orcl_dg
Protection Mode: MaxPerformance
orcl - Primary database
orcl_stby - Physical standby database
Configuration Status: SUCCESS
Step 7: Configure StaticConnectIdentifier
To avoid issues during switchover:
DGMGRL> EDIT DATABASE 'orcl' SET PROPERTY StaticConnectIdentifier =
'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname01.localdomain)(PORT=1521)
)(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATE
D)))';
DGMGRL> EDIT DATABASE 'orcl_stby' SET PROPERTY StaticConnectIdentifier =
'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname02.localdomain)(PORT=1521)
)(CONNECT_DATA=(SERVICE_NAME=orcl_stby_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DED
ICATED)))';
Step 8: Update listener.ora on Both Hosts
Primary (hostname01):
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl_DGMGRL)
(SID_NAME = orcl)
)
)
Standby (hostname02):
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl_stby_DGMGRL)
(SID_NAME = orcl)
)
)
Reload listener:
lsnrctl reload
Conclusion
By leveraging DBCA with -createDuplicateDB and -createAsStandby, Oracle significantly
simplifies the creation of a Physical Standby Database. Combined with Data Guard Broker, the
environment becomes easier to manage, monitor, and switch over when needed.
This automated approach:
• Reduces risk of manual errors
• Speeds up deployment
• Ensures consistency across environments
Recommendations
1. Enable Fast-Start Failover (FSFO) in production environments for automatic failover
capabilities.
2. Use Oracle Enterprise Manager (OEM) to visually monitor and administer the Data
Guard environment.
3. Schedule regular DR drills to test the switchover/failover process.
4. Secure the TNS and listener files to avoid misconfiguration or security breaches.
5. Ensure your redo log and standby redo log sizes and numbers match Oracle’s best
practices.
Reference
• Oracle Documentation: DBCA Command Guide (21c)