Oracle 11g Active Data Guard搭建、管理(2)

二、SQL*NET 配置

在创建备库前,要确认两台服务器的数据库之间能通信,如果我们要用 RMAN 的 duplicate from active database 命令创建备库的话。我们需要配置监听和 TNS 名。

虽然数据库会自动注册监听,但如果要使用 RMAN的 duplicate 命令创建备库,备库必须首先处于 NOMOUNT 状态。在 NOMOUNT 状态下,数据库实例不会自动注册监听,你必须配置静态监听。另外必须要注意的一点是,NOMOUNT 状态下的数据库必须使用专用模式(dedicated server)连接。

两台服务器上的 TNS 名字文件必须配置好,让主备库能用 LOG_ARCHIVE_DEST_N 和 FAL_SERVER 参数(稍后会介绍这些参数)中的服务名(Service Names)找到对方。具体配置应类似下例。

修改主备库listener.ora,tnsnames.ora文件如下,备库根据自身情况修改

SDU=32767 为DG优化网络传输参数

修改主库监听配置$Oracle_HOME/network/admin/listener.ora

********************* listener.ora *******************************

# listener.ora Network Configuration File:/data/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SDU=32767)

(GLOBAL_DBNAME = orcl_primary)

(ORACLE_HOME =/data/oracle/app/oracle/product/11.2.0/dbhome_1)

(SID_NAME = orcl)

)

)

LISTENER =

(DESCRIPTION =

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

)

ADR_BASE_LISTENER =/data/oracle/app/oracle

*********************listener.ora *******************************

修改备库监听配置同上,除了HOST地址更改为备库服务器地址

********************* listener.ora *******************************

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SDU=32767)

(GLOBAL_DBNAME = orcl_standby)

(ORACLE_HOME =/data/oracle/app/oracle/product/11.2.0/dbhome_1)

(SID_NAME = orcl)

)

)

LISTENER =

(DESCRIPTION =

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

)

ADR_BASE_LISTENER =/data/oracle/app/oracle

*********************listener.ora *******************************

修改配置tnsname.ora文件(主、备库都都为如下)

说明:orcl_primary是主库的服务名,orcl_standby是备库的服务名。

$ vi$ORACLE_HOME/network/admin/tnsnames.ora

******************* tnsnames.ora ****************************

# listener.ora Network Configuration File:/data/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SDU=32767)

(GLOBAL_DBNAME = orcl_primary)

(ORACLE_HOME =/data/oracle/app/oracle/product/11.2.0/dbhome_1)

(SID_NAME = orcl)

)

)

LISTENER =

(DESCRIPTION =

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

)

ADR_BASE_LISTENER =/data/oracle/app/oracle

[oracle@oradb205 admin]$ cat tnsnames.ora

orcl_primary =

(DESCRIPTION =

(SDU=32767)

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

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl_primary)

)

)

orcl_standby =

(DESCRIPTION =

(SDU=32767)

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

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = orcl_standby)

#(UR = A)

)

)

for_db =

(DESCRIPTION =

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

)

*******************tnsnames.ora ****************************

测试服务名连通性

$ tnsping orcl_primary

$ tnsping orcl_standby

现在主备库之间依旧可以互相通信了

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/0daa89d8e248aa8f8e0e67d68181ff6c.html