用sqlpuls / as sysdba 一直报错:
ORA-12560: TNS:protocol adapter error(TNS:协议适配器错误)
网上很多方案不能解决。
在stackoverflow上看到
http://stackoverflow.com/questions/28678432/tnsprotocol-adapter-error/28679157#28679157 写道
But if I set LOCAL then I can connect as if I had specified the alias:
c:\Program Files\instantclient_12_1>set LOCAL=abcd
c:\Program Files\instantclient_12_1>sqlplus -l x/y
SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 23 17:14:23 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
You don't need to have ORACLE_SID set as that is only used for bequeath connections where the client and server are on the same box.
c:\Program Files\instantclient_12_1>set LOCAL=abcd
c:\Program Files\instantclient_12_1>sqlplus -l x/y
SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 23 17:14:23 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
You don't need to have ORACLE_SID set as that is only used for bequeath connections where the client and server are on the same box.
只需要设置set LOCAL=sid即可,并且ORACLE_SID 只有在oracle客户端和服务器在一台机器上时才设置。
经测试可用!
oracle对Local变量的说明:http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_two.htm#i1052303