导航

  Data Guard搭建完毕之后,执行开启归档路径2,结果发现不同步,

SQL> alter system set log_archive_dest_state_2=enable;

  查看错误日志,发现有PING[ARC2]: Heartbeat failed to connect to standby 'gqtzdb_dg'. Error is 16047.的报错:

[oracle@KG-ORA-01 trace]$ tail -100f alert_gqtzdb.log 
Mon Jul 03 18:19:10 2017
Using STANDBY_ARCHIVE_DEST parameter default value as /oradata/gqtzdb/archivelog
ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=BOTH;
Mon Jul 03 18:19:10 2017
PING[ARC2]: Heartbeat failed to connect to standby 'gqtzdb_dg'. Error is 16047.

  接着查看v$archive_dest视图,查看是否能找到原因,结果发现如下报错:

SQL> select dest_id,error from v$archive_dest;

   DEST_ID ERROR
---------- -----------------------------------------------------------------
         1
         2 ORA-16047: DGID mismatch between destination setting and target
           database

  很明显,DGID不一样,去备库查看参数db_unique_name参数:

SQL> show parameter db_unique_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      gqtzdb

  发现db_unique_name参数没有修改,仍然是主库的值,速度改过来,并重启备库:

SQL> alter system set db_unique_name='gqtzdb_dg' scope=both;
alter system set db_unique_name='gqtzdb_dg' scope=both
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified


SQL> alter system set db_unique_name='gqtzdb_dg' scope=spfile;

System altered.

  然后再在主库开启归档路径2,在备库运行命令,查看同步状态:

SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SQL> select process,client_process,sequence#,status from v$managed_standby;

PROCESS   CLIENT_P  SEQUENCE# STATUS
--------- -------- ---------- ------------
ARCH      ARCH              0 CONNECTED
ARCH      ARCH              0 CONNECTED
ARCH      ARCH              0 CONNECTED
ARCH      ARCH              0 CONNECTED
RFS       UNKNOWN           0 IDLE
RFS       LGWR             24 IDLE
RFS       UNKNOWN           0 IDLE
RFS       UNKNOWN           0 IDLE
MRP0      N/A              11 APPLYING_LOG

9 rows selected.