主页 > 知识库 > 详解Oracle dg 三种模式切换

详解Oracle dg 三种模式切换

热门标签:网站排名优化 铁路电话系统 Linux服务器 服务外包 AI电销 呼叫中心市场需求 百度竞价排名 地方门户网站

oracle dg 三大模式切换

===================================
1  最大性能模式MAXIMUM PERFORMANCE   ------默认模式
===================================

一 最大性能模式特点

192.168.1.181
SQL> select database_role,protection_mode,protection_level from v$database;
DATABASE_ROLE  PROTECTION_MODE   PROTECTION_LEVEL
---------------- -------------------- --------------------
PRIMARY     MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
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> show parameter log_archive
NAME                 TYPE    VALUE
------------------------------------ ----------- ------------------------------
log_archive_config          string   dg_config=(orcl,db01)
log_archive_dest_1          string   location=/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_logfiles,primar
                         y_roles) db_unique_name=db01
SQL> archive log list
Database log mode       Archive Mode
Automatic archival       Enabled
Archive destination      /home/oracle/arch_orcl
Oldest online log sequence   31
Next log sequence to archive  33
Current log sequence      33
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$archive_dest_status;
DEST_NAME         STATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1    VALID
LOG_ARCHIVE_DEST_2    VALID
SQL> show parameter log_archive
NAME                 TYPE    VALUE
------------------------------------ ----------- ------------------------------
log_archive_config          string   dg_config=(db01,orcl)
log_archive_dest_1          string   location=/home/oracle/arch_db0
                         1 valid_for=(all_logfiles,all_
                         roles) db_unique_name=db01
log_archive_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 archival       Enabled
Archive destination      /home/oracle/arch_orcl
Oldest online log sequence   31
Next log sequence to archive  33
Current log sequence      33
192.168.1.181
SQL> alter system switch logfile;
SQL> archive log list
Database log mode       Archive Mode
Automatic archival       Enabled
Archive destination      /home/oracle/arch_orcl
Oldest online log sequence   32
Next log sequence to archive  34
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   32
Next log sequence to archive  0
Current log sequence      34

===================================
2 最大性能模式--切换到-->最大高可用  (默认是最大性能模式---MAXIMUM PERFORMANCE)
===================================

192.168.1.181
SQL> select DATABASE_ROLE,PROTECTION_MODE,PROTECTION_LEVEL from v$database; 
DATABASE_ROLE  PROTECTION_MODE   PROTECTION_LEVEL
---------------- -------------------- --------------------
PRIMARY     MAXIMUM 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_name=db01
192.168.1.181
SQL> shutdown immediate
192.168.1.183
SQL> alter database recover managed standby database cancel;
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> 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 destination      /home/oracle/arch_orcl
Oldest online log sequence   34
Next log sequence to archive  36
Current log sequence      36
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> 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   35
Next log sequence to archive  0
Current log sequence      36
192.168.1.181
SQL> alter system switch logfile;
SQL> archive log list
Database log mode       Archive Mode
Automatic archival       Enabled
Archive destination      /home/oracle/arch_orcl
Oldest online log sequence   35
Next log sequence to archive  37
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   36
Next log sequence to archive  0
Current log sequence      37

===================================
3 最大高可用--切换到-->最保护能模式
===================================

DG最大保护模式Maximum protection

192.168.1.181
SQL> shutdown immediate
192.168.1.183
SQL> shutdown immediate
192.168.1.181
SQL> alter database set standby database to maximize protection;
SQL> shutdown immediate
192.168.1.183
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> 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 log mode       Archive Mode
Automatic archival       Enabled
Archive destination      /home/oracle/arch_orcl
Oldest online log sequence   37
Next log sequence to archive  39
Current log sequence      39
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> 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 log mode       Archive Mode
Automatic archival       Enabled
Archive destination      /home/oracle/arch_db01
Oldest online log sequence   37
Next log sequence to archive  0
Current log sequence      39
192.168.1.181
SQL> alter system switch logfile;
SQL> archive log list
Database log mode       Archive Mode
Automatic archival       Enabled
Archive destination      /home/oracle/arch_orcl
Oldest online log sequence   38
Next log sequence to archive  40
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   37
Next log sequence to archive  0
Current log sequence      40

附:Oracle DG管理模式和只读模式相互切换

将standby数据库开启至只读模式(用于primary非常忙时,可以在standby跑一些报表)

$sqlplus “/as sysdba”
SQL>startup mount
SQL>alter database open read only;
[@more@]

将只读模式standby数据库切换至管理模式

$sqlplus “/as sysdba”
SQL>alter database recover managed standby database disconnect from session;

 将管理模式的standby数据库切换至只读模式

$sqlplus “/as sysdba”
SQL>alter database recover managed standby database cancel;
SQL>alter database open read only;

以上内容给大家介绍了Oracle dg 三种模式切换的相关知识,希望大家喜欢。

您可能感兴趣的文章:
  • DBCA命令行搭建Oracle ADG的流程
  • Oracle 给rac创建单实例dg并做主从切换功能
  • Oracle 10g DG 数据文件迁移的实现
  • Oracle数据库 DGbroker三种保护模式的切换
  • win平台oracle rman备份和删除dg备库归档日志脚本
  • Oracle区别ADG与DG案例详解

标签:黄山 仙桃 崇左 兰州 衡水 铜川 湘潭 湖南

巨人网络通讯声明:本文标题《详解Oracle dg 三种模式切换》,本文关键词  ;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 收缩
    • 微信客服
    • 微信二维码
    • 电话咨询

    • 400-1100-266