1 2 |
col DATABASE_ROLE for a20col SWITCHOVER_STATUS for a20 select DATABASE_ROLE,switchover_status from v$database; |
1 |
alter system set dg_broker_start=true scope=both sid='*'; (it is recommended doing this on all of the nodes) |
To Switchover
In Primary
1 |
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;SHUTDOWN IMMEDIATE; |
In Standby
If the Managed Recovery Process (MRP) has stopped
1 2 |
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY; ALTER DATABASE OPEN; |
Original Primary (Currently Standby)
1 |
STARTUP MOUNT;ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT; |
Error
1 2 3 4 |
ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY; ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY * ORA-01105: mount is incompatible with mounts by other instances |
Action: Query the GV$INSTANCE view as follows to determine which instances are causing the problem:
1 |
SELECT INSTANCE_NAME, HOST_NAME FROM GV$INSTANCEWHERE INST_ID <> (SELECT INSTANCE_NUMBER FROM V$INSTANCE); |
INSTANCE_NAME————-INST2
HOST_NAME—————–standby2
In the previous example, the identified instance must be manually shut down before the switchover can proceed. You can connect to the identified instance from your instance and issue the SHUTDOWN statement remotely, for example:
1 2 3 4 |
CONNECT SYS@standby2 AS SYSDBA Enter Password: SHUTDOWN; EXIT |
Protection Modes
1 |
SELECT protection_mode FROM v$database;select database_role, open_mode, name, db_unique_name from v$database; |
Primary
1 |
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=stdmx AFFIRM SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stdmx' scope=both sid='*'; |
Standby
1 |
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=mx AFFIRM SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=mx' scope=both sid='*'; |
Maximum Availability
1 |
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=db11g_stby AFFIRM SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DB11G_STBY';ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY; |
Maximum Performance
1 |
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=db11g_stby NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DB11G_STBY';ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE; |
Maximum Protection
1 2 3 4 5 6 7 |
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=db11g_stby AFFIRM SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DB11G_STBY';SHUTDOWN IMMEDIATE; STARTUP MOUNT; ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION; ALTER DATABASE OPEN; |
Setting log_archive_dest_state to defer mode in the Primary
1 2 3 4 5 |
alter system set log_archive_dest_state_2=defer sid = '*'; alter system switch logfile ; shutdown immediate |
Shutdown Managed Recovery Process (MRP) in the Standby
1 2 |
alter database recover managed standby database cancel; shutdown immediate; |
1 2 3 4 5 6 7 8 |
startup nomount; alter database mount standby database; alter database recover managed standby database using current logfile disconnect; alternatively alter database recover managed standby database disconnect from session; |
Open the primary database, enable log_archive_dest_state and alter the system switch logfile;
1 |
alter system set log_archive_dest_state_2=enable scope = both sid = '*'; |
Using RMAN for...
12 March 2019