Quando si dispone di un'attività pianificata, ad esempio la manutenzione, è possibile rendere il database in Oracle Cloud Infrastructure (OCI) il database primario senza perdita di dati. Uno switchover è un evento pianificato avviato sul database in locale e completato sull'istanza di database nel cloud.
- Eseguire il login a una sessione DGMGRL nel database in locale con nome utente e password
sys
.
- Nel database in locale, verificare che il database in standby sia pronto per lo switchover e il failover.
In questo esempio, il database primario è db1
e il database in standby (StandbyDatabaseOCIInstance
) è DB1_phx3g7
.
DGMGRL> validate database DB1_phx3g7
L'output sarà simile a quanto segue:
Database Role: Physical standby database
Primary Database: db1
Ready for Switchover: Yes
Ready for Failover: Yes (Primary Running)
Managed by Clusterware:
db1 : YES
db1_phx3g7: YES
Standby Apply-Related Information:
Apply State: Running
Apply Lag: 17 minutes 6 seconds (computed 42 seconds ago)
Apply Delay: 0 minutes
Current Log File Groups Configuration:
Thread # Online Redo Log Groups Standby Redo Log Groups Status
(db1) (db1_phx3g7)
1 2 0 Insufficient SRLs
Warning: standby redo logs not configured for thread 1 on db1_phx3g7
2 2 0 Insufficient SRLs
Warning: standby redo logs not configured for thread 2 on db1_phx3g7
Future Log File Groups Configuration:
Thread # Online Redo Log Groups Standby Redo Log Groups Status
(db1_phx3g7) (db1)
1 2 0 Insufficient SRLs
Warning: standby redo logs not configured for thread 1 on db1
2 2 0 Insufficient SRLs
Warning: standby redo logs not configured for thread 2 on db1
- Convalidare il database primario.
DGMGRL> validate database 'DB1';
L'output sarà simile a quanto segue:
Database Role: Primary database
Ready for Switchover: Yes
Managed by Clusterware:
db1: YES
- Convalidare il database in standby.
DGMGRL> validate database 'DB1_phx3g7';
L'output sarà simile a quanto segue:
Database Role: Physical standby database
Primary Database: db1
Ready for Switchover: Yes
Ready for Failover: Yes (Primary Running)
Managed by Clusterware:
db1 : YES
db1_phx3g7: YES
Standby Apply-Related Information:
Apply State: Running
Apply Lag: 32 minutes 12 seconds (computed 40 seconds ago)
Apply Delay: 0 minutes
Current Log File Groups Configuration:
Thread # Online Redo Log Groups Standby Redo Log Groups Status
(db1) (db1_phx3g7)
1 2 0 Insufficient SRLs
Warning: standby redo logs not configured for thread 1 on db1_phx3g7
2 2 0 Insufficient SRLs
Warning: standby redo logs not configured for thread 2 on db1_phx3g7
Future Log File Groups Configuration:
Thread # Online Redo Log Groups Standby Redo Log Groups Status
(db1_phx3g7) (db1)
1 2 0 Insufficient SRLs
Warning: standby redo logs not configured for thread 1 on db1
2 2 0 Insufficient SRLs
Warning: standby redo logs not configured for thread 2 on db1
- Nel database in locale (primario), eseguire il comando per passare al database in standby.
DGMGRL> switchover to db1_phx3g7;
L'output sarà simile a quanto segue:
Performing switchover NOW, please wait...
Operation requires a connection to database "db1_phx3g7"
Connecting ...
Connected to "DB1_phx3g7"
Connected as SYSDBA.
New primary database "db1_phx3g7" is opening...
Oracle Clusterware is restarting database "db1" ...
Connected to "db1"
Connected to "db1"
Switchover succeeded, new primary is "db1_phx3g7"
- Nel database in locale, visualizzare lo stato di configurazione.
DGMGRL> show configuration
L'output sarà simile a quanto segue:
Configuration - onpremexadr
Protection Mode: MaxPerformance
Members:
db1_phx3g7 - Primary database
db1 - Physical standby database
Warning: ORA-16809: multiple warnings detected for the memberFast-Start
Failover: Disabled
Configuration Status:
WARNING (status updated 35 seconds ago)
- Nella Oracle Exadata Database Machine locale principale selezionare la modalità di apertura.
SQL> select open_mode from v$database;
L'output sarà simile a quanto segue:
OPEN_MODE
--------------------
MOUNTED
- Nel database Oracle Database Exadata Cloud Service nel cloud confermare che il database è READ WRITE.
SQL> select open_mode from v$database;
L'output sarà simile a quanto segue:
OPEN_MODE
--------------------
READ WRITE
Il database su Oracle Database Exadata Cloud Service nel cloud è il database primario.