码迷,mamicode.com
首页 > 数据库 > 详细

Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Active dataguard

时间:2017-07-05 22:58:37      阅读:330      评论:0      收藏:0      [点我收藏+]

标签:log   system   role   can   name   prot   protect   apply   stand   

1. 检查主备库的状态

  • on primary
column DATABASE_ROLE format a20
column OPEN_MODE format a15
column PROTECTION_MODE format a20
column SWITCHOVER_STATUS format a20
select DATABASE_ROLE,OPEN_MODE,PROTECTION_MODE,SWITCHOVER_STATUS from v$database;

DATABASE_ROLE         OPEN_MODE         PROTECTION_MODE      SWITCHOVER_STATUS
-------------------- --------------- -------------------- --------------------
PRIMARY          READ WRITE      MAXIMUM PERFORMANCE  TO STANDBY

select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
        68
  • on standby
column DATABASE_ROLE format a20
column OPEN_MODE format a15
column PROTECTION_MODE format a20
column SWITCHOVER_STATUS format a20
select DATABASE_ROLE,OPEN_MODE,PROTECTION_MODE,SWITCHOVER_STATUS from v$database;

DATABASE_ROLE        OPEN_MODE       PROTECTION_MODE      SWITCHOVER_STATUS
-------------------- --------------- -------------------- --------------------
PHYSICAL STANDBY     MOUNTED         MAXIMUM PERFORMANCE  NOT ALLOWED

select SEQUENCE#,APPLIED from v$archived_log where SEQUENCE#=(select max(sequence#) from v$archived_log);

 SEQUENCE# APPLIED
---------- ---------------------------
    68   IN-MEMORY

select process,status,sequence# from v$managed_standby;

PROCESS             STATUS                  SEQUENCE#
------------------- ----------------------- ----------
ARCH                CLOSING                     68
ARCH                CONNECTED                    0
ARCH                CONNECTED                    0
ARCH                CLOSING                     65
RFS                 IDLE                         0
RFS                 IDLE                        69
RFS                 IDLE                         0
MRP0                APPLYING_LOG                69

2. 取消备库的MPR恢复线程

alter database recover managed standby database cancel;

3. 备库以readonly方式打开

alter database open read only;

select DATABASE_ROLE,OPEN_MODE,PROTECTION_MODE,SWITCHOVER_STATUS from v$database;

DATABASE_ROLE        OPEN_MODE       PROTECTION_MODE      SWITCHOVER_STATUS
-------------------- --------------- -------------------- --------------------
PHYSICAL STANDBY     READ ONLY       MAXIMUM PERFORMANCE  NOT ALLOWED

select process,status,sequence# from v$managed_standby;

PROCESS             STATUS                  SEQUENCE#
------------------- ----------------------- ----------
ARCH                CLOSING                     68
ARCH                CONNECTED                    0
ARCH                CONNECTED                    0
ARCH                CLOSING                     65
RFS                 IDLE                         0
RFS                 IDLE                        69
RFS                 IDLE                         0

4. 开启备库的MPR线程

alter database recover managed standby database using current logfile disconnect from session;
select process,status,sequence# from v$managed_standby; PROCESS STATUS SEQUENCE# ------------------- ----------------------- ---------- ARCH CLOSING 68 ARCH CONNECTED 0 ARCH CONNECTED 0 ARCH CLOSING 65 RFS IDLE 0 RFS IDLE 69 RFS IDLE 0 MRP0 APPLYING_LOG 69

5. 测试active dataguard

  • on primary
create table test01 as select FILE_NAME from dba_data_files;
select * from test01;

FILE_NAME
------------------------------------------------------------
/u01/app/oracle/oradata/userdata/users01.dbf
/u01/app/oracle/oradata/userdata/undotbs01.dbf
/u01/app/oracle/oradata/userdata/sysaux01.dbf
/u01/app/oracle/oradata/userdata/system01.dbf
  • on standby
select * from test01;

FILE_NAME
------------------------------------------------------------
/u01/app/oracle/oradata/userdata/users01.dbf
/u01/app/oracle/oradata/userdata/undotbs01.dbf
/u01/app/oracle/oradata/userdata/sysaux01.dbf
/u01/app/oracle/oradata/userdata/system01.dbf

Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Active dataguard

标签:log   system   role   can   name   prot   protect   apply   stand   

原文地址:http://www.cnblogs.com/ilifeilong/p/7123762.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!