Oracle DataGuard部署过程中可能遇到的问题及解决方

2023年 4月 29日 50.3k 0

在Oracle DataGuard部署过程中,如果操作不规范,可能遇到很多想不到的问题。有些问题是配置参数不到位,有些是操作不规范遗漏导致。 问题一 主库复制备库到备机时,rman远程登陆主库

在Oracle DataGuard部署过程中,如果操作不规范,可能遇到很多想不到的问题。有些问题是配置参数不到位,有些是操作不规范遗漏导致。

问题一

主库复制备库到备机时,rman远程登陆主库作为复制的目标库rman无法登陆备机备库,就是下面的命令执行报错:

rman target sys/oracle@dg_orclp auxiliary sys/oracle@dg_orcls

问题原始是从库的TNS配置不规范,缺少(UR=A),示例配置

DG_ORCLS =  (DESCRIPTION =    (ADDRESS_LIST =      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.10.101.36)(PORT = 1521))      (LOAD_BALANCE = off)    )    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME =DG_ORCLS)      (UR=A)    )  )

问题二

主库复制备库到备机时,rman执行duplicat的时,duplicat过程执行报错ORA-17629&ORA-17627:

RMAN> duplicate target database for standby from active database nofilenamecheck; Starting Duplicate Db at 2019-03-10 11:38:4 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=1811 instance=orcl1 device type=DISK contents of Memory Script: {    backup as copy reuse    targetfile  '/oracle/app/oracle/product/11.2.0/dbs/orapworcl1' auxiliary format   '/oracle/app/oracle/product/11.2.0/dbs/orapworcl1'  ; }

executing Memory Script Starting backup at 2019-03-10 11:38:43 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=4533 instance=orcl1 device type=DISK RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 03/10/2019 11:38:45 RMAN-05501: aborting duplication of target database RMAN-03015: error occurred in stored script Memory Script RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/10/2019 11:38:45 ORA-17629: Cannot connect to the remote database server ORA-17627: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor ORA-17629: Cannot connect to the remote database server RMAN>

这个问题比较有趣,配置好TNS后,通过ttnsping和sqlplus sys/oracle@to_orcl as sysdba都正常,就是rman的dumplicat进行从库的复制时报错。该问题的原因是备库的TNS配置中的服务名和主库备库中的log_archive_config='dg_config=()'参数中配置的服务名不一致导致,或者是主库以alter system方式修改了log_archive_config='dg_config',数据库没有重启,因为log_archive_config参数是静态参数,需要重启数据库服务才能生效。   

问题三

在备机通过rman复制主库的时,rman复制过程报错:RMAN-03009&ORA-17628:

Starting backup at 2019-03-10 12:56:20 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile file number=00003 name=+DGSYSTEM/orcl/datafile/undotbs1.261.876856357 output file name=+DGSYSTEM/orcl/datafile/undotbs1.340.1002545783 tag=TAG20190310T124734 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:55 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=+DGSYSTEM/orcl/datafile/undotbs2.263.876856383 RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/10/2019 12:59:21 ORA-17628: Oracle error 19505 returned by remote Oracle server continuing other job steps, job failed will not be re-run

该问题十分严重,通过job failed will not be re-run可以得知,此次的DG复制完全失败了。此问题的原因是存放数据文件相关的ASM磁盘组空间耗尽导致的,因此,在DG主备库开始配置之前,一定要评估好备库的存储并规划好,避免这种因存储空间问题导致DG复制失败的发生。

问题四

DG备库复制完主库后,备库alert日志告警登陆主库被拒绝,主库告警日志提示登陆备库失败。

--备库告警日志Thu Mar 14 06:51:40 2019 RFS[252]: Assigned to RFS process 3408762 RFS[252]: Opened log for thread 2 sequence 23863 dbid -2091533043 branch 876856333 Thu Mar 14 06:51:42 2019 2019-03-14 06:51:42 logon denied from 172.10.101.61 5964584 oracle with oracle@orcl01 (TNS V1-V3) ¨C oracle@orcl01 (TNS V1-V3) ===username= Thu Mar 14 06:51:42 2019 2019-03-14 06:51:42 logon denied from 172.10.101.61 13697046 oracle with oracle@orcl01 (TNS V1-V3) ¨C oracle@orcl01 (TNS V1-V3) ===username= Thu Mar 14 06:51:43 2019 2019-03-14 06:51:43 logon denied from 172.10.101.61 10486550 oracle with oracle@orcl01 (TNS V1-V3) ¨C oracle@orcl01 (TNS V1-V3) ===username= Thu Mar 14 06:51:43 2019 2019-03-14 06:51:43 logon denied from 172.10.101.61 7274758 oracle with oracle@orcl01 (TNS V1-V3) ¨C oracle@orcl01 (TNS V1-V3) ===username= Thu Mar 14 06:51:43 2019 2019-03-14 06:51:43 logon denied from 172.10.101.61 14156172 oracle with oracle@orcl01 (TNS V1-V3) ¨C oracle@orcl01 (TNS V1-V3) ===username=

--主库告警日志Thu Mar 14 09:13:45 2019 Error 1017 received logging on to the standby ------------------------------------------------------------ Check that the primary and standby are using a password file and remote_login_passwordfile is set to SHARED or EXCLUSIVE,  and that the SYS password is same in the password files. returning error ORA-16191 Error 16191 for archive log file 3 to 'TO_standby' Thu Mar 14 15:49:10 2019 Archived Log entry 203881 added for thread 2 sequence 59940 ID 0x53e28673 dest 1: Errors in file /oracle/app/oracle/diag/rdbms/orcl/orcl2/trace/orcl2_nsa2_2753334.trc: ORA-16191: Primary log shipping client not logged on standby Thu Mar 14 15:49:10 2019 ARCb: Archival destination is a Primary RAC instance: 'TO_standby'

该问题十分严重,会导致备库同步进程抓取归档日志失败。但是,导致该问题的原因是主备库的sys密码文件不一致导致,可能是搭建过程中有人修改了sys密码,处理该问题的方法比较简单,从集群主库任意节点同步sys密码文件即可。

问题五

另外,在DG搭建过程中,可能遇到grid或者oracle通过lsnrctl查看监听状态的时候看到很多服务名,其中有很多l类似:

SYS$SYS.KUPC$C_1_20170318000713.ORCL,sys登陆sqlplus,show parameter service可以发现:NAME                                TYPE        VALUE ------------------------------------ ----------- ------------------------------ service_names                        string      SYS$SYS.KUPC$C_1_20170318000713.orcl.US.ORACLE.COM,                                                    SYS$SYS.KUPC$C_1_20170405000711.orcl.US.ORACLE.COM,                                                  SYS$SYS.KUPC$S_1_20170314000710.ORCL,                                                   SYS$SYS.KUPC$S_1_20170318000713.ORCL,                                                                                                    SYS$SYS.KUPC$S_1_20170323000707.ORCL,                                                   SYS$SYS.KUPC$S_1_20170331000709.ORCL,                                                   SYS$SYS.KUPC$S_1_20170403000701.ORCL,                                                  SYS$SYS.KUPC$S_1_20170405000711.ORCL,                                                   SYS$SYS.KUPC$C_1_20170314000710.ORCL......

导致该问题的原因是expdp或者impdp被异常终端导致,可以重置service_names或者重启数据库服务加以解决。

更多Oracle相关信息见Oracle 专题页面 https://www.558idc.com/topicnews.aspx?tid=12

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论