Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Data Guard-Beobachter in der Google CloudCompute Engine einrichten
Abhängig von Ihren Hochverfügbarkeitsanforderungen können Sie das Failover zwischen Datenbanken automatisieren. Nachdem Sie Ihre Data Guard-Bereitstellung validiert haben, können Sie zu diesem Zweck einen Data Guard-Beobachter in Compute Engine einrichten.
Ein Beobachter ist ein Prozess, der eine Data Guard-Konfiguration überwacht, um einen automatischen Failover zu initiieren, wenn dies erforderlich ist.
In diesem Leitfaden wird beschrieben, wie Sie den Client der Oracle 19c-Datenbank auf einer virtuellen Beobachtermaschine (VM) installieren und das Fast-Start-Failover konfigurieren.
Die folgenden Beispiele werden in diesem Leitfaden verwendet:
Netzwerk. Ein Subnetz mit Firewallregeln, die den Zugriff von Ihrer Virtual Private Cloud auf die Bare-Metal-Lösungshosts zulassen, die die primäre Datenbank und die Standby-Datenbank ausführen.
Storage. – Mindestens 20 GB dem Bootlaufwerk zugewiesen.
Melden Sie sich bei der VM an und prüfen Sie, ob der SCAN-Hostname jedes Datenbankclusters in DNS aufgelöst wird:
Wenn die Hostnamen nicht aufgelöst werden, fügen Sie die IP-Adressen für jeden SCAN-Hostnamen zur Datei /etc/hosts auf der VM hinzu. Ersetzen Sie die Beispiel-IP-Adressen durch die IP-Adressen für jeden Cluster:
Die Oracle-Datenbank-RPM-Software wird in einem vordefinierten Verzeichnis installiert. Fügen Sie die folgenden Einträge zu /home/oracle/.bash_profile hinzu, um das Home-Verzeichnis der Oracle-Software dem Pfad hinzuzufügen:
Oracle Database Version 12.2 und höher unterstützt die Ausführung des Beobachters im Hintergrundmodus. Dazu muss eine Wallet erstellt werden, um eine passwortlose Authentifizierung bei der Datenbank durchzuführen. Melden Sie sich als Oracle-Nutzer auf der Beobachter-VM an und führen Sie die folgenden Aufgaben aus, um eine Wallet zu erstellen:
Fügen Sie $ORACLE_HOME/network/admin/sqlnet.ora die folgenden Einträge hinzu:
Erstellen Sie das Wallet-Verzeichnis auf der VM, auf der der Beobachter gehostet wird:
mkdir/home/oracle/wallet
Initialisieren Sie die Wallet und geben Sie ein Passwort ein, wenn Sie dazu aufgefordert werden:
mkstore-wrl/home/oracle/wallet-create
Erstellen Sie in der Data Guard-Konfiguration für jede Datenbank einen Eintrag. Mit dem Befehl mkstore wird das SYS-Passwort für die Datenbank angefordert, gefolgt vom Wallet-Passwort aus dem vorherigen Schritt:
Prüfen Sie, ob die Wallet die Anmeldedaten für jede Datenbank in der Data Guard-Konfiguration enthält. Das -listCredential-Argument für mkstore fordert das Wallet-Passwort an:
mkstore-wrl/home/oracle/wallet-listCredential
Melden Sie sich als Oracle bei der Beobachter-VM an und testen Sie dann die Konnektivität zu den primären und Standby-Datenbanken. Stellen Sie mit den SQL-Anmeldedaten eine Verbindung zu den primären und sekundären Datenbanken mit SQL*Plus her:
Wenn die Wallet-Konfiguration erfolgreich ist, meldet sich der Befehl sqlplus direkt bei der Datenbank an, ohne ein Passwort anzufordern.
Failover für Schnellstart konfigurieren und aktivieren
Erstellen Sie ein Verzeichnis zum Speichern der Konfigurations- und Protokolldateien des Beobachter:
mkdir/home/oracle/fsfo
Stellen Sie über die Wallet eine Verbindung zum Data Guard-Broker in der primären Datenbank her:
dgmgrl
CONNECT/@DBDG_SITE1;
Prüfen Sie den Data Guard-Status, um zu festzustellen, ob die Konfiguration als SUCCESS markiert ist:
SHOW CONFIGURATION;
Aktivieren Sie das Fast-Start-Failover (FSFO):
ENABLE FAST_START FAILOVER;
Durch Aktivieren von FSFO ist die Konfiguration nicht für ein automatisches Failover bereit.
Für das automatische Failover ist ein Beobachter erforderlich.
Prüfen Sie in einer separaten Terminalsitzung die Konfiguration:
SHOW CONFIGURATION VERBOSE;
Das folgende Beispiel zeigt den ausführlichen Modus des Befehls show configuration. Wenn der Konfigurationsstatus SUCCESS lautet, ist die Einrichtung abgeschlossen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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"]]