Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Configurer un observateur Data Guard sur Compute Engine Google Cloud
Selon vos exigences de haute disponibilité, vous pouvez automatiser le basculement entre les bases de données. Une fois que vous avez validé votre déploiement Data Guard, vous pouvez configurer un observateur Data Guard sur Compute Engine.
Un observateur est un processus qui surveille une configuration Data Guard afin d'initier un basculement automatisé si les conditions le justifient.
Ce guide explique comment installer le client de base de données Oracle 19c sur une machine virtuelle (VM) observateur et configurer le basculement rapide.
Les exemples suivants sont utilisés tout au long de ce guide:
Nom de base de données unique
Noms d'hôtes du serveur
Noms d'instance RAC
Rôle
DBDG_SITE1
site1db1, site1db2
DBDG_SITE11, DBDG_SITE12
Principal
DBDG_SITE2
site2db1, site2db2
DBDG_SITE21, DBDG_SITE22
Instance de secours
Installer le logiciel client de base de données Oracle
Mise en réseau Un sous-réseau avec des règles de pare-feu autorisant l'accès de votre cloud privé virtuel aux hôtes de la solution Bare Metal qui exécutent les bases de données principale et de secours.
Stockage. -- au moins 20 Go alloués au disque de démarrage.
Connectez-vous à la VM et vérifiez que le nom d'hôte SCAN de chaque cluster de base de données est résolu dans le DNS:
Si les noms d'hôte ne sont pas résolus, ajoutez les adresses IP de chaque nom d'hôte SCAN au fichier /etc/hosts de la VM. Remplacez les exemples d'adresses IP par les adresses IP de chaque cluster:
Le RPM de la base de données Oracle installe les logiciels dans un répertoire prédéfini. Incluez les entrées suivantes dans le fichier /home/oracle/.bash_profile pour ajouter la page d'accueil du logiciel Oracle au chemin:
La version 12.2 et les versions ultérieures d'Oracle Database sont compatibles avec l'exécution de l'observateur en mode arrière-plan. Pour ce faire, vous devez créer un portefeuille afin de procéder à une authentification sans mot de passe sur la base de données. Connectez-vous en tant qu'utilisateur oracle sur la VM observateur et effectuez les tâches suivantes pour créer un portefeuille:
Ajoutez les entrées suivantes à $ORACLE_HOME/network/admin/sqlnet.ora:
Créez le répertoire de portefeuille sur la VM hébergeant l'observateur:
mkdir/home/oracle/wallet
Initialisez le portefeuille, puis indiquez un mot de passe pour le portefeuille lorsque vous y êtes invité:
mkstore-wrl/home/oracle/wallet-create
Créez une entrée dans le portefeuille pour chaque base de données dans la configuration Data Guard. La commande mkstore demande le mot de passe SYS de la base de données, suivi du mot de passe de portefeuille fourni à l'étape précédente:
Vérifiez que le portefeuille contient les identifiants associés à chaque base de données dans la configuration de Data Guard. L'argument -listCredential de mkstore demande le mot de passe du portefeuille:
mkstore-wrl/home/oracle/wallet-listCredential
Connectez-vous à la VM observateur en tant qu'Oracle, puis testez la connectivité aux bases de données principale et de secours. Connectez-vous aux bases de données principale et secondaire avec SQL*Plus à l'aide des identifiants de portefeuille:
Dans une session de terminal distincte, vérifiez la configuration.
SHOW CONFIGURATION VERBOSE;
L'exemple suivant montre le mode détaillé de la commande show configuration. Si l'état de la configuration est SUCCESS, votre configuration est terminée.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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"]]