重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3501|回复: 0
打印 上一主题 下一主题

[认证考试] 使用broker命令行切换dg快照

[复制链接]
跳转到指定楼层
楼主
发表于 2019-3-26 19:37:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1.显示当前配置

DGMGRL> show configuration;
Configuration - cfgocm1
  Protection Mode: MaxPerformance
  Databases:
    prod1 - Primary database
    sbdb1 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
   当前备库是物理备库

2.切换到快照
DGMGRL> CONVERT DATABASE sbdb1 to SNAPSHOT STANDBY;

Converting database "sbdb1" to a Snapshot Standby database, please wait...
Database "sbdb1" converted successfully

3.确认已经切换到快照库
查看配置:
DGMGRL> show configuration ;
Configuration - cfgocm1
  Protection Mode: MaxPerformance
  Databases:
    prod1 - Primary database
    sbdb1 - Snapshot standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

4.在快照库做dml操作测试
SQL> select name,DATABASE_ROLE,open_mode from v$database;
NAME      DATABASE_ROLE    OPEN_MODE
--------- ---------------- --------------------
PROD1     SNAPSHOT STANDBY READ WRITE

--建立一张测试表
SQL> create table sztech as select * from all_tables;
Table created.
SQL> select count(*) from sztech;
  COUNT(*)
----------
      2843

5.由快照库切换回物理备库
语法:
DGMGRL> help convert
Converts a database from one type to another
Syntax:
  CONVERT DATABASE <database name> TO
     {SNAPSHOT STANDBY|PHYSICAL STANDBY};


DGMGRL> CONVERT DATABASE sbdb1 to PHYSICAL STANDBY;
Converting database "sbdb1" to a Physical Standby database, please wait...
Operation requires shutdown of instance "sbdb1" on database "sbdb1"
Shutting down instance "sbdb1"...
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "sbdb1" on database "sbdb1"
Starting instance "sbdb1"...
ORACLE instance started.
Database mounted.
Continuing to convert database "sbdb1" ...
Operation requires shutdown of instance "sbdb1" on database "sbdb1"
Shutting down instance "sbdb1"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "sbdb1" on database "sbdb1"
Starting instance "sbdb1"...
ORACLE instance started.
Database mounted.
Database "sbdb1" converted successfully
DGMGRL>

6.验证已经切换回物理备库

DGMGRL> show configuration ;   
Configuration - cfgocm1
  Protection Mode: MaxPerformance
  Databases:
    prod1 - Primary database
    sbdb1 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

--快照库创建的表,已经不见。

SQL> conn sys/oracle@sbdb1 as sysdba
Connected.
SQL> select name,DATABASE_ROLE,open_mode from v$database;
NAME      DATABASE_ROLE    OPEN_MODE
--------- ---------------- --------------------
PROD1     PHYSICAL STANDBY READ ONLY WITH APPLY
SQL> select count(*) from sztech;
select count(*) from sztech
                     *
ERROR at line 1:
ORA-00942: table or view does not exist

到此,使用broker 命令行dgmgrl手工切换快照库并回切到物理备库完成。




分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-27 07:24 , Processed in 0.094721 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表