【故障處理】ORA-12545: Connect failed because target host

lhrbest發表於2016-08-12

【故障處理】ORA-12545: Connect failed because target host or object does not exist

 BLOG文件結構圖

 

wpsD0F7.tmp 

 

 前言部分

2.1  導讀和注意事項

各位技術愛好者,看完本文後,你可以掌握如下的技能,也可以學到一些其它你所不知道的知識,~O(∩_∩)O~

① 錯誤ORA-12545: Connect failed because target host or object does not exist的一種問題解決

  Tips:

① 本文在ITpubhttp://blog.itpub.net/26736162)、部落格園(http://www.cnblogs.com/lhrbest)和微信公眾號(xiaomaimiaolhr)有同步更新

② 文章中用到的所有程式碼,相關軟體,相關資料請前往小麥苗的雲盤下載(http://blog.itpub.net/26736162/viewspace-1624453/

③ 若文章程式碼格式有錯亂,推薦使用搜狗360QQ瀏覽器,也可以下載pdf格式的文件來檢視,pdf文件下載地址:http://blog.itpub.net/26736162/viewspace-1624453/,另外itpub格式顯示有問題,可以去部落格園地址閱讀

④ 本篇BLOG中命令的輸出部分需要特別關注的地方我都用灰色背景和粉紅色字型來表示,比如下邊的例子中,thread 1的最大歸檔日誌號為33thread 2的最大歸檔日誌號為43是需要特別關注的地方;而命令一般使用黃色背景和紅色字型注;對程式碼或程式碼輸出部分的注釋一般採用藍色字型表示

  List of Archived Logs in backup set 11

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

  ---- ------- ---------- ------------------- ---------- ---------

  1    32      1621589    2015-05-29 11:09:52 1625242    2015-05-29 11:15:48

  1    33      1625242    2015-05-29 11:15:48 1625293    2015-05-29 11:15:58

  2    42      1613951    2015-05-29 10:41:18 1625245    2015-05-29 11:15:49

  2    43      1625245    2015-05-29 11:15:49 1625253    2015-05-29 11:15:53

 

[ZHLHRDB1:root]:/>lsvg -o

T_XDESK_APP1_vg

rootvg

[ZHLHRDB1:root]:/>

00:27:22 SQL> alter tablespace idxtbs read write;

 

====》2097152*512/1024/1024/1024=1G 

 

本文如有錯誤或不完善的地方請大家多多指正,ITPUB留言或QQ皆可,您的批評指正是我寫作的最大動力。

 

 

 故障分析及解決過程

 

3.1  故障環境介紹

 

專案

source db

db 型別

RAC

db version

11.2.0.3

db 儲存

ASM

OS版本及kernel版本

AIX 64位 6.1.0.0

 

3.2  故障發生現象及報錯資訊

同事過來找我說資料庫不能連線,如下情況:

cssp@ZFZHLHRDB1:/csspsqlplus tacc/tacc

 

SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 12 16:35:42 2016

 

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

 

ERROR:

ORA-12545: Connect failed because target host or object does not exist

 

 

Enter user-name:

ERROR:

ORA-12545: Connect failed because target host or object does not exist

 

注意:以上的連線方式採用了TWO_TASK這個環境變數,在UnixLinux環境下,可以設定TWO_TASK環境變數,當使用者連線資料庫且沒有指定服務名時,會自動利用TWO_TASK的設定作為環境變數連線資料庫。有關這個環境變數的更多內容可以參考:http://blog.itpub.net/26736162/viewspace-2112274/ 和 http://blog.itpub.net/26736162/viewspace-2112277/

 

 

3.3  故障分析及解決過程

我採用了tnsping、用tnsnames連線和檢查3大網路配置檔案,都沒有問題,如下:

cssp@ZFZHLHRDB1:/cssptnsping oratacc1

 

TNS Ping Utility for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 12-AUG-2016 16:36:14

 

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

 

Used parameter files:

/oracle/app/oracle/product/11.2.0/db/network/admin/sqlnet.ora

 

 

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ZFtaccDB-scan)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 22.188.173.15)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 22.188.173.16)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oratacc1)))

OK (80 msec)

cssp@ZFZHLHRDB1:/csspsqlplus tacc/tacc@oratacc1

 

SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 12 16:36:25 2016

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SQL> exit

 

cssp@ZFZHLHRDB1:/csspoerr ora 12545

12545, 00000, "Connect failed because target host or object does not exist"

// *Cause: The address specified is not valid, or the program being

// connected to does not exist.

// *Action: Ensure the ADDRESS parameters have been entered correctly; the

// most likely incorrect parameter is the node name.  Ensure that the

// executable for the server exists (perhaps "oracle" is missing.)

// If the protocol is TCP/IP, edit the TNSNAMES.ORA file to change the

// host name to a numeric IP address and try again.

 

檢視環境變數的設定:

cssp@ZFZHLHRDB1:/csspmore .profile

#For CICS

export CICS=/usr/lpp/cics

#export LANG=zh_CN.UTF-8

export LANG=en_US

 

#For ORACLE

ORACLE_BASE=/oracle/app/oracle

ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db

TWO_TASK=oratacc1

ORACLE_SID=oratacc1

ORACLE_TERM=vt100

ORACLE_OWNER=oracle

export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_TERM ORACLE_OWNER

 

 

LD_LIBRARY_PATH=/oracle/app/oracle/product/11.2.0/db/lib:/oracle/app/oracle/product/11.2.0/db/lib32

#LD_LIBRARY_PATH=/oracle/app/oracle/product/11.2.0/db/lib32

#export LIBPATH=$LIBPATH:/oracle/app/oracle/product/11.2.0/db/lib

 

NLS_LANG=American_America.ZHS16GBK

ORA_NLS33=/oracle/app/oracle/product/11.2.0/db/nls/data

export PATH=/usr/java5/bin:/cssp/jscs

export PATH=$PATH:/oracle/app/oracle/product/11.2.0/db/OPatch:/oracle/app/oracle/product/11.2.0/db/bin:/bin:/usr/ccs/bin:/usr/bin/X11:/sharebkup/data/peij

 

OPATCH_PLATFORM_ID=212

export LD_LIBRARY_PATH NLS_LANG ORA_NLS33 PATH TMP TMPDIR OPATCH_PLATFORM_ID

export AIXTHREAD_SCOPE=S

umask 022

export DBCA_RAW_CONFIG=/oracle/dbname_raw.conf

export PS1='LOGNAME@′‘hostname‘:′LOGNAME@′‘hostname‘:′PWD''$ '

export ORA_NL10=$ORACLE_HOME/nls/data

set -o vi

export EDITOR=vi

 

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export NLS_DATE_FORMAT=YYYY-MM-DD

 

export PATH=$PATH:/usr/vac/bin:/var/ifor:/usr/opt/ifor/ls/conf:/usr/lib/cobol/bin:/usr/lpp/cics/bin:/usr/lpp/cics/etc:/usr/lpp/dce/bin:/usr/lpp/mqm/bin:/usr/lpp/mqm/sa

mp/bin:/usr/mqm/samp/bin:HOME/bin:HOME/bin:ORACLE_HOME/bin:/csspd05u/test/bin:.:/usr/mqm/samp/bin

export LIBPATH=/usr/mqm/lib:ORACLEHOME/lib32:ORACLEHOME/lib32:COBDIR/coblib:/usr/lib:/lib:/usr/lpp/cics/lib:/usr/lpp/encina/lib:/usr/lpp/dce/lib:.

export NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lpp/cics/msg/%L/%N:/usr/lpp/nls/msg/en_US/%N:/usr/lpp/encina/msg/%L/%N:/usr/lpp/dce/lib/nls/msg/%L/%N

 

#For cssp

export JAVA_HOME=/usr/java5_64

export cssp_HOME=$HOME

export CLASSPATH=/csspd05u/CF

 

# PS1='[`hostname`:LOGNAME:LOGNAME:PWD]'

alias rm='rm -i'

alias lf='ls -aF'

alias l='ls -al'

set -o vi

可以看到上邊的環境變數很亂,尤其PATH的配置有問題,所以我把這個部分的內容整理了一下,最後為:

umask 022

#For CICS

export CICS=/usr/lpp/cics

#export LANG=zh_CN.UTF-8

export LANG=en_US

 

#For ORACLE

export ORACLE_BASE=/oracle/app/oracle

export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db

export LD_LIBRARY_PATH=/oracle/app/oracle/product/11.2.0/db/lib:/oracle/app/oracle/product/11.2.0/db/lib32

export TWO_TASK=oratacc1

export ORACLE_SID=oratacc1

export ORACLE_TERM=vt100

export ORACLE_OWNER=oracle

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

 

 

export ORA_NLS33=/oracle/app/oracle/product/11.2.0/db/nls/data

export OPATCH_PLATFORM_ID=212

export AIXTHREAD_SCOPE=S

 

export DBCA_RAW_CONFIG=/oracle/dbname_raw.conf

export PS1='LOGNAME@′‘hostname‘:′LOGNAME@′‘hostname‘:′PWD''$ '

export ORA_NL10=$ORACLE_HOME/nls/data

export EDITOR=vi

 

 

export PATH=$PATH:/usr/java5/bin:/cssp/jscs

export PATH=$PATH:/oracle/app/oracle/product/11.2.0/db/OPatch:/oracle/app/oracle/product/11.2.0/db/bin:/bin:/usr/ccs/bin:/usr/bin/X11:/sharebkup/data/peij

export PATH=PATH:/usr/vac/bin:/var/ifor:/usr/opt/ifor/ls/conf:/usr/lib/cobol/bin:/usr/lpp/cics/bin:/usr/lpp/cics/etc:/usr/lpp/dce/bin:/usr/lpp/mqm/bin:/usr/lpp/mqm/samp/bin:/usr/mqm/samp/bin:PATH:/usr/vac/bin:/var/ifor:/usr/opt/ifor/ls/conf:/usr/lib/cobol/bin:/usr/lpp/cics/bin:/usr/lpp/cics/etc:/usr/lpp/dce/bin:/usr/lpp/mqm/bin:/usr/lpp/mqm/samp/bin:/usr/mqm/samp/bin:HOME/bin:$ORACLE_HOME/bin:/csspd05u/test/bin:.:/usr/mqm/samp/bin

export LIBPATH=/usr/mqm/lib:ORACLEHOME/lib32:ORACLEHOME/lib32:COBDIR/coblib:/usr/lib:/lib:/usr/lpp/cics/lib:/usr/lpp/encina/lib:/usr/lpp/dce/lib:.

export NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lpp/cics/msg/%L/%N:/usr/lpp/nls/msg/en_US/%N:/usr/lpp/encina/msg/%L/%N:/usr/lpp/dce/lib/nls/msg/%L/%N

 

#For cssp

export JAVA_HOME=/usr/java5_64

export cssp_HOME=$HOME

export CLASSPATH=/csspd05u/CF

 

# PS1='[`hostname`:LOGNAME:LOGNAME:PWD]'

alias rm='rm -i'

alias lf='ls -aF'

alias l='ls -al'

set -o vi

修改.profile檔案後,重新登入試試:

cssp@ZFZHLHRDB1:/cssp. .profile

cssp@ZFZHLHRDB1:/csspsqlplus tacc/tacc

 

SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 12 16:43:26 2016

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

可以正常登陸資料庫了,可見環境變數的配置對sqlplus的登入有至關重要的作用。

  About Me

..........................................................................................................................................................................................................                        

本文作者:小麥苗,只專注於資料庫的技術,更注重技術的運用

v 本文在ITpub(http://blog.itpub.net/26736162)、部落格園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新,推薦pdf檔案閱讀或部落格園地址閱讀

v QQ群:230161599 微信群:私聊

v 本文itpub地址:http://blog.itpub.net/26736162/viewspace-2123414/ 部落格園地址:http://www.cnblogs.com/lhrbest/articles/5766183.html

v 本文pdf版: (提取碼:ed9b)

v 小麥苗分享的其它資料:http://blog.itpub.net/26736162/viewspace-1624453/

v 聯絡我請加QQ好友(642808185),註明新增緣由

v 於 2016-08-12 09:00~2016-08-12 19:00 在中行完成

v 【版權所有,文章允許轉載,但須以連結方式註明源地址,否則追究法律責任】

..........................................................................................................................................................................................................

長按識別二維碼或微信客戶端掃描下邊的二維碼來關注小麥苗的微信公眾號:xiaomaimiaolhr,學習最實用的資料庫技術。

wpsD107.tmp

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-2123414/,如需轉載,請註明出處,否則將追究法律責任。

相關文章