oracle 如何安装tnsping?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39765601/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install tnsping?
提问by DenCowboy
How do I have to install tnsping?
I tried to install oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
and I'm able to use some client commands but nog tnsping.
我必须如何安装 tnsping?我尝试安装oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
并且我能够使用一些客户端命令但是 nog tnsping。
回答by Wernfried Domscheit
Oracle Instance Client does not include tsnping
application. You must run "Oracle Universal Installer" and enable the option for it.
Oracle Instance Client 不包括tsnping
应用程序。您必须运行“Oracle Universal Installer”并为其启用该选项。
I don't' remember exactly which option you have to set, either it was "Oracle Database Utilities" or "Oracle Net"
我不记得你必须设置哪个选项,是“Oracle Database Utilities”还是“Oracle Net”
回答by matt wilkie
Also see McTnsping"a Windows stand-alone program which requires no Oracle client". It's portable and doesn't need to be installed.
另请参阅McTnsping “无需 Oracle 客户端的 Windows 独立程序”。它是便携式的,不需要安装。
Usage 1: McTnsping.exe { <tns entry> | <host>:<port> } [<count>]
<tns entry> the net service name in the tnsnames.ora file.
<host>:<port> server name or IP and port (mandatory)
<count> number of times to check target, default is 1.
回答by BurnsBA
Here's what I did to copy tnsping
over to another machine. In my case, the oracle client is installed at C:\Oracle\product\12.1.0\client_1
.
这是我复制tnsping
到另一台机器时所做的。就我而言,oracle 客户端安装在C:\Oracle\product\12.1.0\client_1
.
This assumes there's already an Instant Client or similar installed on the destination machine; and that the oracle path and registry keys are set.
这假设目标机器上已经安装了 Instant Client 或类似软件;并且设置了 oracle 路径和注册表项。
(1) Copy tnsping.exe
from the source to the destination machine, into client_1\bin
.
(1)tnsping.exe
从源机器复制到目的机器,到client_1\bin
.
(2) Copy the following files from client_1\bin
to client_1\bin
:
(2) 将以下文件复制client_1\bin
到client_1\bin
:
oraasmclnt12.dll
oracell12.dll
oraclient12.dll
oraclsce12.dll
oracommon12.dll
oracore12.dll
orageneric12.dll
orahasgen12.dll
oraldapclnt12.dll
oran12.dll
orancds12.dll
orancrypt12.dll
oranhost12.dll
oranl12.dll
oranldap12.dll
oranls12.dll
oranro12.dll
orantcp12.dll
orantns12.dll
oraocr12.dll
oraocrb12.dll
oraocrutl12.dll
oraplp12.dll
orapls12.dll
ORASLAX12.DLL
orasnls12.dll
oraunls12.dll
orauts.dll
oravsn12.dll
oraxml12.dll
orazt12.dll
oraztkg12.dll
This should be about 84.6 MB.
这应该是大约 84.6 MB。
(3) In the client_1
on the destination machine, make a backup of the following files:
(3) 在client_1
目标机器上,备份以下文件:
oci.dll
orannzsbb12.dll
oraons.dll
orasql12.dll
orawsec12.dll
Now on the source machine, find those files in client_1\bin
and copy them to client_1\
(no bin) on the destination machine, overwriting the existing files. (Note: oci.dll is ~330 kb smaller, orasql12.dll is ~300 kb smaller. I'm not sure what's lost, hence the backup).
现在在源机器上,找到这些文件client_1\bin
并将它们复制到client_1\
目标机器上的(无 bin),覆盖现有文件。(注意:oci.dll 小了~330 kb,orasql12.dll 小了~300 kb。我不确定丢失了什么,因此备份)。
(4) On the destination machine, create the directory mesg
in client_1\Network
. Now copy the following file from the source to the destination:
(4) 在目标机器上,mesg
在client_1\Network
. 现在将以下文件从源复制到目标:
client_1\Network\mesg\tnsus.msb
(5) Open up regedit. Create the following key:
(5) 打开注册表。创建以下密钥:
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraClient12Home1_32bit
(From another machine, it looks like the x64 version is named HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraClient12Home1
, but the tnsping
program I'm using says it's 64 bit, so ...)
(在另一台机器上,看起来 x64 版本的名称是HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraClient12Home1
,但tnsping
我使用的程序说它是 64 位的,所以......)
Under the key, create a string named ORACLE_HOME
with the value C:\Oracle\product\12.1.0\client_1
.
在键下,创建一个以ORACLE_HOME
值命名的字符串C:\Oracle\product\12.1.0\client_1
。
You should be done now ($$$
= redacted):
你现在应该完成($$$
= 编辑):
C:\Users$$$>tnsping $$$
TNS Ping Utility for 64-bit Windows: Version 12.1.0.2.0 - Production on 03-APR-2
019 08:47:37
Copyright (c) 1997, 2014, Oracle. All rights reserved.
Used parameter files:
C:\Oracle\product.1.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = $$$)(PORT = $$$))) (CONNECT_DATA = (SERVICE_NAME = $$$
$$$) (SERVER = DEDICATED)))
OK (30 msec)
Troubleshooting
故障排除
Here's the process I followed, sharing for when these steps invariably fail to work on a later version.
这是我遵循的过程,当这些步骤总是无法在更高版本上运行时分享。
First off, I just copied the tnsping.exe
over.
首先,我只是复制了tnsping.exe
过去。
I didn't haphazardly pick the above dlls, as far as I can tell everyone is required. I ran the exe, and it would popup an error, I would copy the dll over and try again:
我没有随意选择上面的dll,据我所知,每个人都是必需的。我运行了 exe,它会弹出一个错误,我会复制 dll 并重试:
After a few dlls, you'll run into a different kind of error:
几个 dll 之后,您将遇到不同类型的错误:
If that happens, fire up process monitorand put a filter in for the ProcessName to contain tnsping
and try to run the program again. You should see something like the following. The main thing to notice is that it tries to load (in this example) orawsec12.dll
, which succeeds, but then it continues to try to load the dll looking in different paths, and then at the end it triggers werfault
and the program ends. I guess it realizes there's some kind of version mismatch and keeps looking for the right version.
如果发生这种情况,请启动进程监视器并为 ProcessName 放置一个过滤器以包含tnsping
并尝试再次运行该程序。您应该会看到如下所示的内容。需要注意的主要事情是它尝试加载(在本例中)orawsec12.dll
,它成功了,但随后它继续尝试加载 dll,寻找不同的路径,然后在最后它触发werfault
并且程序结束。我猜它意识到存在某种版本不匹配并不断寻找正确的版本。
The missing registry key will show up like the following in process monitor (operation RegOpenKey
, result NAME NOT FOUND
):
缺少的注册表项将在进程监视器(操作RegOpenKey
,结果NAME NOT FOUND
)中显示如下:
If the tnsus.msb
file is missing, you should see something like the following in process monitor (operation CreateFile
, result NAME NOT FOUND
):
如果tnsus.msb
文件丢失,您应该在进程监视器(操作CreateFile
,结果NAME NOT FOUND
)中看到类似以下内容:
回答by st0ne_c0ld
If whoever will reach the place like me... This is what worked for me:
如果谁能像我一样到达那个地方......这对我有用:
Instant client Version 12.2.0.1 + sqlplus + tnsping (copied from another server of the same version)
即时客户端版本 12.2.0.1 + sqlplus + tnsping(从另一台同版本服务器复制)
Directory structure and env (as in bash profile):
目录结构和环境(如在 bash 配置文件中):
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=${ORACLE_BASE}/instant_client122
export PATH=$ORACLE_HOME:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME #since all binaries are in $ORACLE_HOME - no bin or lib are present
export TNS_ADMIN=$ORACLE_HOME/network/admin
copy from another server to target:
从另一台服务器复制到目标:
'tnsping' to $ORACLE_HOME
'$ORACLE_HOME/network/mesg/tnsus.msb' to $ORACLE_HOME/network/mesg
Then put proper values to $TNS_ADMIN/tnsnames.ora and load env variables. After this it should be able to perform 'tnsping' and show proper message as a response.
然后将适当的值放入 $TNS_ADMIN/tnsnames.ora 并加载 env 变量。在此之后,它应该能够执行“tnsping”并显示正确的消息作为响应。