1. Home
  2. Knowledge Base
  3. Oracle 26ai
  4. Data Guard 23ai New Feature – Prepare Database for Data Guard

Data Guard 23ai New Feature – Prepare Database for Data Guard

The PREPARE DATABASE FOR DATA GUARD command (first introduced in Oracle Database 21c) configures a database for use as a primary database in a Data Guard broker configuration and automates many steps which were previously manually performed.

The PREPARE DATABASE FOR DATA GUARD command sets the following database parameters:

  • DB_FILES=1024
  • LOG_BUFFER=256M
  • DB_BLOCK_CHECKSUM=TYPICAL or FULL
  • DB_LOST_WRITE_PROTECT=TYPICAL or FULL
  • DB_FLASHBACK_RETENTION_TARGET=120(if not set)
  • PARALLEL_THREADS_PER_CPU=1
  • DG_BROKER_START=TRUE

It also performs these additional tasks:

  • Enables archivelog mode
  • Enables force logging
  • Enables Flashback Database
  • Configures RMAN archive log deletion policy to SHIPPED TO ALL STANDBY.
  • Create standby redo log files if they do not exist in the primary database. If the logs exist and are misconfigured, delete and recreate standby log files

The syntax is as follows (connect to the primary database as a user with SYSDBA privileges)

 PREPARE DATABASE FOR DATA GUARD
[WITH [DB_UNIQUE_NAME IS ]
[DB_RECOVERY_FILE_DEST IS ]
[DB_RECOVERY_FILE_DEST_SIZE IS ]
[BROKER_CONFIG_FILE_1 IS ]
[BROKER_CONFIG_FILE_2 IS ]];

Example:

DGMGRL> connect sys/oracle
Connected to "orcl"
Connected as SYSDBA.
DGMGRL> PREPARE DATABASE FOR DATA GUARD WITH DB_UNIQUE_NAME IS orcl RESTART;
Validating database "orcl" before executing the command.
Preparing database "orcl" 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 "orcl".
Database closed.
Database dismounted.
ORACLE instance shut down.
Starting database "orcl" 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 ARCHIVELOG deletion policy set to SHIPPED TO ALL STANDBY.
Adding standby log group size 209715200 and assigning it to thread 1.
Adding standby log group size 209715200 and assigning it to thread 1.
Adding standby log group size 209715200 and assigning it to thread 1.
Initialization parameter STANDBY_FILE_MANAGEMENT set to 'AUTO'.
Force logging mode enabled.
Flashback Database enabled.
Database opened.
Succeeded.
DGMGRL>

Updated on April 23, 2025

Was this article helpful?

Related Articles

Leave a Comment