DG搭建过程中一直报错:
Sat Feb 12 15:50:09 2022 PING[ARC2]: Heartbeat failed to connect to standby 'standby'. Error is 16047.
Sat Feb 12 15:51:10 2022 PING[ARC2]: Heartbeat failed to connect to standby 'standby'. Error is 16047.
Sat Feb 12 15:52:10 2022 PING[ARC2]: Heartbeat failed to connect to standby 'standby'. Error is 16047.
检查了tsname.ora
standby =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.89)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
)
检查参数设置:
SQL> show parameter log_archive_config;
NAME TYPE VALUE
log_archive_config string DG_CONFIG=(primary,standby)
SQL> show parameter log_archive_dest_2;
NAME TYPE VALUE
log_archive_dest_2 string SERVICE=standbyLGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby
-- 重新执行了一次:
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(primary,standby)' scope=both;
SQL> alter system set log_archive_dest_2='SERVICE=standbyLGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby' scope=both;
密码文件重新拷贝了一份到备库:
[oracle@primary dbs]$ scp orapwprimary 192.168.5.89:/u01/oracle/11.2.0.3/product/dbs/
oracle@192.168.5.89's password:
orapwprimary 100% 1536 1.5KB/s 00:00
该想的都检查了,但还是报错,然后查看trc文件:
[oracle@primary trace]$ ls -lrt *arc*
-rw-r----- 1 oracle asmadmin 5560 2月 12 15:58 primary_arc2_1441.trc
-rw-r----- 1 oracle asmadmin 177 2月 12 15:58 primary_arc3_1445.trm
-rw-r----- 1 oracle asmadmin 2566 2月 12 15:58 primary_arc3_1445.trc
[oracle@primary trace]$ tail -f primary_arc3_1445.trc
Redo shipping client performing standby login
*** 2022-02-12 15:58:11.661
*** 2022-02-12 15:58:11.661 4645 krsu.c
Logged on to standby successfully
Client logon and security negotiation successful! -- 发现登录备库成功
Error 16047 attaching to destination LOG_ARCHIVE_DEST_2 standby host 'standby'
*** 2022-02-12 15:58:11.676 2932 krsi.c
krsi_dst_fail: dest:2 err:16047 force:0 blast:1
kcrrwkx: unknown error:16047
最后发现犯了个低级错误:备库的参数没有设置:log_archive_config
[oracle@standby dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sat Feb 12 16:02:39 2022
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter log_archive_config;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_config string
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(primary,standby)' scope=both;
System altered.
问题解决!!!
总结:松懈是一切低级的错误的根源。