tnsping 解析
2016-02-01 19:40
295 查看
什么是tnsping?
可以参考官方文档的具体介绍
http://docs.oracle.com/cd/E11882_01/network.112/e41945/connect.htm#NETAG378
TNSPING is a utility in the ORACLE HOME/bin directory used to test if a SQL*Net connect string can connect to a remote listener (check if the socket is reachable).
Note: This utility only tests if the listener is available. It cannot tell if the databases behind the listener is up or not.
Using the TNSPING Utility to Test Connectivity from the Client
The TNSPING utility determines whether the listener for a service on an Oracle Net network can be reached successfully.
If you can connect successfully from a client to a server (or a server to another server) using the TNSPING utility, then it displays an estimate of the round trip time (in milliseconds) it takes to reach the Oracle Net service.
If it fails, then it displays a message describing the error that occurred. This enables you to see the network error that is occurring without the overhead of a database connection.
tnsping 实际上就是一个小工具,用来决定是否一个Oracle Net 网络服务(service)可以被接受。
从某种意义上来说,tnsping 针对的 sqlnet连接,就好比为我们常用的ping 命令来检查IP,主机名网络连接情况。
总结:tnsping 用于诊断各种客户端连接问题的一个非常好的工具。
但是我们要清楚的知道,这个工具能做什么(检查客户端TNS配置),什么不能做(检查数据库实例是否启动,监听端口是否在1521上)!
tnsping的解析成功仅仅意味着本地的tnsnames.ora ,IP地址,TNS_ADMIN 变量等配置成功。
但是,完全跟目标数据库实例连接没有任何关系!
最后,sqlnet 跟数据库也完全是独立的两个问题。不要因为sqlnet连接方面出错,就肯定是数据库的问题。要从客户端自身先找原因。
Use the following command to test connectivity:
tnsping net_service_name count
In the preceding command, the following arguments are used:
net_service_name must exist in tnsnames.ora file or the name service in use, such as NIS.
count determines how many times the program attempts to reach the server. This argument is optional.
If the net service name specified is a database name, then TNSPING attempts to contact the corresponding listener. It does not actually determine whether the database is running. Use SQL*Plus to attempt a connection to the database.
Following are some examples of TNSPING.
Note:
Different platforms may have different interfaces, but the program accepts the same arguments. Invoke TNSPING for the display of the proper interface requirements.
Example 15-1 is an example of checking a listener for a database using a net service name of sales using the TNSPING command.
Example 15-1 Checking a Listener with TNSPING
TNSPING sales
This produces the following message:
TNS Ping Utility for Linux: Version 11.1.0.0.2 on 15-FEB-2009 14:46:28
Copyright (c) 1997, 2009 Oracle Corporation. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL =
TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =
sales.us.example.com)))
OK (10 msec)
To determine whether the listener for the sales database is available, and to specify that TNSPING try to connect eight times and then give up, use the following syntax:
tnsping sales 8
This command produces the following message:
TNS Ping Utility for Linux: Version 11.1.0.0.2 on 15-FEB-2009 14:48:28
Copyright (c) 1997, 2009 Oracle Corporation. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL =
TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =
sales.us.example.com)))
OK (10 msec)
OK (0 msec)
OK (10 msec)
OK (0 msec)
OK (10 msec)
OK (10 msec)
OK (10 msec)
OK (0 msec)
Example 15-2 is an example of TNSPING attempting to check using an invalid net service name.
Example 15-2 Checking an Invalid Net Service Name with TNSPING
tnsping badname
This attempt produces the following message:
TNS Ping Utility for Linux: Version 11.1.0.0.2 on 15-FEB-2009 14:50:28
Copyright (c) 1997, 2009 Oracle Corporation. All rights reserved.
Used parameter files:
TNS-03505: Failed to resolve name
Example 15-3 is an example of output when using TNSPING to check a name that is valid, but that resolves to an address where no listener is located (for example, the listener may not be started).
Example 15-3 Checking Valid Net Service Name but No Listener with TNSPING
TNS Ping Utility for Linux: Version 11.1.0.0.2 on 15-FEB-2009 14:52:28
Copyright (c) 1997, 2009 Oracle Corporation. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL =
TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =
sales.us.example.com)))
TNS-12541: TNS:no listener
可以参考官方文档的具体介绍
http://docs.oracle.com/cd/E11882_01/network.112/e41945/connect.htm#NETAG378
TNSPING is a utility in the ORACLE HOME/bin directory used to test if a SQL*Net connect string can connect to a remote listener (check if the socket is reachable).
Note: This utility only tests if the listener is available. It cannot tell if the databases behind the listener is up or not.
Using the TNSPING Utility to Test Connectivity from the Client
The TNSPING utility determines whether the listener for a service on an Oracle Net network can be reached successfully.
If you can connect successfully from a client to a server (or a server to another server) using the TNSPING utility, then it displays an estimate of the round trip time (in milliseconds) it takes to reach the Oracle Net service.
If it fails, then it displays a message describing the error that occurred. This enables you to see the network error that is occurring without the overhead of a database connection.
tnsping 实际上就是一个小工具,用来决定是否一个Oracle Net 网络服务(service)可以被接受。
从某种意义上来说,tnsping 针对的 sqlnet连接,就好比为我们常用的ping 命令来检查IP,主机名网络连接情况。
总结:tnsping 用于诊断各种客户端连接问题的一个非常好的工具。
但是我们要清楚的知道,这个工具能做什么(检查客户端TNS配置),什么不能做(检查数据库实例是否启动,监听端口是否在1521上)!
tnsping的解析成功仅仅意味着本地的tnsnames.ora ,IP地址,TNS_ADMIN 变量等配置成功。
但是,完全跟目标数据库实例连接没有任何关系!
最后,sqlnet 跟数据库也完全是独立的两个问题。不要因为sqlnet连接方面出错,就肯定是数据库的问题。要从客户端自身先找原因。
Use the following command to test connectivity:
tnsping net_service_name count
In the preceding command, the following arguments are used:
net_service_name must exist in tnsnames.ora file or the name service in use, such as NIS.
count determines how many times the program attempts to reach the server. This argument is optional.
If the net service name specified is a database name, then TNSPING attempts to contact the corresponding listener. It does not actually determine whether the database is running. Use SQL*Plus to attempt a connection to the database.
Following are some examples of TNSPING.
Note:
Different platforms may have different interfaces, but the program accepts the same arguments. Invoke TNSPING for the display of the proper interface requirements.
Example 15-1 is an example of checking a listener for a database using a net service name of sales using the TNSPING command.
Example 15-1 Checking a Listener with TNSPING
TNSPING sales
This produces the following message:
TNS Ping Utility for Linux: Version 11.1.0.0.2 on 15-FEB-2009 14:46:28
Copyright (c) 1997, 2009 Oracle Corporation. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL =
TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =
sales.us.example.com)))
OK (10 msec)
To determine whether the listener for the sales database is available, and to specify that TNSPING try to connect eight times and then give up, use the following syntax:
tnsping sales 8
This command produces the following message:
TNS Ping Utility for Linux: Version 11.1.0.0.2 on 15-FEB-2009 14:48:28
Copyright (c) 1997, 2009 Oracle Corporation. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL =
TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =
sales.us.example.com)))
OK (10 msec)
OK (0 msec)
OK (10 msec)
OK (0 msec)
OK (10 msec)
OK (10 msec)
OK (10 msec)
OK (0 msec)
Example 15-2 is an example of TNSPING attempting to check using an invalid net service name.
Example 15-2 Checking an Invalid Net Service Name with TNSPING
tnsping badname
This attempt produces the following message:
TNS Ping Utility for Linux: Version 11.1.0.0.2 on 15-FEB-2009 14:50:28
Copyright (c) 1997, 2009 Oracle Corporation. All rights reserved.
Used parameter files:
TNS-03505: Failed to resolve name
Example 15-3 is an example of output when using TNSPING to check a name that is valid, but that resolves to an address where no listener is located (for example, the listener may not be started).
Example 15-3 Checking Valid Net Service Name but No Listener with TNSPING
TNS Ping Utility for Linux: Version 11.1.0.0.2 on 15-FEB-2009 14:52:28
Copyright (c) 1997, 2009 Oracle Corporation. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL =
TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =
sales.us.example.com)))
TNS-12541: TNS:no listener
相关文章推荐
- app兼容性测试
- PAT 1001. A+B Format (20)
- HDU 2717 Catch That Cow(bfs)
- postgresql关于auto vacuum
- 四个害人小程序解法
- Linux基本的快捷键
- javascript实现贪吃蛇
- 互联网产品上线前,做些什么——产品、开发、测试的视角
- xshell下bpython使用退格键的问题
- K度图的着色,uva1613
- MFC 实现浏览按钮选择文件
- 硬盘分区表知识——详解硬盘MBR
- HDU 1061 Rightmost Digit(找规律)
- vim命令常用
- 3236: [Ahoi2013]作业
- Linux线程 -- 互斥锁实践
- Qt线程QThread简析(8个线程等级,在UI线程里可调用thread->wait()等待线程结束,exit()可直接退出线程,setStackSize设置线程堆栈,首次见到Qt::HANDLE,QThreadData和QThreadPrivate)
- 缓存穿透与缓存雪崩
- android adb 命令实践
- HDU 1205 吃糖果(鸽笼原理)