一、ora-12545/tns-12545 connect failed because target host or object does not exist
当oracle无法解析主机名时,通常会发生此错误
oraclenet/sqlnet由于底层“无法解析”主机名到ip地址而失败。
大多数情况下,将主机名替换为适当的 ip 地址后,问题就会得到解决。有时,当存在设置/配置问题时,会遇到此错误。
1、原因
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.
2、模拟$oracle_home/bin目录下缺少oracle文件
[oracle@rac01:/u01/app/oracle/product/19.0.0/db_1/bin]$mv oracle oracle.bak
[oracle@rac01:/u01/app/oracle/product/19.0.0/db_1/bin]$sqlplus / as sysdba
sql*plus: release 19.0.0.0.0 - production on wed nov 15 11:54:39 2023
version 19.9.0.0.0
米乐app官网下载 copyright (c) 1982, 2020, oracle. all rights reserved.
error:
ora-12545: connect failed because target host or object does not exist
[oracle@rac01:/u01/app/oracle/product/19.0.0/db_1/bin]$mv oracle.bak oracle
[oracle@rac01:/u01/app/oracle/product/19.0.0/db_1/bin]$sqlplus / as sysdba
sql*plus: release 19.0.0.0.0 - production on wed nov 15 11:54:54 2023
version 19.9.0.0.0
米乐app官网下载 copyright (c) 1982, 2020, oracle. all rights reserved.
connected to:
oracle database 19c enterprise edition release 19.0.0.0.0 - production
version 19.9.0.0.0
sql>
[oracle@rac01:/u01/app/oracle/product/19.0.0/db_1/bin]$ls -lsa oracle
433204 -rwsr-s--x 1 oracle asmadmin 443595488 sep 25 17:24 oracle
二、ora-12518/tns-12518
1、原因
12518, 00000, "tns:listener could not hand off client connection"
// *cause: the process of handing off a client connection to another process
// failed.
// *action: turn on listener tracing and re-execute the operation. verify
// that the listener and database instance are properly configured for
// direct handoff. if problem persists, call oracle support.
// *comment: the problem can be worked around by configuring dispatcher(s)
// to specifically handle the desired presentation(s), and connecting
// directly to the dispatcher, bypassing the listener.
ora-12518/tns-12518 表示侦听器将客户端连接移交给服务器进程或调度程序进程时出现问题。tns-12518 记录在侦听器日志中。客户端可能会收到 ora-12518 或其他一些断开连接错误,例如 ora-12537。
在专用模式下,数据库客户端联系侦听器并提供数据库的服务名称。然后侦听器生成一个专用服务器进程,并将客户端连接移交给该专用服务器进程。tns-12518 表示将客户端连接移交给服务器进程时出现问题。
虽然此错误记录在侦听器日志中,但侦听器只是信使,ora-12518/tns-12518 主要与 rdbms 和操作系统资源有关。
2、处置方式
1、排查步骤
- 检查您使用的侦听器版本是否与数据库版本兼容。
- 检查监听日志
listener parameter file /u01/app/19.0.0/grid/network/admin/listener.ora
listener log file /u01/app/grid/diag/tnslsnr/rac01/listener/alert/log.xml
3.检查监听日志错误堆栈
寻找堆栈中最低的错误。这是我们必须集中精力并努力解决的错误
4. 检查服务句柄是否是阻塞状态
[oracle@19c01 admin]$ lsnrctl services
lsnrctl for linux: version 19.0.0.0.0 - production on 15-nov-2023 14:51:16
米乐app官网下载 copyright (c) 1991, 2019, oracle. all rights reserved.
connecting to (description=(address=(protocol=tcp)(host=19c01)(port=1526)))
services summary...
service "orcl" has 1 instance(s).
instance "orcl", status ready, has 1 handler(s) for this service...
handler(s):
"dedicated" established:0 refused:4 state:ready
local server
service "orclxdb" has 1 instance(s).
instance "orcl", status ready, has 1 handler(s) for this service...
handler(s):
"d000" established:0 refused:0 current:0 max:1022 state:ready
dispatcher
(address=(protocol=tcp)(host=19c01)(port=28033))
the command completed successfully
2、常见原因
- processes到达限制,当processes进程数过多,可以在alert日志中看到类似
ora-00020: maximum number of processes (52) exceeded
ora-20 errors will not be written to the alert log for
the next minute. please look at trace files to see all
the ora-20 errors.
sql> select * from v$resource_limit;
resource_name current_utilization max_utilization initial_allocation limit_value con_id
------------------------------ ------------------- --------------- ------------------------------ -------------------- ----------
processes 54 56 100 100 0
sessions 66 66 172 172 0
-
数据库处于启动或关闭过程中
-
操作系统进程参数限制
数据库由单个用户操作,通常是“ oracle ”用户。在操作系统级别,用户生成的进程数量是有限制的。而且整个操作系统上运行的进程总数也有限制。 -
检查内存占用
三、ora-12537/ora-12547或tns-12518
在监听器主目录(包括驻留在 grid 基础设施/asm主目录中的scan监听器)和数据库主目录由不同操作系统用户拥有的环境中,通过监听器连接、通过dbca创建数据库或安装数据库软件
和安装数据库时,可能会发生 ora-12537。
12537, 00000, "tns:connection closed"
// *cause: "end of file" condition has been reached; partner has disconnected.
// *action: none needed; this is an information message.
常见原因
- 在监听器与数据库所在的oracle_home不同的环境中,监听所有者(包括scan侦听器)可能无法访问数据库主目录中的oracle二进制文件。
- 数据库主目录中的oracle二进制文件权限错误
权限、属主错误都有可能,正确应该是如下
433204 -rwsr-s--x 1 oracle asmadmin 443595488 sep 25 17:24 oracle
- rdbms_home/lib的所有权/权限错误
- crs用户需要访问的rdbms目录结构或主目录的权限
四、ora-12170 / tns-12170“tns:发生连接超时
12170, 00000, "tns:connect timeout occurred"
// *cause: the server shut down because connection establishment or
// communication with a client failed to complete within the allotted time
// interval. this may be a result of network or system delays; or this may
// indicate that a malicious client is trying to cause a denial of service
// attack on the server.
// *action: if the error occurred because of a slow network or system,
// reconfigure one or all of the parameters sqlnet.inbound_connect_timeout,
// sqlnet.send_timeout, sqlnet.recv_timeout in sqlnet.ora to larger values.
// if a malicious client is suspected, use the address in sqlnet.log to
// identify the source and restrict access. note that logged addresses may
// not be reliable as they can be forged (e.g. in tcp/ip).
可能原因
1、错误通常是由于使用、应用程序或配置问题造成的,但在某些情况下,它们可能是由错误问题引起的,在11g版本中,这个错误也可能表示监听未启动
2、对于12c容器数据库中,需要将”_pdb_service_on_root_listener“设置为false。否则连接pdb可能报错ora-12170
3、数据库服务器文件系统占用100%
处置方式
检查每个文件系统占用
df -h
检查对应文件大小
du -sh *
检查被删除但是还在占用的文件和占用进程
lsof | grep '(deleted)$' | sort -rnk 7
如果删除文件,但空间没有被释放,通常是因为该文件仍然保持打开状态,或者存在其他硬链接。删除该文件不会释放空间,除非删除对该文件打开句柄的进程。
4. 网络延迟与qlnet.inbound_connect_timeout、sqlnet.send_timeout、sqlnet.recv_timeout配置,可以适当调大
-
网络连接中断
-
网络防火墙和sqlnet白名单
五、ora-12541: tns:no listener
原因
12541, 00000, "tns:no listener"
// *cause: the connection request could not be completed because the listener
// is not running.
// *action: ensure that the supplied destination address matches one of
// the addresses used by the listener - compare the tnsnames.ora entry with
// the appropriate listener.ora file (or tnsnav.ora if the connection is to
// go by way of an interchange). start the listener on the remote machine.
监听没启动
六、tns-12535或ora-12535或ora-12170
[oracle@19c01 ~]$ oerr tns 12535
12535, 00000, "tns:operation timed out"
// *cause: the requested operation could not be completed within the time out
// period.
// *action: look at the documentation on the secondary errors for possible
// remedy. see sqlnet.log to find secondary error if not provided explicitly.
// turn on tracing to gather more information.
tns-12535 或 ora-12535 错误通常是与防火墙或慢速网络相关的超时错误。当主机名未在允许的时间内(tcp 或 oracle)解析为 ip 地址时,也可能会发生这种情况。
本质上,ora-12535/tns-12535 是客户端和服务器之间的计时问题
也可能(最不常见)是由于以下文件的“超时”参数设置不正确:
inbound_connect_timeout_
sqlnet.inbound_connect_timeout
处置方式
ping ip(ip vip scanip)
telnet ip 端口
七、ora-12514:侦听器当前不知道连接中请求的服务
12535, 00000, "tns:operation timed out"
// *cause: the requested operation could not be completed within the time out
// period.
// *action: look at the documentation on the secondary errors for possible
// remedy. see sqlnet.log to find secondary error if not provided explicitly.
// turn on tracing to gather more information.
[oracle@19c01 ~]$ oerr ora 12154
12154, 00000, "tns:could not resolve the connect identifier specified"
// *cause: a connection to a database or other service was requested using
// a connect identifier, and the connect identifier specified could not
// be resolved into a connect descriptor using one of the naming methods
// configured. for example, if the type of connect identifier used was a
// net service name then the net service name could not be found in a
// naming method repository, or the repository could not be
// located or reached.
// *action:
// - if you are using local naming (tnsnames.ora file):
// - make sure that "tnsnames" is listed as one of the values of the
// names.directory_path parameter in the oracle net profile
// (sqlnet.ora)
// - verify that a tnsnames.ora file exists and is in the proper
// directory and is accessible.
// - check that the net service name used as the connect identifier
// exists in the tnsnames.ora file.
// - make sure there are no syntax errors anywhere in the tnsnames.ora
// file. look for unmatched parentheses or stray characters. errors
// in a tnsnames.ora file may make it unusable.
// - if you are using directory naming:
// - verify that "ldap" is listed as one of the values of the
// names.diretory_path parameter in the oracle net profile
// (sqlnet.ora).
// - verify that the ldap directory server is up and that it is
// accessible.
// - verify that the net service name or database name used as the
// connect identifier is configured in the directory.
// - verify that the default context being used is correct by
// specifying a fully qualified net service name or a full ldap dn
// as the connect identifier
// - if you are using easy connect naming:
// - verify that "ezconnect" is listed as one of the values of the
// names.diretory_path parameter in the oracle net profile
// (sqlnet.ora).
// - make sure the host, port and service name specified
// are correct.
// - try enclosing the connect identifier in quote marks.
//
// see the oracle net services administrators guide or the oracle
// operating system specific guide for more information on naming.
最常见的问题
- 连接串写错
- sqlnet.ora文件中names.diretory_path参数有误