Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Configurar e ativar o agente do Data Guard
Depois de configurar os bancos de dados
principal
e de espera para o Data Guard, você precisa configurar o agente.
O agente do Data Guard gerencia a criação, o controle e o monitoramento das configurações
do Data Guard.
Os exemplos a seguir são usados neste guia:
Nome exclusivo do banco de dados
Nomes de host do servidor
Nomes de instâncias RAC
Papel
Nome exclusivo do banco de dados
Nomes de host do servidor
Nomes de instâncias RAC
Papel
DBDG_SITE1
site1db1, site1db2
DBDG_SITE11, DBDG_SITE12
Principal
DBDG_SITE2
site2db1, site2db2
DBDG_SITE21, DBDG_SITE22
Espera
Configurar o banco de dados principal
Inicie o processo de monitoramento do Data Guard no banco de dados principal:
Faça login no primeiro servidor da Solução Bare Metal que hospeda o banco de dados principal.
Em /etc/oratab, verifique se há uma entrada para ativar variáveis de ambiente para o
banco de dados principal:
DBDG_SITE11:/apps/oracle/19.0.0/db_home1:N
Defina a variável de ambiente ORACLE_SID para se conectar ao banco de dados
principal:
sourceoraenv <<< "DBDG_SITE11"
Você receberá a resposta
The Oracle base has been set to /apps/oracle/oracle_base.
Use o Gerenciador de recuperação para verificar se os registros de arquivo não são excluídos automaticamente
até que tenham sido aplicados em todos os bancos de dados em espera:
Inicie o SQL*Plus. Em seguida, configure um local para os arquivos
de configuração do agente e inicie-o. Os bancos de dados RAC requerem que os arquivos
de configuração do agente residam no armazenamento compartilhado, de preferência em um grupo de discos ASM:
Faça login no primeiro servidor da Solução Bare Metal que hospeda o banco de dados principal.
Conecte-se à interface de linha de comando do Data Guard e, em seguida, ao banco de dados
principal:
dgmgrl
CONNECTSYS@DBDG_SITE1
Quando uma senha for solicitada, insira a senha de login remoto do SYS no
banco de dados principal.
Crie a configuração do agente:
CREATE CONFIGURATION 'DBDG' AS PRIMARY DATABASE IS 'DBDG_SITE1' CONNECT IDENTIFIER IS DBDG_SITE1;
Adicione o banco de dados em espera:
ADD DATABASE DBDG_SITE2 AS CONNECT IDENTIFIER IS DBDG_SITE2 MAINTAINED AS PHYSICAL;
Ative a configuração. A ativação dessa configuração direciona o processo
do agente para começar o envio de registros pelo banco de dados principal e aplica o "redo"
no banco de dados em espera quando é recebido:
ENABLE CONFIGURATION;
Verifique se a configuração foi bem-sucedida com estes
comandos:
SHOW CONFIGURATION;
SHOW DATABASE DBDG_SITE1;
SHOW DATABASE DBDG_SITE2;
VALIDATE DATABASE DBDG_SITE1;
VALIDATE DATABASE DBDG_SITE2;
O comando show configuration não informa o status de SUCCESS até que
o banco de dados em espera esteja sincronizado com o banco de dados principal. O tempo
necessário para a sincronização inicial pode variar com base na
quantidade de alterações realizadas no banco de dados principal ou na latência entre
os locais principais e de espera. Veja um exemplo de uma configuração
bem-sucedida:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-08 UTC."],[[["\u003cp\u003eThis guide explains how to set up the Data Guard broker, which is essential for managing the creation, control, and monitoring of Data Guard configurations.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves configuring the primary database by setting up the Data Guard monitor process, and configuring a location for the broker configuration files, then ensuring archive logs are not deleted prematurely.\u003c/p\u003e\n"],["\u003cp\u003eThe standby database setup mirrors the primary, including setting up the monitor process and configuring the broker file location.\u003c/p\u003e\n"],["\u003cp\u003eA broker configuration is created on the primary database using the Data Guard command line interface, including adding the standby database and enabling log shipping.\u003c/p\u003e\n"],["\u003cp\u003eOnce the configuration is created, you can validate that the configuration is working properly using multiple commands and enable flashback on the newly configured standby database.\u003c/p\u003e\n"]]],[],null,["# Configure and enable Data Guard broker\n======================================\n\nAfter you've set up the [primary](/bare-metal/docs/solutions/oracle/data-guard-setup/db-setup-primary)\nand [standby](/bare-metal/docs/solutions/oracle/data-guard-setup/db-setup-standby)\ndatabases for Data Guard, you need to set up its [broker](https://docs.oracle.com/en/database/oracle/oracle-database/19/dgbkr/oracle-data-guard-broker-concepts.html).\nThe Data Guard broker manages creation, control, and monitoring of Data Guard\nconfigurations.\n\nThe following examples are used throughout this guide:\n\nSet up the primary database\n---------------------------\n\nStart the Data Guard monitor process on the primary database:\n\n1. Log in to the first Bare Metal Solution server that hosts the primary database.\n\n2. In `/etc/oratab` check that an entry to enable environment variables for the\n primary database exists:\n\n \u003cvar class=\"readonly\" translate=\"no\"\u003eDBDG_SITE11\u003c/var\u003e:\u003cvar scope=\"oraclehome\" translate=\"no\"\u003e/apps/oracle/19.0.0/db_home1\u003c/var\u003e:N\n\n3. Set the `ORACLE_SID` environment variable so you can connect to the primary\n database:\n\n source oraenv \u003c\u003c\u003c \"\u003cvar translate=\"no\"\u003eDBDG_SITE11\u003c/var\u003e\"\n\n You should receive the response\n `The Oracle base has been set to `\u003cvar class=\"edit\" scope=\"oraclebase\" translate=\"no\"\u003e/apps/oracle/oracle_base\u003c/var\u003e.\n4. Use Recovery Manager to check that archive logs are not automatically\n deleted until they have been applied on all standby databases:\n\n rman target /\n\n CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;\n EXIT;\n\n5. Start SQL\\*Plus, then configure a location for the broker configuration\n files and start the broker. RAC databases require the broker configuration\n files to reside on shared storage, preferably in an ASM diskgroup:\n\n sqlplus / as sysdba\n\n ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+DATA/\u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e/dr1\u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e.dat' SID='*' SCOPE=BOTH;\n ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+DATA/\u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e/dr2\u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e.dat' SID='*' SCOPE=BOTH;\n ALTER SYSTEM SET DG_BROKER_START=true SID='*' SCOPE=BOTH;\n EXIT;\n\nSet up the standby database\n---------------------------\n\nStart the Data Guard monitor process on the standby database:\n\n1. Log in to the first Bare Metal Solution server that hosts the standby database.\n\n2. Set the `ORACLE_SID` environment variable, so you can connect to the standby\n database:\n\n source oraenv \u003c\u003c\u003c \"\u003cvar translate=\"no\"\u003eDBDG_SITE21\u003c/var\u003e\"\n\n You should receive the response\n `The Oracle base has been set to `\u003cvar scope=\"oraclebase\" translate=\"no\"\u003e/apps/oracle/oracle_base\u003c/var\u003e.\n3. Log in to SQL\\*Plus, then configure a location for broker configuration\n files and start the broker.\n\n sqlplus / as sysdba\n\n ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+DATA/\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e/dr1\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e.dat' SID='*' SCOPE=BOTH;\n ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+DATA/\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e/dr2\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e.dat' SID='*' SCOPE=BOTH;\n ALTER SYSTEM SET DG_BROKER_START=true SID='*' SCOPE=BOTH;\n EXIT;\n\nCreate the broker configuration\n-------------------------------\n\n1. Log in to the first Bare Metal Solution server that hosts the primary database.\n\n2. Connect to the Data Guard command line interface, then to the primary\n database:\n\n dgmgrl\n\n CONNECT SYS@\u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e\n\n When prompted for a password, enter your SYS remote login password for the\n primary database.\n3. Create the broker configuration:\n\n CREATE CONFIGURATION 'DBDG' AS PRIMARY DATABASE IS '\u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e' CONNECT IDENTIFIER IS \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e;\n\n4. Add the standby database:\n\n ADD DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e AS CONNECT IDENTIFIER IS \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e MAINTAINED AS PHYSICAL;\n\n5. Enable the configuration. Enabling this configuration directs the broker\n process to begin log shipping from the primary database, and apply the redo\n on the standby database as it is received:\n\n ENABLE CONFIGURATION;\n\n6. You can check if the configuration is successful with the following\n commands:\n\n SHOW CONFIGURATION;\n\n SHOW DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e;\n\n SHOW DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e;\n\n VALIDATE DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e;\n\n VALIDATE DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e;\n\n The `show configuration` command doesn't report a status of `SUCCESS` until\n the standby database is synchronized with the primary database. The amount\n of time required for the initial synchronization can vary, based on the\n amount of changes performed on the primary database or the latency between\n the primary and standby sites. Here is an example of a successful\n configuration: \n\n Configuration - DBDG\n\n Protection Mode: MaxPerformance\n Members:\n \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e - Primary database\n \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e - Physical standby database\n\n Fast-Start Failover: Disabled\n\n Configuration Status:\n SUCCESS (status updated 0 seconds ago)\n\n7. Enable flashback on the newly configured standby database:\n\n CONNECT SYS@\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e\n\n When prompted for a password, enter your SYS remote login password for the\n standby database. \n\n EDIT DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e SET STATE=APPLY-OFF;\n SQL 'ALTER DATABASE FLASHBACK ON';\n EDIT DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e SET STATE=APPLY-ON;\n\n8. Exit the Data Guard command line interface:\n\n EXIT;\n\nNext steps\n----------\n\nNext, [validate the Data Guard deployment](/bare-metal/docs/solutions/oracle/data-guard-setup/validate)."]]