主庫到standby報錯解決:Error 12154 received logging on to the standby ORA-12154
筆者建庫無數,但今天對Oracle 11.2.0.3庫使用duplicate新建standby後,主庫redo無法透過RFS傳輸至standby
主庫alert.log報錯:
Thu Jun 14 14:05:20 2018
Error 12154 received logging on to the standby
主庫報錯生成trc檔案:
*** 2018-06-14 14:25:20.581
Redo shipping client performing standby login
OCIServerAttach failed -1
.. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified
'
OCIServerAttach failed -1
.. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified
'
OCIServerAttach failed -1
.. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified
'
*** 2018-06-14 14:25:20.585 4320 krsh.c
Error 12154 received logging on to the standby
*** 2018-06-14 14:25:20.585 915 krsu.c
Error 12154 connecting to destination LOG_ARCHIVE_DEST_2 standby host 'agile9dg'
Error 12154 attaching to destination LOG_ARCHIVE_DEST_2 standby host 'agile9dg'
*** 2018-06-14 14:25:20.585 4320 krsh.c
PING[ARC2]: Heartbeat failed to connect to standby 'agile9dg'. Error is 12154.
*** 2018-06-14 14:25:20.585 2932 krsi.c
krsi_dst_fail: dest:2 err:12154 force:0 blast:1
主庫 v$archive_dest
error依舊是 ORA-12154
分析:
ORA-12154此類問題通常為主庫透過log_archive_dest_2使用tnsnames.ora中standby TNS檔案無法訪問到備庫導致,
但檢查:tnsnames.ora,密碼檔案 ,各引數,防火牆,selinux等設定均正常
問題確實奇怪,查詢官方真有相關問題說明: Adding an new Standby fails with error Ora-12154: TNS:could not resolve the connect identifier specified (ID 1240558.1)
具體內容:
APPLIES TO: 涉及版本還真廣
Oracle Database - Enterprise Edition - Version 9.0.1.0 to 12.2.0.1 [Release 9.0.1 to 12.2]
Information in this document applies to any platform.
SYMPTOMS 症狀和我遇到完全一樣
** checked for relevance '23-Nov-2015' **
When adding or changing the parameter log_archive_dest_ to point to a newly created standby database, the archiver process for the new destination reports the following error in the alert log
Errors in file /u01/diag/rdbms/prod/PROD/trace/PROD_arc0_2596.trc:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Corresponding archiver trace file may show:
OCIServerAttach failed -1
.. Detailed OCI error val is 12514 and errmsg is 'ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
'
OCIServerAttach failed -1
.. Detailed OCI error val is 12514 and errmsg is 'ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
'
OCIServerAttach failed -1
.. Detailed OCI error val is 12514 and errmsg is 'ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
'
*** 2010-11-05 08:50:39.219 1117 krsh.c
Error 12514 received logging on to the standby
Error 12514 connecting to destination LOG_ARCHIVE_DEST_2 standby host 'remote_dest_new'
Query on V$ARCHIVE_DEST shows the following:
DEST_ID STATUS ERROR
---------- --------- -----------------------------------------------------------------
1 INACTIVE
2 ERROR ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
3 INACTIVE
...
CHANGES
Added a new standby database and updated the tnsnames.ora with a new TNS alias for the new standby.
Example:
log_archive_dest_2='service=ORCL2 ...' and ORCL2 has been defined in
TNSNAMES.ORA
- edit TNSNAMES.ORA and copy or rename the ORCL2 entry to ORCL22
- run alter system set log_archive_dest_2='service=ORCL22 ...'
- TNS-12154 will be written to the alert file of the primary
CAUSE 引起原因
After adding a new standby database, a corresponding new TNS alias entry was added to the tnsnames.ora on the primary node, but neither the instance nor the archiver processes were restarted.
在新建的standby後,在主庫中建立了相關TNS別名到tnsnames.ora,但instance和arch程式都沒有重啟The ARC processes read the tnsnames.ora only once during process initialization, any updates to the tnsnames.ora after startup will not be known to the ARC process and hence the error
ORA-12154: TNS:could not resolve the connect identifier specified
is reported when the ARC processes try to resolve the (new) value for the 'service' attribute.
arc程式只有在初始化時才讀取一次tnsnames.ora檔案,arc程式啟動後再對tnsnames.ora檔案的更新引發了ORA-12154
SOLUTION
1. Shutdown and restart the primary database instance. 方法1. 關閉重啟instance
This will cause a (short) outage of the primary database and may not be feasible for this reason.
2. Use a connect descriptor for the 'service' parameter. 方法2. log_archive_dest_2 使用具體指明的serivice引數,而不使用tns別名方式
Instead of using a TNS alias for the service parameter (which requires a lookup of the tnsnames.ora file) one can use the connect descriptor itself.
Assume the following (new) entry in the tnsnames.ora on the primary node:
REMOTE_DEST_NEW = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = standbynode)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = STDBY) ) )
The corresponding 'alter system' command would then be:
Please note that there's a length limit for the log_archive_dest_ parameter, so this will only work if the length of the connect string plus the length of other attributes specified does not exceed this limit.
3. Kill the ARC processes of the primary instance. 方法3. kill 主庫arc程式(重啟arc程式)
With RDBMS releases <= 9.2 it was possible to stop and restart the archiver processes by issuing 'archive log stop' followed by 'archive log start'.
However these commands are no longer valid with 10g and above, so to cause a respawn of the archiver processes they must be killed, they will be restarted immediately by the instance.
This solution requires due care to avoid accidentally killing other vital background processes.
The following script (ksh,bash) may assist in identifying the correct ARC processes that need to be killed:
ps -ef|egrep "ora_arc.*_${ORACLE_SID}"|grep -v grep |while read user pid junk do echo "kill -9 $pid" done
解決:
研究了一下采用方法2“LOG_ARCHIVE_DEST_2使用具體指明的service引數 ” 不重啟instance和arc程式的方法最保險,方法2修改:
原引數:log_archive_dest_2='SERVICE=agile9dg LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=agile9dg'
新引數:alter system set log_archive_dest_2 ='service="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.202.17.47)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=agile9)))" LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=agile9dg'
修改後傳輸正常
alert.log:
Thu Jun 14 14:25:44 2018
ALTER SYSTEM SET log_archive_dest_2='service="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.202.17.47)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=agile9)))" LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=agile9dg' SCOPE=BOTH;
Thu Jun 14 14:26:07 2018
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
LGWR: Standby redo logfile selected for thread 1 sequence 1490 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 1490 (LGWR switch)
Current log# 2 seq# 1490 mem# 0: /data/oradata/agile9/log2agile9.ora
trc檔案:
*** 2018-06-14 14:26:10.214
Redo shipping client performing standby login
*** 2018-06-14 14:26:10.248 4645 krsu.c
Logged on to standby successfully
Client logon and security negotiation successful!
Redo shipping client performing standby login
至此,問題解決。
如有轉載請註明原文出處,謝謝
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29734436/viewspace-2156817/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle dataguard報錯:Error 1017 received logging on to the standbyOracleError
- PING[ARC5]: Heartbeat failed to connect to standby 'dghq'. Error is 12154.AIError
- ORACLE dbca執行到40%報錯之ORA-12154Oracle
- standby新增檔案錯誤的解決方法
- [20180428]DNS與ORA-12154錯誤.txtDNS
- standby上增加tempfile報錯ORA-00604,ORA-16000解決方法
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- Oracle 12c DG備庫啟動報錯standby database requires recoveryOracleDatabaseUI
- Oracle 12.2 physical standby備庫收集AWR報告Oracle
- 搭建windows到linux的oracle 12c physical standby備庫WindowsLinuxOracle
- [20230425]注意snapshot standby與activate standby的區別.txt
- Oracle的快照standbyOracle
- 2 新增standby masterAST
- Oracle19c orapwd修改密碼之後連線資料庫報ORA-12154Oracle密碼資料庫
- 邏輯STANDBY負載高,應用緩慢的解決負載
- 邏輯STANDBY上的ORA-00600: internal error code, arguments: [krvtadc], [], [], [], [], []Error
- 含有replication環境的sqlserver切換到standbySQLServer
- Oracle 19c standby 建立資料檔案報錯ORA-01111Oracle
- 4 Creating a Logical Standby Database 建立邏輯備庫Database
- Performing a Failover to a Physical Standby DatabaseORMAIDatabase
- 邏輯STANDBY建立中碰到ORA-16146: standby destination control file enqueue unavailableENQAI
- Oracle 12C RAC的單機Standby returning error ORA-16191OracleError
- 在Oracle DG Standby庫上啟用flashback database功能OracleDatabase
- Oracle案例09——ORA-12154: TNS:could not resolve the connect identifier specifiedOracleIDE
- 【DG】Data Guard搭建(physical standby)
- Setup Standby Database on One PC(轉)Database
- Oracle DG Standby Database型別OracleDatabase型別
- Oracle DG建立Physical Standby DatabaseOracleDatabase
- Oracle DG建立Logical Standby DatabaseOracleDatabase
- 【等待事件】standby query scn advance事件
- [20181113]Logical Standby建立2.txt
- 通過RMAN設定standby接收日誌後主庫歸檔日誌才可刪除
- 判斷standby日誌是否同步primary
- DATAGUARD手記(PRIMARY+2STANDBY)(一)
- DG -- READ ONLY模式開啟物理Standby模式
- DATAGUARD手記(PRIMARY+2STANDBY)(二)
- [20230110]sql profile run standby database.txtSQLDatabase
- Tomcat啟動報錯:Error starting static Resources解決方法TomcatError