欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【12c】DataGuard构建物理备用数据库(Cloud Control方式)

程序员文章站 2022-05-10 12:10:23
...

前面介绍了如何通过RMAN Duplicate方式构建物理备用数据库,本篇将演示如何利用Cloud Control构建物理备用数据库。

1 软件环境

  • Oracle Linux 6.9
  • Oracle 12.1.0.2
  • Oracle Enterprise Management Cloud Control 12.1.0.4
  • 主库:odd.oracle.com,IP:192.168.1.105
  • 备库:even.oracle.com,IP:192.168.1.106

2 使用Cloud Control创建备库

2.1 网络配置

2.1.1 主库网络配置

1)监听器配置

[aaa@qq.com admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.



SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = ORCL)

(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)

(SID_NAME = ORCL)

)

)



LISTENER =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = odd.oracle.com)(PORT = 1521))

)



ADR_BASE_LISTENER = /u01/app/oracle

2)TNS配置

[aaa@qq.com admin]$ cat tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.



TNS_ODD =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.105)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = ORCL)

)

)



TNS_EVEN =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.106)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = ORCLDG)

)

)

2.1.2 备库网络配置

1)监听器配置

[aaa@qq.com admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.



SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = ORCLDG)

(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)

(SID_NAME = ORCLDG)

)

)



LISTENER =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = even.oracle.com)(PORT = 1521))

)



ADR_BASE_LISTENER = /u01/app/oracle

2)TNS配置

[aaa@qq.com admin]$ cat tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.



TNS_ODD =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.105)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = ORCL)

)

)



TNS_EVEN =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.106)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = ORCLDG)

)

)

2.1.3 测试网络

1)主库测试

[aaa@qq.com ~]$ tnsping tns_odd

[aaa@qq.com ~]$ tnsping tns_even

2)备库测试

[aaa@qq.com admin]$ tnsping tns_odd

[aaa@qq.com admin]$ tnsping tns_even

2.2 图形界面创建备库

1)登录Cloud Control,进入目标>数据库实例ORCL

【12c】DataGuard构建物理备用数据库(Cloud Control方式)2)输入用户名和口令,点击登录【12c】DataGuard构建物理备用数据库(Cloud Control方式)3)添加备用数据库,点击继续

【12c】DataGuard构建物理备用数据库(Cloud Control方式)4)设置备份类型,点击下一步

【12c】DataGuard构建物理备用数据库(Cloud Control方式)5)备份选项,不勾选,点击下一步

【12c】DataGuard构建物理备用数据库(Cloud Control方式)6)备库配置页,点击检索按钮

【12c】DataGuard构建物理备用数据库(Cloud Control方式)7)选择目标备库所在主机

【12c】DataGuard构建物理备用数据库(Cloud Control方式)8)填写备库信息后,点击下一步

【12c】DataGuard构建物理备用数据库(Cloud Control方式)9)选择备库文件位置为OFA,点击定制

【12c】DataGuard构建物理备用数据库(Cloud Control方式)10)检查所有文件路径,确保ORCL置换为ORCLDG,点击确定

【12c】DataGuard构建物理备用数据库(Cloud Control方式)11)出现警告,点击继续

【12c】DataGuard构建物理备用数据库(Cloud Control方式)12)回到文件位置配置页,点击下一步

【12c】DataGuard构建物理备用数据库(Cloud Control方式)13)备库配置页面,更改备库参数,点击下一步

【12c】DataGuard构建物理备用数据库(Cloud Control方式)14)添加备库复查页面,如没问题,点击完成

【12c】DataGuard构建物理备用数据库(Cloud Control方式)15)点击检查作业链接

【12c】DataGuard构建物理备用数据库(Cloud Control方式)16)作业执行过程中

【12c】DataGuard构建物理备用数据库(Cloud Control方式)17)在Oracle数据库>作业活动页,可看到正在创建备库

【12c】DataGuard构建物理备用数据库(Cloud Control方式)2.3 搭建完毕,验证

2.3.1 主库操作

1)查询主库角色信息

SQL> select name,open_mode,database_role,db_unique_name,dataguard_broker from v$database;



NAME OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME DATAGUAR

--------- -------------------- ---------------- ------------------------------ --------

ORCL READ WRITE PRIMARY ORCL ENABLED

2)创建测试数据

SQL> create table scott.test(id number,name varchar2(100));



Table created.

SQL> insert into scott.test values(1,'Alen');



1 row created.



SQL> commit;



Commit complete.

 3)查询数据

SQL> select * from scott.test;



ID NAME

---------- ----------------------------------------------------------------------------------------------------

1 Alen

 2.3.2 备库操作

1)查询主库角色信息

SQL> select name,open_mode,database_role,db_unique_name,dataguard_broker from v$database;



NAME OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME DATAGUAR

--------- -------------------- ---------------- ------------------------------ --------

ORCL READ ONLY WITH APPLY PHYSICAL STANDBY ORCLDG ENABLED

 2)查询数据

SQL> select * from scott.test;



ID NAME

---------- ----------------------------------------------------------------------------------------------------

1 Alen

综上,就是使用Cloud Control搭建物理备用数据库的整个过程