Oracle DG three mode switching
===================================
1 Maximum performance mode maximum performance------default mode
===================================
One of the largest performance mode features
192.168.1.181 sql> Select Database_role,protection_mode,protection_level from V$database; Database_role protection_mode protection_level--------------------------------------------------------PRIMARY M Aximum Performance MAXIMUM Performance sql> col for Dest_name A25 select sql> from Dest_name,status
Tatus; Dest_name STATUS----------------------------------log_archive_dest_1 VALID log_archive_dest_2 VALID SQL&G T Show parameter log_archive NAME TYPE VALUE---------------------------------------------------------- -------------------Log_archive_config string dg_config= (ORCL,DB01) log_archive_dest_1 string Locati On=/home/oracle/arch_orc l valid_for= (all_logfiles,all_ roles) Db_unique _NAME=ORCL log_archive_dest_2 string service=db_db01 lgwr ASYNC val id_for= (online_log Files,primar Y_roLes) db_unique_name=db01 sql> archive log List Database log mode archive mode Automatic archival Enabled Ar Chive destination/home/oracle/arch_orcl oldest online log sequence Next log sequence to archive log
Sequence 192.168.1.183 sql> select Database_role,protection_mode,protection_level from V$database; Database_role protection_mode protection_level--------------------------------------------------------Physical STANDBY MAXIMUM Performance MAXIMUM performance sql> col dest_name for A25 sql> select Dest_name,status from V$archi
Ve_dest_status; Dest_name STATUS----------------------------------log_archive_dest_1 VALID log_archive_dest_2 VALID SQL&G T Show parameter log_archive NAME TYPE VALUE---------------------------------------------------------- -------------------Log_archive_config string dg_config= (DB01,ORCL) log_archive_dest_1 string Locati On=/home/oracle/arch_db0 1 valid_for= (all_logfiles,all_ roles) Db_unique_name=db01 Log_archi
Ve_dest_2 string Service=db_orcl lgwr ASYNC val id_for= (Online_logfiles,primar Y_roles) DB_UNIQUE_NAME=ORCL sql> archive log List Database log mode archive Mode Automatic arc Hival Enabled Archive destination/home/oracle/arch_orcl oldest online log sequence Next log sequence to a
Rchive Current log sequence 192.168.1.181 sql> alter system switch logfile; Sql> Archive Log List Database log mode archive mode Automatic Archival Enabled archive destination/h OME/ORACLE/ARCH_ORCL oldest online log sequence Next log sequence to archive the current log sequence 34 192.168 .1.183 sql> Archive Log List Database log mode archive mode Automatic archival Enabled archive destination /HOME/ORACLE/ARCH_DB01 oldest online log sequence Next log sequence to archive 0 current log sequence 34
===================================
2 Maximum performance mode--switch to--> maximum high available (default is maximum performance mode---MAXIMUM performance)
===================================
192.168.1.181 sql> Select Database_role,protection_mode,protection_level from V$database; Database_role protection_mode protection_level--------------------------------------------------------PRIMARY M Aximum Performance MAXIMUM Performance sql> show parameter log_archive_dest_2 NAME TYPE VALUE------ -----------------------------------------------------------------------log_archive_dest_2 string service=db_ Db01 LGWR ASYNC val id_for= (Online_logfiles,primar y_roles) Db_unique_na ME=DB01 192.168.1.181 sql> shutdown immediate 192.168.1.183 sql> ALTER DATABASE recover managed standby database can
Cel
sql> shutdown immediate 192.168.1.181 sql> startup Mount;
Sql> ALTER DATABASE set standby database to maximize availability; Sql> alter system set log_archive_dest_2= ' Service=db_db01 lgwr SYNC valid_for= (online_logfiles,primary_roles) db_
Unique_name=db01 ' Scope=spfile; 192.168.1.183 sql> startup Nomount sql> ALTER DATABASE mount standby database; Sql> alter system set log_archive_dest_2= ' Service=db_orcl lgwr SYNC valid_for= (online_logfiles,primary_roles) db_
Unique_name=orcl ' Scope=spfile;
sql> shutdown Immediate sql> startup Nomount sql> ALTER DATABASE mount standby database;
192.168.1.181 sql> startup sql> Col dest_name for A25 sql> select Dest_name,status from V$archive_dest_status; Dest_name STATUS----------------------------------log_archive_dest_1 VALID log_archive_dest_2 VALID SQL&G T Show parameter log_archive_dest_2 NAME TYPE VALUE--------------------------------------------------- --------------------------log_archive_dest_2 string service=db_db01 lgwr SYNC Vali d_ For= (online_logfiles,primary _roles) db_unique_name=db01 sql> Select Database_role,protection_
Level,protection_mode from V$database; Database_role protection_lEvel Protection_mode--------------------------------------------------------PRIMARY MAXIMUM availability MAXIMUM Availability sql> Archive Log list Database log mode archive mode Automatic Archival Enabled archive Desti NATION/HOME/ORACLE/ARCH_ORCL oldest online log sequence Next log sequence to archive the current log sequence
192.168.1.183 sql> Col dest_name for A25 sql> select Dest_name,status from V$archive_dest_status; Dest_name STATUS----------------------------------log_archive_dest_1 VALID log_archive_dest_2 VALID SQL&G T Show parameter log_archive_dest_2 NAME TYPE VALUE--------------------------------------------------- --------------------------log_archive_dest_2 string Service=db_orcl lgwr SYNC Vali d_ For= (online_logfiles,primary _roles) db_unique_name=orcl sql> Select Database_role,protection_ Level,protection_mode from V$datAbase; Database_role protection_level protection_mode--------------------------------------------------------Physical STANDBY MAXIMUM Availability MAXIMUM Availability sql> Archive log list Database log mode archive mode Automatic Archival Enabled Archive destination/home/oracle/arch_db01 oldest online log sequence Next log sequence T
O Archive 0 Current log sequence 192.168.1.181 sql> alter system switch logfile; Sql> Archive Log List Database log mode archive mode Automatic Archival Enabled archive destination/h OME/ORACLE/ARCH_ORCL oldest online log sequence Next log sequence to archive Notoginseng current log sequence 37 192.168 .1.183 sql> Archive Log List Database log mode archive mode Automatic archival Enabled archive destination /HOME/ORACLE/ARCH_DB01 oldest online log sequence Next log sequence to archive 0 log sequence 37
===================================
3 Maximum high availability--switch to--> most protected energy mode
===================================
DG Maximum protection mode maximum protection
192.168.1.181 sql> shutdown immediate 192.168.1.183 sql> shutdown immediate 192.168.1.181 sql> ALTER DATABASE SE
T standby database to maximize protection;
sql> shutdown immediate 192.168.1.183 sql> nomount ALTER DATABASE mount Sql> database;
192.168.1.181 sql> startup sql> Col dest_name for A25 sql> select Dest_name,status from V$archive_dest_status; Dest_name STATUS----------------------------------log_archive_dest_1 VALID log_archive_dest_2 VALID SQL&G T Show parameter log_archive_dest_2 NAME TYPE VALUE--------------------------------------------------- --------------------------log_archive_dest_2 string service=db_db01 lgwr SYNC Vali d_ For= (online_logfiles,primary _roles) db_unique_name=db01 sql> Select Database_role,protection_
Level,protection_mode from V$database; Database_role protection_level Protection_mode--------------------------------------------------------PRIMARY MAXIMUM PROTECTION MAXIMUM PROTECTION sql> archive log list Database L OG mode Archive mode Automatic archival Enabled Archive DESTINATION/HOME/ORACLE/ARCH_ORCL Online Log sequence, Next log sequence to archive the current log sequence/192.168.1.183 sql> col for Dest_name
5 sql> Select Dest_name,status from V$archive_dest_status; Dest_name STATUS----------------------------------log_archive_dest_1 VALID log_archive_dest_2 VALID SQL&G T Show parameter log_archive_dest_2 NAME TYPE VALUE--------------------------------------------------- --------------------------log_archive_dest_2 string service=db_db01 lgwr SYNC Vali d_ For= (online_logfiles,primary _roles) db_unique_name=db01 sql> Select Database_role,protection_
Level,protection_mode from V$database; Database_role Protection_level ProtectiOn_mode--------------------------------------------------------PRIMARY MAXIMUM PROTECTION MAXIMUM PROTECTION sql& Gt Archive Log List Database log mode archive mode Automatic Archival Enabled archive Destination/home/orac LE/ARCH_DB01 oldest online log sequence Notoginseng Next log sequence to archive 0 log sequence SQ
l> alter system switch logfile; Sql> Archive Log List Database log mode archive mode Automatic Archival Enabled archive destination/h OME/ORACLE/ARCH_ORCL oldest online log sequence Next log sequence to archive the current log sequence 40 192.168 .1.183 sql> Archive Log List Database log mode archive mode Automatic archival Enabled archive destination /HOME/ORACLE/ARCH_DB01 oldest online log sequence Notoginseng Next log sequence to archive 0 current log sequence 40
Appendix: Oracle DG Management mode and read-only mode switch to each other
Turn the standby database into read-only mode (for primary when busy, you can run some reports in standby)
$sqlplus "/as sysdba"
sql>startup mount
sql>alter database open read only;
[@more @]
Switch read-only mode standby database to admin mode
$sqlplus "/as sysdba"
sql>alter database recover managed standby database disconnect from session;
Switch the standby database for administrative mode to read-only mode
$sqlplus "/as sysdba"
sql>alter database recover managed standby database cancel;
Sql>alter database open Read only;
The above content has introduced the Oracle DG Three kind of mode switch the related knowledge, hoped everybody likes.