ORA-12560: TNS: 协议适配器错误的解决方法

Case:

Microsoft Windows [版本 5.2.3790]
(C) 版权所有 1985-2003 Microsoft Corp.

C:Documents and Settingsuser1>lsnrctl

LSNRCTL for 32-bit Windows: Version 9.2.0.7.0 - Production on 27-8月 -2008 09:33
:43

Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.

欢迎来到LSNRCTL,请键入"help"以获得信息。

LSNRCTL> status
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS:无监听器
TNS-12560: TNS: 协议适配器错误
TNS-00511: 无监听器
32-bit Windows Error: 2: No such file or directory
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.55)(PORT=1521)))

TNS-12538: TNS:没有此协议适配器
TNS-12560: TNS: 协议适配器错误
TNS-00508: 无此类协议适配器

LSNRCTL> start
启动tnslsnr:请稍候...

TNSLSNR for 32-bit Windows: Version 9.2.0.7.0 - Production
系统参数文件为D:oracleora92networkadminlistener.ora
写入D:oracleora92networkloglistener.log的日志信息
监听:(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=.pipeEXTPROC1ipc)))
监听该对象时出错: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.55)(PORT=
1521)))
TNS-12538: TNS:没有此协议适配器
TNS-12560: TNS: 协议适配器错误
TNS-00508: 无此类协议适配器


监听程序未能启动。请参阅上面的错误消息...


---------------------------
服务
---------------------------
在 本地计算机 无法启动 OracleOraHome92TNSListener 服务。

错误 1067: 进程意外终止。

---------------------------
确定
---------------------------

ORA-12560: TNS: 协议适配器错误的解决方法

造成ORA-12560: TNS: 协议适配器错误的问题的原因有个:

1.监听服务没有起起来。windows平台个一如下操作:开始---程序---管理工具---服务,打开服务面板,启动oraclehome92TNSlistener服务。

2.database instance没有起起来。windows平台如下操作:开始---程序---管理工具---服务,打开服务面板,启动oracleserviceXXXX, XXXX就是你的database SID.

3.注册表问题。regedit,然后进入HKEY_LOCAL_MACHINESOFTWAREORACLEHOME0将该环境变量ORACLE_SID设置为XXXX, XXXX就是你的database SID.或者右几我的电脑,属性--高级--环境变量---系统变量--新建,变量名=oracle_sid,变量值=XXXX, XXXX就是你的database SID.或者进入sqlplus前,在command line下输set oracle_sid=XXXX, XXXX就是你的database SID.

经过以上步骤,就可以解决问题。

=======================================
TNS: 协议适配器错误的问题的原因有三个:
1.监听服务没有起起来。windows平台个一如下操作:开始---程序---管理工具---服务,打开服务面板
,启动oraclehome92TNSlistener服务。
2.database instance没有起起来。windows平台如下操作:开始---程序---管理工具
---服务,打开服务面板,启动oracleserviceXXXX,XXXX就是你的database SID.
3.注册表问题。regedit,然后进入HKEY_LOCAL_MACHINESOFTWAREORACLEHOME0将该
环境变量ORACLE_SID设置为XXXX,XXXX就是你的database SID.或者右几我的电脑,属性--高级--环境变量---系统变量--新建,变量名=oracle_sid,变量值=XXXX,XXXX就是你的database SID.或者进入sqlplus前,在command line下输set oracle_sid=XXXX,XXXX就是你的database SID.
经过以上步骤,就可以解决问题

1、ORA-12541:TNS:没有监听器
  原因:没有启动监听器或者监听器损坏。如果是前者,使用命令net start
OracleOraHome81TNSListener(名字可能有出入)即可;如果是后者,则使用“Net8Configuration

Assistant”工具向导之“监听程序配置”增加一个监听器即可(基本不用写任何信息,一路OK。在添加之前可能需要把所有的监听器先删除!)
2、ORA-12500:TNS:监听程序无法启动专用服务器进程或ORA-12560:TNS:协议适
配器错误
  原因:ORACLE的数据库服务没有启动。使用命令net start ORACLESERVICEORADB
(ORADB为数据库名字)即可。如果仍没有解决,请继续向下看。

3、如果数据库服务启动失败,则很有可能是其注册表项值损坏,最好的做法是以下两步:
  1)ORADIM -DELETE -SID oradb 删除数据库服务项
  2)ORADIM -NEW -SID oradb 新增数据库服务项
  注:这个过程中如果出错,就重启计算机!
4、ORA-12154:TNS:能解析服务名
  原因:ORACLE的网络服务名没有正确配置。请使用“Net8 Configuration
Assistant”工具向导之“本地网络服务名配置”配置TNS即可。如果仍没有解决,请继续向下看。
5、ORA-1034 :TNS:ORACLE不可用
  原因:ORACLE的数据库服务正确启动,但是数据库没有打开!
  使用命令:
  1)svrmgrl 启动服务管理器
  2)connect internal 以internal身份登陆
  3)startup 打开数据库
6、ORA-12560:TNS:协议适配器错误(顽固性的)
  原因:未知。
  解决:必杀技--打开“Windows任务管理器”,杀死ORACLE.exe及ORADIM.exe进
程,书写自己的

ora_startup.bat,执行之!
PS:
1、我的ora_startup.bat:
net start OracleOraHome81TNSListener
net start ORACLESERVICEORADB
svrmgrl 一般情况下不用,不过有时少不了它的,具体步骤见第5步。
2、我的ora_shutdown.bat:
net stop OracleOraHome81TNSListener
net stop ORACLESERVICEORADB

  ORACLE_HOME=/u01/app/oracle/product/8.1.6
  export ORACLE_HOME/ 包括Oracle软件的目录 /
  LD_LIBRARY_PATH=/u01/app/oracle/product/8.1.6/lib;
  export LD_LIBRARY_PATH
  ORACLE_BASE=/u01/app/oracle
  export ORACLE_BASE/ 包括Oracle软件的目录和管理软件的目录 /
  ORACLE_SID=ORCL
  export ORACLE_SID/ 缺省数据库的标识 /
  ORACLE_TERM=vt100
   export ORACLE_TERM
  ORA_NLS33=/u01/app/oracle/product/8.1.6/
  ocommon/nls/admin/data
  export ORA_NLS33 / 语言支持 /
  PATH=$PATH: /u01/app/oracle/product/8.1.6/bin
  export PATH


=============================================
ORA-12560 STARTING LISTENER ON NT - TROUBLESHOOTING
---------------------------------------------------

ORA-12560: TNS Protocol adapter error
Cause: A generic protocol adapter error occurred.
Action: Check addresses used for proper protocol specification. Before reporting this error, look at the error stack and check for lower level transport errors.For further details, turn on tracing and reexecute the operation. Turn off tracing when the operation is complete.

This is a high level error just reporting an error occurred in the actual transport layer. Look at the next error down the stack and process that.


1.- Starting Listener with TCP/IP Protocol

Problem:
You start the TNS Listener from command line and the TCP/IP address fails with a TNS-12560.

Solution:
Check if Microsoft Winsock Proxy(WSP) Client is enabled on the Windows NT Server, if that is the case then go to windows Control
Panel, click WSP icon and select the disable Proxy Client option.

Explanation:
The Winsock application may fail to bind to a specific port on a Proxy Server computer when the Winsock is running Proxy Client.

2.- TNS-12560 TNS-512 Starting the listener.

Problem:
You try to start up the listener and receive the following error stack:
TNS-12542: TNS:address already in use
TNS-12560: TNS Protocol adapter error
TNS-00512: Address already in use
32-bit Windows Error: 48: Unknown error

Error: TNS 512
Text: Address already in use
--------------------------------------------
Cause: Specified listener address is already being used.
Action: Start your listener with an unused address.

Generally this problem may ocurr for a incorrect setting in the listener.ora. Some causes of this problems may be:

a.- Some defined address in the listeners.ora is been used. Make sure other listeners are not running. Either listener.log and screen
output appear the address with problem.

b.- Just for 8i: in windows NT the algorithm to acquire
the address has change, please check the Note 69026.1: Oracle 8i and socket LISTEN operations.

Explanation:
The listener will try to acquire the address in exclusive mode, if this
is been used then the process to get it will fail.

3.- Starting the listener the errors ORA-12203,ORA-12560, NL-462 or NL-427 may be raised.

Problem:
You try to start up the listener and receive the following errors
ORA-12203,ORA-12560, NL-462 or NL-427.

Solution:
Recreate the listener.ora file.

Explanation:
Some corruption in the listener.ora may get unable to the tnslsnr to work adequatly.


4.- Failed to start service, TNS-12560, TNS-00530 when create new listener services

Problem:
To recreate Oracle TNS listener service on Windows NT, you delete the service entry in registry. When using lsnrctl to start the listener, you get the following errors:

LSNRCTL> start
Starting tnslsnr: please wait...

Failed to start service, error 3.

TNS-00530: Protocol adapter error

The Listener service is not recreated and the Listener would not start.
You are using a valid listener.ora file and protocol adapters.


Solution:
After you delete the Listener service from registry, you have to reboot
NT for it to take effect. Then you can use lsnrctl to start the Listener, which would re-create the listener service.


Explanation:
The Listener service is marked 'disabled', but it still exists after
you delete the service from registry.

[@more@]
oracle的监听起不来: TNS:address already in use
==============解决方法==========================

LSNRCTL> status

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=testhost)(PORT=1521)))

TNS-12535: TNS:operation timed out

TNS-12560: TNS:protocol adapter error

TNS-00505: Operation timed out

IBM/AIX RISC System/6000 Error: 78: Connection timed out

LSNRCTL> start
Starting /opt/oracle/product/10.1.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for IBM/AIX RISC System/6000: Version 10.1.0.5.0 - Production
System parameter file is /opt/oracle/product/10.1.0/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/product/10.1.0/db_1/network/log/listener.log
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=testhost)(PORT=1521)))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
IBM/AIX RISC System/6000 Error: 67: Address already in use

Listener failed to start. See the error message(s) above...

===========================

ORA-12542: TNS:address already in use
Cause: Specified listener address is already being used.
Action: Start your listener with a unique address.

===========================

很明显呀,你的监听已经起来了么。
看看lsnrctl status是不是已经启动了?
或者你要看看你的要监听的端口是不是已经被占用了?
netstat -an | grep 端口号

AIX 怎么查看端口占用情况?

netstat -an

ps -ef | grep xxxx

kill -9 PID

AIX中查看端口对应的进程或服务的方法

Solution Here is a method that can be used to determine what process is using a particular port:
1.
Run netstat to get the address of the port you need to check:
eg.
[root:/:] netstat -Aan | grep 8880
701995f0 tcp4 0 0 *.8880 *.* LISTEN
2.
Now use the address seen in the first column as the first parameter to the rmsock command. The second parameter is "tcpcb"
eg.
[root:/:] rmsock 701995f0 tcpcb
The socket 0x70199400 is being held by process 26792 (java).
Please note.... rmsock is used to remove sockets that do not have file descriptors. However, rmsock doesn't remove a socket that still has a valid file descriptor but, instead, returns the identity of the process owner.
3.
Finally, use "ps -ef" to identify the actual process.

===========================

怎样释放被程序占用的端口

可用refresh -s inetd就可以了

Windwos

问题已解决,改完注册表后需重启机器。

使用 regedit 命令,修改注册表:
1. HKEY_LOCAL_MACHINESYSTEMCurrentControlSet ServicesTCPIPParameters 注册表子键并创建名为 TcpTimedWaitDelay 的新 REG_DWORD 值。 将此值设置为十进制 30,其为十六进制 0x0000001e。该值将等待时间设置为 30 秒。
缺省值:0xF0,它将等待时间设置为 240 秒(4 分钟)。建议值:最小值为 0x1E,它将等待时间设置为 30 秒。
2. HKEY_LOCAL_MACHINESYSTEMCurrentControlSet ServicesTCPIPParameters 注册表子键并创建名为 MaxUserPort 的新 REG_DWORD 值。 缺省值:无 建议值:至少十进制 32768。 注:当在 Windows NT 或 Windows 2000 操作系统上调整 WebSphere Application Server 时。

完成后重启机器。

===========================

ORACLE实例在启动时,或使用命令ALTER SYSTEM REGISTER ,或每隔一分钟,PMON进程会向监听进行动态注册

1、监听在启动时,会从$ORACLE_HOME/network/admin/listener.ora读取监听配置,如果该文件不存在,则监听会在主机名对应的IP和1521端口上进行监听。可以看到监听刚刚启动的时候,并没有注册的服务
LSNRCTL> start
Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Log messages written to f:oracleproduct10.2.0networkloglistener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:29:40
Uptime 0 days 0 hr. 0 min. 2 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File f:oracleproduct10.2.0networkloglistener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))
The listener supports no services
The command completed successfully

2、过了大概1分钟,PMON进程会将服务注册进来
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:29:40
Uptime 0 days 0 hr. 1 min. 57 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File f:oracleproduct10.2.0networkloglistener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1521)))
Services Summary...
Service "test" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "testXDB" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test_XPT" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully

3、但是PMON进程只向默认的1521端口的监听注册,当监听不在1521端口时,需要使用下面的方法:

a、直接在参数local_listener中输入监听地址,PMON进程会根据此信息,并进行注册
sys@TEST>alter system set local_listener='(address=(protocol=tcp)(port=1522)(host=linan))';

System altered.

b、或者只在参数local_listener中输入监听的名称
sys@TEST>alter system set local_listener='test';

System altered.

在$ORACLE_HOME/network/admin/tnsnames.ora中包含监听地址,PMON进程会从此处得监听信息,并进行注册
TEST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1522))

4、但有3点需要注意的地方:
a、PMON进程1分钟运行一次,当监听刚刚启动的时候,可能服务还没有注册进去,这时候是不能使用此服务的
b、在修改local_listener参数时,PMON进程也会重新注册一次
c、如果数据库shutdown后,PMON进程也停止了,服务会从监听中删除,这时候只能使用OS认证的方式连入数据库

LSNRCTL> statusConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linan)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener1
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:14:04
Uptime 0 days 0 hr. 10 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File f:oracleproduct10.2.0networkadminlistener.ora
Listener Log File f:oracleproduct10.2.0networkloglistener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1522)))
Services Summary...
Service "test" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
Service "testXDB" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
Service "test_XPT" has 1 instance(s).
Instance "test", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully

sys@TEST>shut immediateDatabase closed.
Database dismounted.
ORACLE instance shut down
.

LSNRCTL> statusConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linan)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener1
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 14-APR-2008 21:14:04
Uptime 0 days 0 hr. 10 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File f:oracleproduct10.2.0networkadminlistener.ora
Listener Log File f:oracleproduct10.2.0networkloglistener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linan)(PORT=1522)))
The listener supports no services
The command completed successfully

===========================

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25067344/viewspace-1052104/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25067344/viewspace-1052104/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值