Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Configura un osservatore Data Guard su Google Cloud
Compute Engine
A seconda dei tuoi requisiti di alta disponibilità, potresti voler automatizzare il failover tra i database. Dopo aver
convalidato il deployment di Data Guard,
puoi configurare un osservatore Data Guard su Compute Engine per eseguire questa operazione.
Un osservatore è un processo che monitora una configurazione di Data Guard per avviare un failover automatico se le condizioni lo richiedono.
Questa guida illustra l'installazione del client di database Oracle 19c su una macchina virtuale (VM) di monitoraggio e la configurazione del failover Fast-Start.
I seguenti esempi vengono utilizzati in tutta la guida:
Networking. Una sottorete con regole firewall che consentono l'accesso dal tuo Virtual Private Cloud agli host Bare Metal Solution che eseguono i database principali e di standby.
Spazio di archiviazione. - Almeno 20 GB allocati al disco di avvio.
Accedi alla VM e verifica che il nome host SCAN di ogni cluster di database sia risolto nel DNS:
Se i nomi host non vengono risolti, aggiungi gli indirizzi IP di ogni nome host SCAN al file /etc/hosts sulla VM. Sostituisci gli indirizzi IP di esempio con
gli indirizzi IP di ciascun cluster:
L'RPM di Oracle Database installa il software in una directory predefinita. Aggiungi le seguenti voci a /home/oracle/.bash_profile per aggiungere la home page del software Oracle al percorso:
La versione 12.2 e successive di Oracle Database include il supporto per l'esecuzione dell'osservatore in modalità di sfondo. Per farlo, è necessario creare un portafoglio per eseguire l'autenticazione senza password nel database. Accedi come utente Oracle sulla VM di osservazione ed esegui le seguenti attività per creare un portafoglio:
Aggiungi le seguenti voci a $ORACLE_HOME/network/admin/sqlnet.ora:
Crea la directory del portafoglio sulla VM che ospita l'osservatore:
mkdir/home/oracle/wallet
Inizializza il wallet, quindi fornisci una password quando richiesto:
mkstore-wrl/home/oracle/wallet-create
Crea una voce nel portafoglio per ogni database nella configurazione di Data Guard. Il comando mkstore richiederà la password SYS per il database, seguita dalla password del portafoglio fornita nel passaggio precedente:
Verifica che il portafoglio contenga le credenziali per ogni database nella configurazione di Data Guard. L'argomento -listCredential per mkstore
richiederà la password del wallet:
mkstore-wrl/home/oracle/wallet-listCredential
Accedi alla VM di monitoraggio come Oracle e poi testa la connettività ai database principale e di standby. Connettiti ai database principale e secondario con SQL*Plus utilizzando le credenziali del portafoglio:
In una sessione del terminale separata, verifica la configurazione:
SHOW CONFIGURATION VERBOSE;
L'esempio seguente mostra la modalità dettagliata del comando show configuration. Se lo stato di configurazione è SUCCESS, la configurazione è completata.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThis guide outlines the process of setting up a Data Guard observer on a Google Cloud Compute Engine VM to automate database failover.\u003c/p\u003e\n"],["\u003cp\u003eThe setup involves creating a VM with specific operating system, networking, and storage criteria, followed by installing the Oracle 19c database client software.\u003c/p\u003e\n"],["\u003cp\u003eDatabase connectivity is configured by updating \u003ccode\u003etnsnames.ora\u003c/code\u003e and \u003ccode\u003esqlnet.ora\u003c/code\u003e, and creating a wallet for passwordless authentication.\u003c/p\u003e\n"],["\u003cp\u003eFast-Start Failover (FSFO) is enabled and configured using the Data Guard broker, which can automate failover between primary and standby databases.\u003c/p\u003e\n"],["\u003cp\u003eThe final steps include starting the Data Guard observer and verifying the configuration status to ensure it is successful, with a target, and a defined observer.\u003c/p\u003e\n"]]],[],null,["# Set up a Data Guard observer on Google Cloud Compute Engine\n\nSet up a Data Guard observer on Google Cloud\nCompute Engine\n===========================================================\n\nDepending on your [high availability requirements](https://docs.oracle.com/en/database/oracle/oracle-database/19/haovw/ha-requirements-architecture.html).\nyou might want to automate failover between databases. After you've\n[validated your Data Guard deployment](/bare-metal/docs/solutions/oracle/data-guard-setup/validate),\nyou have the option to set up a Data Guard observer on Compute Engine to do this.\nAn observer is a process that monitors a Data Guard configuration to initiate\nan automated failover if conditions warrant it.\n\nThis guide covers installing the Oracle 19c database client on an observer\nvirtual machine (VM) and configuring Fast-Start Failover.\n\nThe following examples are used throughout this guide:\n\nInstall the Oracle Database client software\n-------------------------------------------\n\n1. [Create a virtual machine (VM) on Compute Engine](/compute/docs/instances/create-start-instance)\n that meets the following criteria:\n\n - **Operating system.** Red Hat Enterprise Linux 7.\n\n - **Networking.** A subnet with firewall rules that allow access from your\n Virtual Private Cloud to the Bare Metal Solution hosts running the primary and standby\n databases.\n\n - **Storage.** -- At least 20 GB allocated to the boot disk.\n\n2. Log in to the VM and verify that the SCAN hostname of each database cluster\n resolves in DNS:\n\n host \u003cvar translate=\"no\"\u003eDBDG_SITE1_SCAN_HOSTNAME\u003c/var\u003e\n host \u003cvar translate=\"no\"\u003eDBDG_SITE2_SCAN_HOSTNAME\u003c/var\u003e\n\n If the hostnames don't resolve, add the IP addresses for each SCAN hostname\n to the `/etc/hosts` file on the VM. Replace the example IP addresses with\n the IP addresses for each cluster: \n\n # Site 1 SCAN Hosts\n 192.0.2.10 \u003cvar translate=\"no\"\u003eDBDG_SITE1_SCAN_HOSTNAME\u003c/var\u003e\n 192.0.2.11 \u003cvar translate=\"no\"\u003eDBDG_SITE1_SCAN_HOSTNAME\u003c/var\u003e\n 192.0.2.12 \u003cvar translate=\"no\"\u003eDBDG_SITE1_SCAN_HOSTNAME\u003c/var\u003e\n\n # Site 2 SCAN Hosts\n 198.51.100.10 \u003cvar translate=\"no\"\u003eDBDG_SITE2_SCAN_HOSTNAME\u003c/var\u003e\n 198.51.100.11 \u003cvar translate=\"no\"\u003eDBDG_SITE2_SCAN_HOSTNAME\u003c/var\u003e\n 198.51.100.12 \u003cvar translate=\"no\"\u003eDBDG_SITE2_SCAN_HOSTNAME\u003c/var\u003e\n\n3. [Install the Oracle Database RPM](https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/running-rpm-packages-to-install-oracle-database.html#GUID-BB7C11E3-D385-4A2F-9EAF-75F4F0AACF02).\n Install only the software. There's no need to configure a database on the\n observer VM.\n\n4. The Oracle Database RPM installs software in a predefined directory. Add the\n following entries to `/home/oracle/.bash_profile` to add the Oracle software\n home to the path:\n\n cat \u003e\u003e /home/oracle/.bash_profile \u003c\u003c EOL\n export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1\n export PATH=\\$PATH:\\$ORACLE_HOME/bin\n EOL\n\n5. Source the Oracle environment variables in your terminal session:\n\n source ~/.bash_profile\n\nConfigure the database connectivity\n-----------------------------------\n\n1. Configure the Oracle Net settings in the `$ORACLE_HOME/network/admin/tsnames.ora`\n file:\n\n \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e =\n (DESCRIPTION =\n (ADDRESS = (PROTOCOL = TCP)(HOST = \u003cvar translate=\"no\"\u003eDBDG_SITE1_SCAN_HOSTNAME\u003c/var\u003e)(PORT = 1521))\n (CONNECT_DATA =\n (SERVER = DEDICATED)\n (SERVICE_NAME = \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e) (UR=A)\n )\n )\n\n \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e =\n (DESCRIPTION =\n (ADDRESS = (PROTOCOL = TCP)(HOST = \u003cvar translate=\"no\"\u003eDBDG_SITE2_SCAN_HOSTNAME\u003c/var\u003e)(PORT = 1521))\n (CONNECT_DATA =\n (SERVER = DEDICATED)\n (SERVICE_NAME = \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e) (UR=A)\n )\n )\n\n2. Oracle Database version 12.2 and higher includes support for the observer to\n run in background mode. To do so, a wallet must be created to perform\n passwordless authentication to the database. Log in as the oracle user on\n the observer VM and perform the following tasks to create a wallet:\n\n 1. Add the following entries to `$ORACLE_HOME/network/admin/sqlnet.ora`:\n\n WALLET_LOCATION =\n (SOURCE =\n (METHOD = FILE)\n (METHOD_DATA = (DIRECTORY = /home/oracle/wallet))\n )\n SQLNET.WALLET_OVERRIDE = TRUE\n\n 2. Create the wallet directory on the VM hosting the observer:\n\n mkdir /home/oracle/wallet\n\n 3. Initialize the wallet, then supply a password for the wallet when\n prompted:\n\n mkstore -wrl /home/oracle/wallet -create\n\n 4. Create an entry in the wallet for each database in the Data Guard\n configuration. The `mkstore` command will request the SYS password for the\n database, followed by the wallet password provided in the previous step:\n\n mkstore -wrl /home/oracle/wallet -createCredential \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e sys\n mkstore -wrl /home/oracle/wallet -createCredential \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e sys\n\n 5. Confirm that the wallet contains credentials for each database in the\n Data Guard configuration. The `-listCredential` argument for `mkstore`\n will request the wallet password:\n\n mkstore -wrl /home/oracle/wallet -listCredential\n\n3. Log in to the observer VM as Oracle and then test connectivity to the\n primary and standby databases. Connect to the primary and secondary\n databases with SQL\\*Plus by using the wallet credentials:\n\n sqlplus /@\u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e as sysdba\n sqlplus /@\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e as sysdba\n\n If the wallet configuration is successful, the `sqlplus` command directly\n logs in to the database without asking for a password.\n\nConfigure and enable Fast-Start Failover\n----------------------------------------\n\n1. Create a directory to store the observer configuration and log files:\n\n mkdir /home/oracle/fsfo\n\n2. Connect to the Data Guard broker on the primary database using the wallet:\n\n dgmgrl\n CONNECT /@\u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e;\n\n3. View the Data Guard status to check that the configuration is marked as\n `SUCCESS`:\n\n SHOW CONFIGURATION;\n\n4. Enable Fast-Start Failover (FSFO):\n\n ENABLE FAST_START FAILOVER;\n\n Enabling FSFO does not make the configuration ready for automatic failover.\n Automatic failover requires an observer.\n5. Start Data Guard Observer:\n\n START OBSERVER observer1 IN BACKGROUND FILE IS '/home/oracle/fsfo/observer1_DBDG.dat' LOGFILE IS '/home/oracle/fsfo/observer1_DBDG.log';\n\n6. In a separate terminal session, verify the configuration:\n\n SHOW CONFIGURATION VERBOSE;\n\n The following example shows the verbose mode of the `show configuration`\n command. If the configuration status is `SUCCESS`, your setup is complete. \n\n Configuration - DBDG\n\n Protection Mode: MaxAvailability\n Members:\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eDBDG_SITE1\u003c/span\u003e\u003c/var\u003e - Primary database\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eDBDG_SITE2\u003c/span\u003e\u003c/var\u003e - Physical standby database\n\n (*) Fast-Start Failover target\n\n Properties:\n FastStartFailoverThreshold = '30'\n OperationTimeout = '30'\n TraceLevel = 'USER'\n FastStartFailoverLagLimit = '45'\n CommunicationTimeout = '180'\n ObserverReconnect = '0'\n FastStartFailoverAutoReinstate = 'TRUE'\n FastStartFailoverPmyShutdown = 'TRUE'\n BystandersFollowRoleChange = 'ALL'\n ObserverOverride = 'FALSE'\n ExternalDestination1 = ''\n ExternalDestination2 = ''\n PrimaryLostWriteAction = 'CONTINUE'\n ConfigurationWideServiceName = 'DBDG_CFG'\n\n Fast-Start Failover: Enabled in Potential Data Loss Mode\n Lag Limit: 45 seconds\n Threshold: 30 seconds\n Active Target: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eDBDG_SITE2\u003c/span\u003e\u003c/var\u003e\n Potential Targets: \"\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e\"\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eDBDG_SITE2\u003c/span\u003e\u003c/var\u003e valid\n Observer: observer1\n Shutdown Primary: TRUE\n Auto-reinstate: TRUE\n Observer Reconnect: (none)\n Observer Override: FALSE\n\n Configuration Status:\n SUCCESS"]]