暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

oracle 19c 配置单机dataguard时候的一个小坑

原创 伟鹏 2024-06-21
206

oracle 19c 备库执行duplicate报错如下:

[oracle@ops-oracle-bidb-sty-ts-bj ~]$ rman target sys/"5px7zX9N*"@orcl auxiliary sys/"5px7zX9N*"@10.0.53.34:1522/orcl_sty Recovery Manager: Release 19.0.0.0.0 - Production on Fri Jun 21 09:28:25 2024 Version 19.23.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. PL/SQL package SYS.DBMS_BACKUP_RESTORE version 19.14.00.00 in TARGET database is not current PL/SQL package SYS.DBMS_RCVMAN version 19.14.00.00 in TARGET database is not current connected to target database: ORCL (DBID=1622886715) connected to auxiliary database: ORCL (not mounted) RMAN> run { allocate channel c1 type disk rate 200M; allocate channel c2 type disk rate 200M; allocate channel c3 type disk rate 200M; allocate auxiliary channel st1 type disk rate 200M; allocate auxiliary channel st2 type disk rate 200M; allocate auxiliary channel st3 type disk rate 200M;2> 3> 4> 5> 6> 7> duplicate target database for standby from active database nofilenamecheck dorecover; release channel c1; release channel c2; release channel c3; release channel st1; release channel st2; release channel st3; } 8> 9> 10> 11> 12> 13> 14> 15> using target database control file instead of recovery catalog allocated channel: c1 channel c1: SID=4484 device type=DISK allocated channel: c2 channel c2: SID=4605 device type=DISK allocated channel: c3 channel c3: SID=4802 device type=DISK allocated channel: st1 channel st1: SID=619 device type=DISK allocated channel: st2 channel st2: SID=497 device type=DISK allocated channel: st3 channel st3: SID=620 device type=DISK Starting Duplicate Db at 21-JUN-24 current log archived contents of Memory Script: { backup as copy reuse passwordfile auxiliary format '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapworcl' ; } executing Memory Script Starting backup at 21-JUN-24 released channel: c1 released channel: c2 released channel: c3 released channel: st1 released channel: st2 released channel: st3 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 06/21/2024 09:31:47 RMAN-05501: aborting duplication of target database RMAN-03015: error occurred in stored script Memory Script RMAN-03009: failure of backup command on c1 channel at 06/21/2024 09:31:47 ORA-17627: ORA-12170: TNS:Connect timeout occurred ORA-17629: Cannot connect to the remote database server RMAN> exit

问题排查:

RMAN-03002: failure of Duplicate Db command at 06/21/2024 09:31:47

RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
ORA-17627: ORA-12170: TNS:Connect timeout occurred
ORA-17629: Cannot connect to the remote database server

从报错信息来看,是无法连接远程数据库,这就需要看看防火墙/端口连通性方面

1、查看备库防火墙/selinux

主库

[root@oradbhost ~]# getenforce Disabled [root@oradbhost ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1)

备库

[root@ops-oracle-bidb-sty-ts-bj ~]# getenforce Disabled [root@ops-oracle-bidb-sty-ts-bj ~]# systemctl status firewalld Unit firewalld.service could not be found.

2、主备库连通性排查

主库:

[oracle@oradbhost ~]$ tnsping orcl_sty TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 21-JUN-2024 13:45:16 Copyright (c) 1997, 2021, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ops-oracle-bidb-sty-ts-bj)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL_STY))) OK (10 msec)

备库:

[oracle@ops-oracle-bidb-sty-ts-bj trace]$ tnsping orcl TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 21-JUN-2024 13:45:25 Copyright (c) 1997, 2024, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oradbhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl))) OK (10 msec)

3、测试主库账号连接

[oracle@ops-oracle-bidb-sty-ts-bj ~]$ sqlplus sys/"5px7zX9N*"@orcl as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jun 21 13:49:11 2024
Version 19.23.0.0.0

Copyright (c) 1982, 2023, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.14.0.0.0

发现能正常连接,两边都是通的

4、监听排查

[oracle@ops-oracle-bidb-sty-ts-bj ~]$ lsnrctl status LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 20-JUN-2024 18:02:17 Copyright (c) 1991, 2024, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ops-oracle-bidb-sty-ts-bj)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 20-JUN-2024 17:08:09 Uptime 0 days 0 hr. 54 min. 7 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/ops-oracle-bidb-sty-ts-bj/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ops-oracle-bidb-sty-ts-bj)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "ORCL_STY" has 1 instance(s). Instance "orcl", status BLOCKED, has 2 handler(s) for this service... The command completed successfully [oracle@ops-oracle-bidb-sty-ts-bj ~]$ lsnrctl status LISTENER2 LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 20-JUN-2024 17:40:46 Copyright (c) 1991, 2024, Oracle. All rights reserved. Starting /u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 19.0.0.0.0 - Production System parameter file is /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/ops-oracle-bidb-sty-ts-bj/listener2/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ops-oracle-bidb-sty-ts-bj)(PORT=1522))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ops-oracle-bidb-sty-ts-bj)(PORT=1522))) STATUS of the LISTENER ------------------------ Alias listener2 Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 20-JUN-2024 17:40:48 Uptime 0 days 0 hr. 0 min. 2 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/ops-oracle-bidb-sty-ts-bj/listener2/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ops-oracle-bidb-sty-ts-bj)(PORT=1522))) Services Summary... Service "orcl_sty" has 1 instance(s). Instance "orcl", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully

直到排查到监听,忽然意识到问题,自己在配置安全组的时候只配置了1521端口 ,没有配置1522的静态监听端口
image.png
在安全组中添加1522策略后,脚本执行正常。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论