physical standby in Oracle-dataguard cannot receive archives from primary database

Keywords: Oracle Database Linux SQL

Experimental environment: Oracle 11.2.04, Linux Centos 6.8

Architectural environment: Oracle-DG dual-node, main library instance_name: mysql1, standby instance_name: mysql2

The main library db_unique_name: mysql1; the backup db_unique_name: mysql2

Master and Standby Log Transfer Mode: maximize availability real-time synchronization

Fault Description: After setting up OracleDG backup library, it can not receive the archive log from the main library, and prompts that the heartbeat of the backup library can not be detected. The service_name and tnsnames.ora configuration between the main and backup are normal, and the tnsping communication between the main and backup is normal, but the archive log can not be received, and there is a strange phenomenon, as long as the backup library restarts the archive will be applied.

The final conclusion is that the db_unique_name of the standby is incorrect and the standby db_unique_name is modified to be normal.  

SQL>show parameter db_unique_name   
SQL>alter system set db_unique_name='mysql2' scope=spfile;

 

The failure phenomena are as follows:

The alert log on the main library shows the following errors, indicating that the heartbeat of the standby can not be detected, but the tnsping mysql2 service name can ping, indicating that the network configuration is correct, preliminary guess is that the database configuration is wrong. The main library logs are as follows:

Fatal NI connect error 12514, connecting to:
 (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dgstandby)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=MYSQL2)(INSTANCE_NAME=MYSQL2)(GLOBAL_NAME=MYSQL2)(CID=(PROGRAM=oracle)(HOST=dgprimary)(USER=oracle))))

  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.4.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
  Time: 02-SEP-2018 05:43:22
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12564
    
TNS-12564: TNS:connection refused
    ns secondary err code: 0
    nt main err code: 0
    nt secondary err code: 0
    nt OS err code: 0
Error 12514 received logging on to the standby
PING[ARC2]: Heartbeat failed to connect to standby 'mysql2'. Error is 12514.

Mutual ping between main and spare parts is normal:

[oracle@dgstandby ~]$ tnsping mysql1

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 02-SEP-2018 05:52:00

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = dgprimary)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = MYSQL1)))
OK (10 msec)

[oracle@dgprimary ~]$ tnsping mysql2

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 02-SEP-2018 05:53:25

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = dgstandby)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = MYSQL2) (INSTANCE_NAME = MYSQL2) (GLOBAL_NAME = MYSQL2)))
OK (10 msec)

From the results of tnsping, we can see that the network configuration is correct. The problem should be the configuration of the backup database. The experiment is as follows:

Remote connection experiment between master and standby
//The results are as follows:
//Lian Lian Zhu
[oracle@dgstandby ~]$ sqlplus sys/oracle@mysql1 as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Sep 2 05:55:24 2018

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 

//The main connection and sys password are correct, but the reality is not connected.
[oracle@dgprimary ~]$ sqlplus sys/oracle@mysql2 as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Sep 2 05:56:22 2018

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

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


Enter user-name: sys
Enter password: 
ERROR:
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

So only one possibility is that the standby's Instance_name or DB_NAME, db_unique_name, ORACLE_SID configuration is incorrect.
Check the main spare parameters

select instance_name,status,instance_role from v$instance; - - Viewing instance_name and ORACLE_SID because instance_name is a parameter of the database and ORACLE_SID system configures the parameters of environment variables if the two parameters are inconsistent will cause TNS errors
select name,open_mode,protection_mode,database_role from v$database; - - View database name
show parameter db_unique_name -- Look at the database to get the global unique name

After checking, it is found that the global name of the standby is incorrect, and should be mysql2, so quickly modify the db_unique_name parameter to restart the database to take effect.

alter system set db_unique_name='mysql2' scope=spfile;

Then execute on standby

startup nomount;
alter database mount standby databse;
Alter database recovery managed standby database using current log file disconnect from session; - - Open standby log application
 

Posted by jamiel on Mon, 07 Jan 2019 20:42:09 -0800