β

【故障处理】ORA-12545: Connect failed because target hos

Harries Blog™ 896 阅读

【故障处理】ORA-12545: Connect failed because tar get host or object does not exist

1 BLOG文档结构图

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

2 前言部分

2.1 导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

① 错误ORA-12545: Connect failed because target host or object does not exist的一种问题解决

T ip s:

① 本文在ITpub

http ://blog.itpub.net/26736162)、 博客 园( http://www.cnblogs.com/lhrbest)和 微信公众号 (xiaomaimiaolhr )有 同步 更新

文章 中用到的所有 代码 ,相关 软件 ,相关资料请前往小麦苗的 下载 (http://blog.itpub.net/26736162/viewspace-1624453/)

③ 若文章代码格式有错乱,推荐使用搜狗、360或QQ

浏览器,也可以下载pdf格式的文档来查看,pdf 文档下载地址:http://blog.itpub.net/26736162/viewspace-1624453/,另外itpub 格式显示有问题,可以去博客园地址阅读

④ 本篇BLOG中命令的输出部分需要特别关注的地方我都用灰色背景和粉红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33,thread 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 tab lespace idxtbs read write;

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

本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。

3 故障分析及解决过程


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 :/ cssp $ sql plus 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 这个环境变量,在 Unix

Linux 环境下,可以设置 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 :/ cssp $ tnsping 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 = ZF tacc DB-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 = ora tacc 1)))

OK (80 msec)

cssp @ ZFZHLHRDB1 :/ cssp $ sqlplus 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 App li cat ion Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

SQL> exit

cssp @ ZFZHLHRDB1 :/ cssp $ oerr 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 :/ cssp $ more .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=ora tacc 1

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/ java 5/bin:/cssp/ js cs

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_PLATF ORM _ID=212

export LD_LIBRARY_PATH NLS_LANG ORA_NLS33 PATH TMP TMPDIR OPATCH_PLATFORM_ID

export AIXTHREAD_SCOPE=S

um ask 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=/ cssp d05u/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=ora tacc 1

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:/ cssp d05u/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=/ cssp d05u/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 :/ cssp $ sqlplus 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 本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

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版: http://yunpan.cn/cdEQedhCs2kFz (提取码: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, 学习最实用的数据库技术。

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

PS:如果您想和业内技术大牛交流的话,请加qq群(521249302)或者关注微信公众 号(AskHarries),谢谢!

转载请注明原文出处: Harries Blog™ » 【故障处理】ORA-12545: Connect failed because target host

作者:Harries Blog™
追心中的海,逐世界的梦

发表评论