Oracle Data Guard 21c came with a new command:
1 2 3 4 |
prepare database for data guard with db_unique_name is {db_unique_name} db_recovery_file_dest_size is "{size}" db_recovery_file_dest is "{dest}" ; |
This command prepares a database to become primary in a Data Guard configuration.
It sets many recommended parameters:
1 2 3 4 5 6 7 8 |
DB_FILES = 1024 LOG_BUFFER = 256M DB_BLOCK_CHECKSUM = TYPICAL DB_LOST_WRITE_PROTECT = TYPICAL DB_FLASHBACK_RETENTION_TARGET = 120 PARALLEL_THREADS_PER_CPU = 1 STANDBY_FILE_MANAGEMENT = AUTO DG_BROKER_START = TRUE |
Sets the RMAN archive deletion policy, enables flashback and force logging, creates the standby logs according to the online redo logs configuration, and creates an spfile if the database is running with an init file.
If you tried this in 21c, you have noticed that there is an automatic restart of the database to set all the static parameters. If you weren’t expecting this, the sudden restart could be a bit brutal approach.
In 23c, we added an additional keyword “restart” to specify that you are OK with the restart of the database. If you don’t specify it, the broker will complain that it cannot proceed without a restart:
1 2 3 4 5 6 7 8 9 10 |
DGMGRL> prepare database for data guard > with db_unique_name is chol23c_hwq_lhr > db_recovery_file_dest_size is "200g" > db_recovery_file_dest is "/u03/app/oracle/fast_recovery_area" > ; Validating database "cdb1" before executing the command. DGM-17552: Primary database must be restarted after setting static initialization parameters. DGM-17327: Primary database must be restarted to enable archivelog mode. Failed. DGMGRL> |
If you specify it, it will proceed with the restart:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
DGMGRL> prepare database for data guard > with db_unique_name is chol23c_hwq_lhr > db_recovery_file_dest_size is "200g" > db_recovery_file_dest is "/u03/app/oracle/fast_recovery_area" > restart; Validating database "chol23c_hwq_lhr" before executing the command. Preparing database "chol23c_hwq_lhr" for Data Guard. Initialization parameter DB_FILES set to 1024. Initialization parameter LOG_BUFFER set to 268435456. Primary database must be restarted after setting static initialization parameters. Shutting down database "chol23c_hwq_lhr". Database closed. Database dismounted. ORACLE instance shut down. Starting database "chol23c_hwq_lhr" to mounted mode. ORACLE instance started. Database mounted. Initialization parameter DB_FLASHBACK_RETENTION_TARGET set to 120. Initialization parameter DB_LOST_WRITE_PROTECT set to 'TYPICAL'. RMAN configuration archivelog deletion policy set to SHIPPED TO ALL STANDBY. Initialization parameter DB_RECOVERY_FILE_DEST_SIZE set to '200g'. Initialization parameter DB_RECOVERY_FILE_DEST set to '/u03/app/oracle/fast_recovery_area'. LOG_ARCHIVE_DEST_n initialization parameter already set for local archival. Initialization parameter LOG_ARCHIVE_DEST_2 set to 'location=use_db_recovery_file_dest valid_for=(all_logfiles, all_roles)'. Initialization parameter LOG_ARCHIVE_DEST_STATE_2 set to 'Enable'. Adding standby log group size 1073741824 and assigning it to thread 1. Adding standby log group size 1073741824 and assigning it to thread 1. Adding standby log group size 1073741824 and assigning it to thread 1. Initialization parameter STANDBY_FILE_MANAGEMENT set to 'AUTO'. Initialization parameter DG_BROKER_START set to TRUE. Database set to FLASHBACK ON. Database opened. Succeeded. DGMGRL> |
Notice that if you already have these static parameters set, the broker will just set the missing dynamic parameters without the need for a restart:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
DGMGRL> prepare database for data guard > with db_unique_name is chol23c_hwq_lhr > db_recovery_file_dest_size is "200g" > db_recovery_file_dest is "/u03/app/oracle/fast_recovery_area" > ; Validating database "chol23c_hwq_lhr" before executing the command. Preparing database "chol23c_hwq_lhr" for Data Guard. Initialization parameter DB_RECOVERY_FILE_DEST_SIZE set to '200g'. Initialization parameter DB_RECOVERY_FILE_DEST set to '/u03/app/oracle/fast_recovery_area'. LOG_ARCHIVE_DEST_n initialization parameter already set for local archival. Initialization parameter LOG_ARCHIVE_DEST_1 set to 'location=use_db_recovery_file_dest valid_for=(all_logfiles, all_roles)'. Initialization parameter LOG_ARCHIVE_DEST_STATE_1 set to 'Enable'. Succeeded. |
This new command greatly simplifies the preparation of a Data Guard configuration!
Before 21c, you had to do everything by hand.
—
Ludo