SQL ORA-12560: TNS: 协议适配器错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6894558/
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
ORA-12560: TNS:protocol adaptor error
提问by mr_eclair
I Google[d] for this error ORA-12560: TNS:protocol adaptor errorbut not able to find the actual reason and how to solve this error ?
我谷歌[d] 这个错误ORA-12560: TNS:protocol adapter error但无法找到实际原因以及如何解决这个错误?
Can anyone tell me a perfect solution to solve login problem.
谁能告诉我解决登录问题的完美解决方案。
回答by Bharathi
- Go to the windows machine that hosts the Oracle database server
Go to Start -> Run -> Services.msc in Windows. Locate OracleService < SID >(here
OracleServiceORCL
) and click onStart
to start the oracle database service (if not already running)Once it is up and running, from the command prompt run the following:
tnsping < tnsalias >
(tnsaliasentry you can find it in
tnsnames.ora
file)
- 转到托管 Oracle 数据库服务器的 Windows 计算机
在 Windows 中转到开始 -> 运行 -> Services.msc。找到OracleService < SID >(此处
OracleServiceORCL
)并单击Start
启动 oracle 数据库服务(如果尚未运行)启动并运行后,从命令提示符运行以下命令:
tnsping < tnsalias >
(您可以在文件中找到tnsalias条目
tnsnames.ora
)
回答by Yasir Ahmed
Seems like database is not up. It might be due to restarting machine and the instance is not set to autostart and it so not started munually after starting from services Screen.
好像数据库没有起来。这可能是由于重新启动机器,并且实例未设置为自动启动,因此在从服务屏幕启动后没有手动启动。
Just goto Command prompt
只需转到命令提示符
Set Oracle SID C:>set oracle_sid=ORCL
Now run Net startcommand. C:>net start oracleserviceORCL
设置 Oracle SID C:>set oracle_sid=ORCL
现在运行网络启动命令。 C:>net 启动 oracleserviceORCL
回答by Leniel Maccaferri
In my case I didn't have an OracleService
(OracleServiceORCL) in Windows Services.msc
as described in Bharathi's answer.
就我而言,我OracleService
在 Windows 中没有(OracleServiceORCL),Services.msc
如Bharathi 的回答中所述。
I executed this command:
我执行了这个命令:
C:\> ORADIM -NEW -SID ORCL
and then the OracleService
called OracleServiceORCL just showed up and got started in Services.msc. Really nice.
然后OracleService
调用的 OracleServiceORCL 刚刚出现并在 Services.msc 中启动。非常好。
Source: https://forums.oracle.com/forums/message.jspa?messageID=4044655#4044655
来源:https: //forums.oracle.com/forums/message.jspa?messageID=4044655#4044655
回答by user2382157
Add to the enviroment vars the following varibale and value to identify the place of the tnsnames.ora file:
将以下变量和值添加到环境变量中以标识 tnsnames.ora 文件的位置:
TNS_ADMIN
TNS_管理员
C:\oracle\product\10.2.0\client_1\network\admin
C:\oracle\product\10.2.0\client_1\network\admin
回答by demian
from command console, if you get this error you can avoid it by typing sqlplus /nolog
从命令控制台,如果您收到此错误,您可以通过键入 sqlplus /nolog 来避免它
then you can connect conn user/pass @host:port/service
然后你可以连接 conn user/pass @host:port/service
回答by Mrinmoy
After searching alot got a simple way to solve it. Just follow the steps.
经过大量搜索,找到了一个简单的方法来解决它。只需按照步骤操作即可。
- Check status of your listener.
- open command prompt and type
lsnrctl status
- You will get no listener.
- open command prompt and type
Now open
listener.ora
file which is present in following directory:C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
- Open that file and change the host parameter with you computer name
You can get your computer name by right click on
My Computer
and check you computer name, and replace host parameter with your computer name as follows:LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) (ADDRESS = (PROTOCOL = TCP)(HOST = Electron-PC)(PORT = 1521) ) ) )
So here you can observe
HOST = Electron-PC
, which is my computer name.Save the listener.ora file and again return to cammand propt
3.Type the following in command prompt
lsnrctl start
- 检查您的听众的状态。
- 打开命令提示符并键入
lsnrctl status
- 你不会得到听众。
- 打开命令提示符并键入
现在打开
listener.ora
存在于以下目录中的文件:C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
- 打开该文件并使用您的计算机名称更改主机参数
您可以通过右键单击
My Computer
并检查您的计算机名称来获取您的计算机名称,并将主机参数替换为您的计算机名称,如下所示:LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) (ADDRESS = (PROTOCOL = TCP)(HOST = Electron-PC)(PORT = 1521) ) ) )
所以在这里你可以观察到
HOST = Electron-PC
,这是我的电脑名称。保存 listener.ora 文件并再次返回到 cammand propt
3.在命令提示符下输入以下内容
lsnrctl start
This will start the OracleTNSListner
.
这将启动OracleTNSListner
.
you can check it in the service by opening services tab of Task Manager. if not started automatically you can start it.
您可以通过打开任务管理器的服务选项卡在服务中检查它。如果没有自动启动,您可以启动它。
Just this much and you are ready to work again on oracle.
仅此而已,您就可以再次在 oracle 上工作了。
Best of Luck.
祝你好运。
回答by APC
Quite often this means that the listener hasn't started. Check the Services panel.
这通常意味着侦听器尚未启动。检查服务面板。
On Windows (as you are) another common cause is that the ORACLE_SID is not defined in the registry. Either edit the registry or set the ORACLE_SID in a CMD box. (Because you want to run sqlplusw.exe I suggest you edit the registry.)
在 Windows 上(就像您一样)另一个常见原因是 ORACLE_SID 未在注册表中定义。编辑注册表或在 CMD 框中设置 ORACLE_SID。(因为要运行 sqlplusw.exe 建议编辑注册表。)
回答by ClickerTweeker
Another possible solution that just worked for me...considering I was using my local login as the dba permissions.
另一种可能对我有用的解决方案......考虑到我使用本地登录作为 dba 权限。
Follow the steps to get to Services. Right click on the instance and go to 'Log On'? (might not be the name but it's one of the tabs containing permissions). Change the settings to use LOCAL.
按照步骤访问服务。右键单击实例并转到“登录”?(可能不是名称,但它是包含权限的选项卡之一)。更改设置以使用 LOCAL。
回答by BigData
I have solved the problem the easy way. My oracle was running just fine in the past. After I installed MS SQL Server was when I noticed this problem. I just uninstalled MS SQL Server on my machine then the problem was gone. Make sure you restart your computer after that. Now I can connect to Oracle database through SQLPlus again. My guess is that there's some conflict between the two. Hope this helps.
我已经用简单的方法解决了这个问题。我的 oracle 过去运行得很好。在我安装 MS SQL Server 后,我注意到了这个问题。我刚刚在我的机器上卸载了 MS SQL Server,然后问题就消失了。确保在那之后重新启动计算机。现在我可以再次通过 SQLPlus 连接到 Oracle 数据库。我的猜测是两者之间存在一些冲突。希望这可以帮助。
回答by user2129206
If none the above work, then try this :
Modify the LISTENER.ora
(mine is found in : oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
) ==> add a custom listener that points to your database(SID), example my SID is XZ0301, so :
如果以上都不起作用,请尝试以下操作:修改LISTENER.ora
(我的在 : 中找到oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
)==> 添加一个指向您的数据库(SID)的自定义侦听器,例如我的 SID 是 XZ0301,因此:
## Base XZ03001
SID_LIST_LISTENER_XZ03001=(SID_LIST=(SID_DESC=(ORACLE_HOME =
E:\oracle\product.2.0\dbhome_1)(SID_NAME= XZ03001)))
LISTENER_XZ03001=(DESCRIPTION_LIST=(ADDRESS=(PROTOCOL =
TCP)(HOST=MyComputerName)(PORT= 1521)))
DIAG_ADR_ENABLED_LISTENER_XZ03001=ON
ADR_BASE_LISTENER_XZ03001=E:\oracle
Restart your machine
重启你的机器
For Windows 7, use the following to modify the LISTENER.ora: - Go to Start > All Programs > Accessories - Right click Notepad and then click Run as Administrator . - File>open and navigate to the tnsnames.ora file. - Make the changes then it should allow you to save
对于 Windows 7,使用以下内容修改 LISTENER.ora: - 转至开始 > 所有程序 > 附件 - 右键单击记事本,然后单击以管理员身份运行。- 文件>打开并导航到 tnsnames.ora 文件。- 进行更改,然后它应该允许您保存