dgmgrl 配置问题汇总

      用DGMGRL管理 DATA GUARD 还是比较方便的,不过当我第一次配置dg时还是遇到了一些大大小小的问题,我索性将问题和解决方法汇总并贴了出来,希望能对大家有所帮助

1、Failed to connect to remote database standby. Error is ORA-12170
这个问题毫无疑问是和Listener的配置有关,导致primary数据库无法连接到备库,说一下我的解决方法
1、将主备库的hostname 添加的各自主机的/etc/hosts/中
# Do not remove the following line, or various programs
# that require network functionality will fail.
10.1.252.152 test_host2
10.1.252.153 test_host1
正确配置Listener.ora和tnsname.ora 使服务器端能正确接收对方主机的请求,具体的配置方式取决于sqlnet.ora的定义,这里说一下我的配置
NAMES.DIRECTORY_PATH= (TNSNAMES,HOSTNAME)
注意:这里我用的HOSTNAME,那我们看一下主库中Listener.ora的配置,备库格式与其一致,这里省略。
# Lstener.ora Network Configuration File: /home/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = /home/oracle/oracle/product/10.2.0/db_1)
(GLOBAL_DBNAME = standby)
)
(SID_DESC =
(GLOBAL_DBNAME = standby_DGMGRL)
(ORACLE_HOME = /home/oracle/oracle/product/10.2.0/db_1)
(SID_NAME = orcl)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test_host2)(PORT = 1521))
)
)

再看一下tnsnames.ora的配置
primary =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test_host1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primary_dgmgrl)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = test_host2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = standby_dgmgrl)
)
)
我想大家已经看出来差别了,我使用的都是以主机名的方式来定义HOST,而平时我们所习惯的是IP。这种模式来配置我是第一次,而正是用这种方式解决了上面的问题。

2、Error: ORA-16653: failed to reinstate database
我做了一次灾难模拟,将主库shutdown (代表已经宕掉),这个时候需要做灾难切换switchover 将备库改为生产库
DGMGRL> connect sys@standby;
DGMGRL> failover to standby;
执行成功后代表灾难切换成功,这个时候需要将原主库恢复,并将其作为新的备库(角色更换)
DGMGRL> connect sys@standby;
DGMGRL> reinstate database primary;
Reinstating database "primary", please wait...
Error: ORA-16653: failed to reinstate database
执行失败,这个原因是由于在做switchover 之前没有设置 flashback,也就是说只有启用了flashback而且retention足够的话可以reinstate,否则只能recreate

关于Data Guard broker系列说明,参考一下该博文:Data Guard broker系列 官方介绍ppt

你可能感兴趣的:(系统容灾)