Keyword:
ORA-12560 ORA-12557 BEQ 数据库连接 登录
##问题:
Windows环境下进行数据库登陆时,发生ORA-12560/ORA-12557错误。
> oerr ora 12560
12560, 00000, "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.
> oerr ora 12557
12557, 00000, "TNS:protocol adapter not loadable"
// *Cause: On some platforms (such as OS/2) protocol adapters are loaded at
// run-time. If the shared library (or DLL) for the protocol adapter is
// missing or one of its supporting libraries is missing then this error is
// returned.
// *Action: For further details, turn on tracing and reexecute the operation.
// The trace file will include the name of the shared library (or DLL) that
// could not be loaded.
通常来讲,ORA-12560和ORA-12557错误常常是由于环境变量等设置不正确引起,
本文介绍连接错误基本的解决思路和方法。
##解决错误的基本思路:
1.确认用户连接方法和数据库认证方式,是否使用了Listener监听登陆,在BEQ登陆的方式下是否有同样的问题
2.查看网络相关的配置文件sqlnet.ora、listener.ora、tnsnames.ora的配置
3.查看告警日志alert和trace中,发生问题时是否有其他的错误或异常发生
4.查看用户环境变量的设置
##解决过程:
1.用户的连接方法:
用户在不使用监听(Listener)本地BEQ连接的时候也发生问题。
用户的连接方法如下,即使用了OS认证。
sqlplus / as sysdba
2.查看用户网络相关的配置文件sqlnet.ora:
sqlnet.ora中AUTHENTICATION_SERVICES设置成了NTS,即可以使用OS认证
SQLNET.AUTHENTICATION_SERVICES= (NTS)
3.查看警日志alert和trace,有相关的TNS错误
TNS-12537: TNS:connection closed
ns secondary err code: 12560
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
opiodr aborting process unknown ospid (872) as a result of ORA-609
4.根据上面的内容,可能和用户环境的设定会有很大的关系。
用户设定ORACLE_HOME和ORACLE_SID后连接发生ORA-12557错误。
5.取得环境变量:
C:\Users>set
ORACLE_HOME=D:\oracle\product\11.2.0\dbhome_1
...
Path=D:\MicroFocus\NetExpress5.1\Base\BIN;D:\oracle\product\11.2.0\client_1\bin;
ORACLE_HOME和PATH的设定有所不同,启动的bin文件是某Client端的内容。
可能是由于同一台机器装了不同的客户端和服务器端,而卸载时没有卸载干净导致的。
5.
要求用户设定ORACLE_HOME和ORACLE_SID以及PATH后连接成功。
> echo %ORACLE_HOME%
> echo %ORACLE_SID%
> echo %PATH%
> set ORACLE_HOME=
> set ORACLE_SID=
> set PATH=%PATH%;%ORACLE_HOME%/bin
> echo %ORACLE_HOME%
> echo %ORACLE_SID%
> echo %PATH%
> sqlplus / as sysdba
> select * from V$INSTANCE;
领取专属 10元无门槛券
私享最新 技术干货