windows,oracle,dg报错:ORA-12528,ORA-12154,ORA-10456 ,PING[ARC1]: Heartbeat failed to connect to standb
作者:互联网
windows,oracle,dg报错:ORA-12528,ORA-12154,ORA-10456
最近有需求在windows的2台oracle服务器上搭建dg,在过程中遇到了一些错误,跟在linux上不一样
如下:
环境:11.2.0.4
主库
ip:192.168.19.197
sid:ORCL
db_unique_name:ORCL
安装路径:C:\app\Administrator\product\11.2.0\dbhome_1\
数据文件路径:C:\app\Administrator\oradata\ORCL
本地归档路径:C:\app\Administrator\fast_recovery_area\ORCL\ARCHIVELOG
备库
ip:192.168.19.194
sid:orclbk
db_unique_name:orclbk
安装路径:C:\app\Administrator\product\11.2.0\dbhome_1\
数据文件路径:C:\app\Administrator\oradata\orclbk
本地归档路径:C:\app\Administrator\fast_recovery_area\orclbk\ARCHIVELOG
dg的搭建过程就不详细描述,只针对错误进行处理,总体在windows下搭建dg跟再linux下类似,只有一处,一会回讲到
--使用rman auxiliary
主库:
SQL> archive log list SQL> shutdown immediate SQL> startup mount SQL> alter database archivelog; SQL> archive log list; SQL> select name , open_mode, log_mode,force_logging from gv$database; SQL> show parameter db_recover SQL> alter database force logging; SQL> alter system switch logfile;
--添加standby redo log
alter database add standby logfile group 4 ('C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO04.LOG') size 50m;
--tns监听配置文件
orclbk_192.168.19.194 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.19.194)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orclbk)
(UR=A) ) ) orcl_192.168.19.197 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.19.197)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
--修改参数文件
alter system set log_archive_config='dg_config=(ORCL,orclbk)' scope=spfile sid='*'; alter system set log_archive_dest_1='location=C:\app\Administrator\fast_recovery_area\ORCL\ARCHIVELOG valid_for=(all_logfiles,all_roles) db_unique_name=ORCL' scope=spfile sid='*'; alter system set log_archive_dest_2='service=orclbk_192.168.19.194 valid_for=(online_logfiles,primary_role) db_unique_name=orclbk' scope=spfile sid='*'; alter system set log_archive_dest_state_1=enable scope=spfile sid='*'; alter system set log_archive_dest_state_2=enable scope=spfile sid='*'; alter system set standby_file_management='auto' scope=spfile sid='*'; alter system set fal_server='orclbk_192.168.19.194' scope=spfile sid='*'; alter system set fal_client='orcl_192.168.19.197' scope=spfile sid='*'; alter system set db_file_name_convert='C:\app\Administrator\oradata\ORCL','C:\app\Administrator\oradata\orclbk' scope=spfile sid='*'; alter system set log_file_name_convert='C:\app\Administrator\oradata\ORCL','C:\app\Administrator\oradata\orclbk' scope=spfile sid='*'; alter system set log_archive_format='%t_%s_%r.arch' scope=spfile sid='*'; ### scope=spfile 后面主库要重启才生效
备库
注意:在windows上(linux略过),由于cadbk实例没有创建,所以需要ORADIM -NEW -SID cadbk
创建目录
比如
cd C:\app\Administrator\admin mkdir orclbk
修改备库参数文件
*.audit_file_dest='C:\app\Administrator\admin\orclbk\adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='C:\app\Administrator\oradata\orclbk\control01.ctl','C:\app\Administrator\fast_recovery_area\orclbk\control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_file_name_convert='C:\app\Administrator\oradata\ORCL','C:\app\Administrator\oradata\orclbk' *.db_name='ORCL' *.service_names='orclbk' *.db_unique_name='orclbk' *.db_recovery_file_dest='C:\app\Administrator\fast_recovery_area' *.db_recovery_file_dest_size=4385144832 *.diagnostic_dest='C:\app\Administrator' *.dispatchers='(PROTOCOL=TCP) (SERVICE=CADXDB)' *.fal_server='orcl_192.168.19.197' *.fal_client='orclbk_192.168.19.194' *.log_archive_config='dg_config=(ORCL,orclbk)' *.log_archive_dest_1='location=C:\app\Administrator\fast_recovery_area\orclbk\ARCHIVELOG valid_for=(all_logfiles,all_roles) db_unique_name=orclbk' *.log_archive_dest_2='service=cad_192.168.19.197 valid_for=(online_logfiles,primary_role) db_unique_name=ORCL' *.log_archive_dest_state_1='ENABLE' *.log_archive_dest_state_2='ENABLE' *.log_archive_format='%t_%s_%r.arch' *.log_file_name_convert='C:\app\Administrator\oradata\ORCL','C:\app\Administrator\oradata\orclbk'
--备库tns
orclbk_192.168.19.194 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.19.194)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orclbk) (UR=A) ) ) orcl_192.168.19.197 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.19.197)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
tnsping orcl_192.168.19.197
tnsping orclbk_192.168.19.194
1 报错ORA-12528: TNS:listener: all appropriate instances are blocking new connections
由于cadbk实例是手工ORADIM -NEW -SID orclbk命令添加的,在lsnrctl status的时候,状态为blocked,数据库实例orclbk状态为nomount,因为动态监听的问题,对辅助数据库没法注册,这里修改为静态注册
或者在tns文件中增加
(UR=A)(主库备库的tns对应都要增加)
在主备执行
sqlplus /nolog
conn sys/*@orcl_192.168.19.197 as sysdba
conn sys/*@orclbk_192.168.19.194 as sysdba
正常就可以
2
rror 12154 received logging on to the standby FAL[server, ARC3]: Error 12154 creating remote archivelog file 'orclbk' FAL[server, ARC3]: FAL archive failed, see trace file. ARCH: FAL archive failed. Archiver continuing Tue Jun 25 15:47:46 2019 Error 12154 received logging on to the standby PING[ARC1]: Heartbeat failed to connect to standby 'orclbk'. Error is 12154. Tue Jun 25 15:47:50 2019 Error 12154 received logging on to the standby Tue Jun 25 15:47:50 2019 Error 12154 received logging on to the standby Error 12154 for archive log file 3 to 'orclbk' FAL[server, ARC0]: Error 12154 creating remote archivelog file 'orclbk' FAL[server, ARC0]: FAL archive failed, see trace file. ARCH: FAL archive failed. Archiver continuing Errors in file C:\APP\ADMINISTRATOR\diag\rdbms\orcl\orcl\trace\orcl_nsa2_15224.trc: ORA-12154: TNS:could not resolve the connect identifier specified Tue Jun 25 15:49:44 2019 Tue Jun 25 15:49:48 2019 Archived Log entry 17 added for thread 1 sequence 1840 ID 0x5e779e7a dest 1: Tue Jun 25 15:52:09 2019 Starting background process SMCO Tue Jun 25 15:52:09 2019 SMCO started with pid=49, OS id=11840 Tue Jun 25 15:53:42 2019 Error 12154 received logging on to the standby PING[ARC1]: Heartbeat failed to connect to standby 'orclbk'. Error is 12154. Tue Jun 25 15:55:23 2019 Tue Jun 25 16:02:00 2019 Warning: VKTM detected a time drift. Time drifts can result in an unexpected behavior such as time-outs. Please check trace file for more details. Tue Jun 25 16:02:07 2019 Error 12154 received logging on to the standby PING[ARC1]: Heartbeat failed to connect to standby 'orclbk'. Error is 12154.
查询主备库
select message from v$dataguard_status;
select dest_name,error,status from v$archive_dest;
LOG_ARCHIVE_DEST_2 ORA-12154: TNS: 无法解析指定的连接标识符 ERROR
主库报错,这里参数LOG_ARCHIVE_DEST_2错误,之前的值是cadbk
alter system set log_archive_dest_2='service=orclbk valid_for=(online_logfiles,primary_role) db_unique_name=orclbk' scope=both sid='*';
但是在tns文件中定义的orclbk_192.168.19.194,所以要修改--上面贴出的文件中已修改,所以如果按照上面参数文件是不会遇到此错误的。
alter system set log_archive_dest_2='service=orclbk_192.168.19.194 valid_for=(online_logfiles,primary_role) db_unique_name=orclbk' scope=both sid='*';
alter system set fal_server='orclbk_192.168.19.194' scope=both sid='*'; alter system set fal_client='orcl_192.168.19.197' scope=both sid='*';
SQL> select * from v$archive_gap; THREAD# LOW_SEQUENCE# HIGH_SEQUENCE# ---------- ------------- -------------- 1 1836 1840 SQL> alter database register physical logfile 'C:\app\Administrator\fast_recovery_area\orclbk\ARCHIVELOG\1_1837_976879612.ARCH';
3
alter database open
ORA-10456 signalled during: alter database open...
SQL> select max(sequence#) from v$archived_log; MAX(SEQUENCE#) -------------- 1842 SQL> select DBID,NAME,OPEN_MODE,DATABASE_ROLE from v$database; DBID NAME OPEN_MODE DATABASE_ROLE ---------- --------- -------------------- ---------------- 1584932730 ORCL MOUNTED PHYSICAL STANDBY SQL> alter database open; alter database open * 第 1 行出现错误: ORA-10456: cannot open standby database; media recovery session may be in progress SQL> select DBID,NAME,OPEN_MODE,DATABASE_ROLE from v$database; DBID NAME OPEN_MODE DATABASE_ROLE ---------- --------- -------------------- ---------------- 1584932730 ORCL MOUNTED PHYSICAL STANDBY SQL> alter database recover managed standby database cancel; 数据库已更改。 SQL> alter database open; 数据库已更改。 SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT; 数据库已更改。 SQL> select DBID,NAME,OPEN_MODE,DATABASE_ROLE from v$database; DBID NAME OPEN_MODE DATABASE_ROLE ---------- --------- -------------------- ---------------- 1584932730 ORCL READ ONLY WITH APPLY PHYSICAL STANDBY
标签:Administrator,app,orclbk,192.168,archive,报错,12154,alter,ORA 来源: https://www.cnblogs.com/yhq1314/p/11084105.html