- Stellen Sie Active Data Guard Far Sync bereit, um Daten in allen Oracle Database@Azure-Regionen zu schützen
- Aktive Data Guard-Far Sync-Instanzen bereitstellen
Far Sync-Instanzen von Active Data Guard bereitstellen
Stellen Sie eine Active Data Guard-Far Sync-Instanz auf der virtuellen OCI-Compute-Maschine in jeder Region bereit, um regionsübergreifend keinen Datenverlust zu gewährleisten.
- Erstellen Sie eine Far Sync-Kontrolldatei.
Erstellen Sie eine Kontrolldatei für die Far Sync-Instanz aus der Primärdatenbank.
SQL> alter database create far sync instance controlfile as '/home/oracle/controlfs.ctl';
Kopieren Sie die neu erstellte Kontrolldatei in die Hosts der Far Sync-Instanz.
scp -p controlfs.ctl farsync-toronto:/u01/app/oracle/oradata/fstor/controlfs/ scp -p controlfs.ctl farsync-sydney:/u01/app/oracle/oradata/fssyd/controlfs/
- Kopieren Sie die Kennwortdatei.
Kopieren Sie die Kennwortdatei der Primärdatenbank mit dem Namen der Far Sync-Instanzen in die Far Sync-Instanzhosts. In diesem Beispiel erhält die Far Sync-Instanz in der Region Toronto den Namen
FSTOR
. Daher lautet der Name der KennwortdateiorapwFSTOR
.#check the location of the password file SQL> select file_name from v$passwordfile_info; #as grid user, copy the file from ASM to the local filesystem asmcmd -p cp +DATAC2/DB_TORONTO/PASSWORD/pwddb_toronto.421.1185102507 /home/grid/orapw #as root user, change the owner of the password file to oracle user cp /home/grid/orapw /home/oracle/ chown oracle:oinstall /home/oracle/orapw #copy the files to the Far Sync instance hosts using the new names "orapwFSTOR" and "orapwFSSYD" scp -p /home/oracle/orapw farsync-toronto:/u01/app/oracle/product/19c/dbhome_1/dbs/orapwFSTOR scp -p /home/oracle/orapw farsync-sydney:/u01/app/oracle/product/19c/dbhome_1/dbs/orapwFSSYD
- Erstellen Sie eine Parameterdatei.
Erstellen Sie eine Parameterdatei für die Far Sync-Instanz aus der Primärdatenbank, kopieren Sie sie in die Far Sync-Instanzhosts, und passen Sie die Parameter an die Parameterwerte und Verzeichnispfade für die Far Sync-Instanz an.
Alternativ können Sie mit einer neuen Parameterdatei auf den Far Sync-Instanzhosts beginnen (z.B. in der Region Toronto).
#create a parameter file vi /u01/app/oracle/product/19c/dbhome_1/dbs/init_FSTOR.ora *.db_name='DBTOR' *.db_unique_name='FSTOR' *.compatible='19.0.0' *.control_files='/u01/app/oracle/oradata/fstor/controlfs/controlfs.ctl' *.diagnostic_dest='/u01/app/oracle/oradata/fstor/diag/' *.core_dump_dest='/u01/app/oracle/oradata/fstor/coredump/' *.audit_file_dest='/u01/app/oracle/oradata/fstor/audit/' *.audit_trail='DB' *.db_recovery_file_dest='/u01/app/oracle/oradata/fstor/fra/' *.db_recovery_file_dest_size=250g *.dg_broker_config_file1='/u01/app/oracle/oradata/fstor/dg_broker/fstor_01.dat' *.dg_broker_config_file2='/u01/app/oracle/oradata/fstor/dg_broker/fstor_02.dat' *.dg_broker_start=TRUE*.dispatchers='(PROTOCOL=TCP) (SERVICE=FSTORXDB)' *.standby_file_management='AUTO' #start the instance with the parameter file export ORACLE_SID=FSTOR sqlplus / as sysdba startup pfile='/u01/app/oracle/product/19c/dbhome_1/dbs/init_FSTOR.ora' nomount; #create an spfile create spfile='/u01/app/oracle/product/19c/dbhome_1/dbs/spfileFSTOR.ora' from pfile='/u01/app/oracle/product/19c/dbhome_1/dbs/init_FSTOR.ora'; #restart the instance with the spfile shutdown immediate; startup mount; select name, db_unique_name, database_role, open_mode from v$database;
In der Region Sydney:
#create a parameter file vi /u01/app/oracle/product/19c/dbhome_1/dbs/init_FSSYD.ora *.db_name='DBTOR' *.db_unique_name='FSSYD' *.compatible='19.0.0' *.control_files='/u01/app/oracle/oradata/fssyd/controlfs/controlfs.ctl' *.diagnostic_dest='/u01/app/oracle/oradata/fssyd/diag/' *.core_dump_dest='/u01/app/oracle/oradata/fssyd/coredump/' *.audit_file_dest='/u01/app/oracle/oradata/fssyd/audit/' *.audit_trail='DB' *.db_recovery_file_dest='/u01/app/oracle/oradata/fssyd/fra/' *.db_recovery_file_dest_size=250g *.dg_broker_config_file1='/u01/app/oracle/oradata/fssyd/dg_broker/fssyd_01.dat' *.dg_broker_config_file2='/u01/app/oracle/oradata/fssyd/dg_broker/fssyd_02.dat' *.dg_broker_start=TRUE *.dispatchers='(PROTOCOL=TCP) (SERVICE=FSSYDXDB)' *.standby_file_management='AUTO' #start the instance with the parameter file export ORACLE_SID=FSSYD sqlplus / as sysdba startup pfile='/u01/app/oracle/product/19c/dbhome_1/dbs/init_FSSYD.ora' nomount; #create an spfile create spfile='/u01/app/oracle/product/19c/dbhome_1/dbs/spfileFSSYD.ora' from pfile='/u01/app/oracle/product/19c/dbhome_1/dbs/init_FSSYD.ora'; #restart the instance with the spfile shutdown immediate; startup mount; select name, db_unique_name, database_role, open_mode from v$database;
- Erstellen Sie einen Datenbank-Listener.
Erstellen und starten Sie auf den Far Sync-Hosts einen Datenbank-Listener.
In der Region Toronto:
vi $ORACLE_HOME/network/admin/listener.ora LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = farsync-toronto.hubsubnettoront.hubvcntoronto.oraclevcn.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) lsnrctl start lsnrctl services
In der Region Sydney:
vi $ORACLE_HOME/network/admin/listener.ora LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = farsync-sydney.hubsubnetsydney.hubvcnsydney.oraclevcn.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) lsnrctl start lsnrctl services
- Fügen Sie primäre und Standby-TNS-Einträge zu den Far Sync-Hosts hinzu.
vi $ORACLE_HOME/network/admin/tnsnames.ora DB_TORONTO= (DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=vmc1ca-4vzoi-scan.ocidbdelegated.ocivnoffsitedb.oraclevcn.com)(PORT=1521)) (CONNECT_DATA= (SERVER=DEDICATED) (SERVICE_NAME=db_toronto.ocidbdelegated.ocivnoffsitedb.oraclevcn.com) ) ) DB_SYDNEY= (DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=abvmc1auseh-glcfo-scan.ociabvnet5subn.ociabvirtualne.oraclevcn.com)(PORT=1521)) (CONNECT_DATA= (SERVER=DEDICATED) (SERVICE_NAME=db_sydney.ociabvnet5subn.ociabvirtualne.oraclevcn.com) ) )
- Fügen Sie die TSN-Einträge für die Far Sync zu den Hosts der Primär- und Standbydatenbank hinzu.
Fügen Sie die TNS-Verbindungszeichenfolgen der Far Sync-Instanzen zur Datei
tnsname.ora
auf den Primär- und Standbydatenbankhosts (auf allen Hosts des Exadata-VM-Clusters) hinzu.vi $ORACLE_HOME/network/admin/dbtor/tnsnames.ora FSTOR = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = farsync-toronto)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = FSTOR) ) ) FSSYD = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = farsync-sydney)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = FSSYD) ) ) #test the connectivity sqlplus SYS@FSTOR as sysdba show parameter instance_name sqlplus SYS@FSSYD as sysdba show parameter instance_name #if the connection fails, make sure port 1521 is open on the Far Sync instance hosts sudo firewall-cmd --permanent --add-port=1521/tcp sudo firewall-cmd --reload
- Fügen Sie die Far Sync-Instanzen zur Active Data Guard-Konfiguration hinzu, und aktivieren Sie sie.
Verwenden Sie den Active Data Guard-Broker, um die Far Sync-Instanz der vorhandenen Active Data Guard-Konfiguration hinzuzufügen, während Sie bei der Primärdatenbank angemeldet sind.
dgmgrl SYS as sysdba DGMGRL> ADD FAR_SYNC FSTOR AS CONNECT IDENTIFIER IS FSTOR; DGMGRL> ENABLE FAR_SYNC fstor; DGMGRL> ADD FAR_SYNC FSSYD AS CONNECT IDENTIFIER IS FSSYD; DGMGRL> ENABLE FAR_SYNC fssyd;
- Bearbeiten Sie die RedoRoutes-Eigenschaften des Active Data Guard-Brokers.
Verwenden Sie die Eigenschaft RedoRoutes des Active Data Guard-Brokers, um die Primärdatenbank so zu konfigurieren, dass das Redo zur lokalen Far Sync-Instanz im Modus FastSync übertragen wird, und die Far Sync-Instanz, um das Redo an die Remotestandbydatenbank im ASYNC-Modus weiterzuleiten.
EDIT DATABASE 'db_toronto' SET PROPERTY RedoRoutes = '( LOCAL : ( fstor FASTSYNC PRIORITY=1, db_sydney ASYNC PRIORITY=2 ))'; EDIT FAR_SYNC 'fstor' SET PROPERTY RedoRoutes = '( db_toronto : db_sydney ASYNC )'; EDIT DATABASE 'db_sydney' SET PROPERTY RedoRoutes = '( LOCAL : ( fssyd FASTSYNC PRIORITY=1, db_toronto ASYNC PRIORITY=2 ))'; EDIT FAR_SYNC 'fssyd' SET PROPERTY RedoRoutes = '( db_sydney : db_toronto ASYNC )';
Die Datenbankparameterlog_archive_dest_n
für die Primär-, Standby- und Far Sync-Instanzen werden jetzt entsprechend festgelegt. - Ändern Sie den Schutzmodus der Active Data Guard-Konfiguration.
Erhöhen Sie den Schutzmodus der Active Data Guard-Konfiguration auf "Maximale Verfügbarkeit".
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
- Prüfen Sie die Konfiguration von Active Data Guard.
Prüfen Sie die Konfiguration.
DGMGRL> show configuration Configuration - dbtor_dgconf Protection Mode: MaxAvailability Members: db_toronto - Primary database fstor - Far sync instance db_sydney - Physical standby database Members Not Receiving Redo: fssyd - Far sync instance Fast-Start Failover: Disabled Configuration Status: SUCCESS (status updated 57 seconds ago)
Hinweis:
Am Anfang zeigt die Remote Far Sync-Instanz die Warnung "Warnung: ORA-16789: Standby Redo Logs falsch konfiguriert" an, bis sie Redo-Daten zum ersten Mal empfängt, entweder nach einem Rollenwechsel oder indem sie die Konfiguration der Redo-Routen vorübergehend ändert, um Daten an die Remote Far Sync-Instanz zu senden.Prüfen Sie die Konfiguration nach dem Switchover.
DGMGRL> show configuration Configuration - dbtor_dgconf Protection Mode: MaxAvailability Members: db_sydney - Primary database fssyd - Far sync instance db_toronto - Physical standby database Members Not Receiving Redo: fstor - Far sync instance Fast-Start Failover: Disabled Configuration Status: SUCCESS (status updated 54 seconds ago)