启动 Oracle SQL*Plus 时出现 TNS 协议适配器错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8782842/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:49:45  来源:igfitidea点击:

TNS Protocol adapter error while starting Oracle SQL*Plus

oracleoracle11gsqlplus

提问by Brian

Whenever I try to login into SQL*Plus (11g Standar Edition Win 64) I get an error related to some connection error.

每当我尝试登录 SQL*Plus(11g 标准版 Win 64)时,我都会收到与某些连接错误相关的错误。

I try to login as sys as sysdba and provide the password.

我尝试以 sys 作为 sysdba 登录并提供密码。

All the services are started. I'm on Windows 7.

所有的服务都启动了。我在 Windows 7 上。

Any help would be appreciated.

任何帮助,将不胜感激。

enter image description here

在此处输入图片说明

回答by Sivadas Melazhi

Try

尝试

sqlplus sys/<your password>@<your SID> as sysdba

回答by Rawesome

Ensure the OracleService is running. I keep running into this error, but when I go into Services, find OracleServiceXE and manually start it, the problem is resolved. I have it set to start automatically, but sometimes it just seems to stop on its own; at least, I can't find anything Iam doing to stop it.

确保 OracleService 正在运行。我一直遇到这个错误,但是当我进入服务时,找到OracleServiceXE并手动启动它,问题解决了。我将它设置为自动启动,但有时它似乎会自行停止;至少,我找不到正在做的任何事情来阻止它。

回答by Roshan

Use this command, in command prompt

在命令提示符下使用此命令

sqlplus userName/password@host/serviceName

sqlplus 用户名/密码@主机/服务名

回答by John Doyle

Try typing all of this on the command line:

尝试在命令行中输入所有这些:

sqlplus / as sysdba

As what you are doing is starting sqlplus and then using sys as sysdbaas the user-name which is incorrect as that is not a valid user. By using the above command Oracle is using your system login credentials to access the db. Also, I would confirm that the sqlplus executable you are running is the correct one by checking your path - ensure it is in the bin of the server installation directories.

因为您正在做的是启动 sqlplus,然后将其sys as sysdba用作不正确的用户名,因为它不是有效用户。通过使用上述命令,Oracle 将使用您的系统登录凭据访问数据库。另外,我会通过检查您的路径来确认您正在运行的 sqlplus 可执行文件是正确的 - 确保它位于服务器安装目录的 bin 中。

回答by Benoit

Enter SQL*Plus with:

使用以下命令输入 SQL*Plus:

sqlplus /nolog

And then:

进而:

connect sys@<SID> AS sysdba

回答by SithuSena

You are getting ORA-12560: TNS:protocol adaptor errorbecuase you didn't start the Oracle database.

您收到ORA-12560: TNS:protocol adapter error,因为您没有启动 Oracle 数据库。

You can start Oracle database like this. From START-> select Oracle Database 11g Express Edition( 11g or what ever your database type.you can find this from All Programs). Then inside this folder there is a DB icon with green color spot.Start Database iconIt is the Start Service icon.Click it.Then it will take some seconds and start the service. connection success

您可以像这样启动 Oracle 数据库。从 START-> 选择 Oracle Database 11g Express Edition(11g 或任何您的数据库类型。您可以从所有程序中找到它)。然后在此文件夹内有一个带有绿色斑点的 DB 图标。启动数据库图标它是“启动服务”图标。单击它。然后需要几秒钟才能启动服务。 connection success

After getting the above message,again try to connect through the SQL plus command line by giving user name and password. enter image description here

得到上述信息后,再次尝试通过SQL plus 命令行输入用户名和密码进行连接。 enter image description here

回答by Bikash Karmokar

Go to Start --> Run--> type " services.msc"

转到开始 --> 运行 --> 键入“services.msc”

Select the OracleService name, Right Click, Start.

选择 OracleService 名称,右键单击,启动。

Wait for a while and then your service will start. Then go to your sql command line window and try to connect to your user. I hope you can do that now.

稍等片刻,您的服务就会启动。然后转到您的 sql 命令行窗口并尝试连接到您的用户。我希望你现在能做到。

回答by CodeDevotion

You might have set oracle not to start automatically. Goto Start and search for Services. Scroll down and look for OracleServiceORCL (or OracleServiceSID). Double click and change startup type to automatic if it is set as manual.

您可能已将 oracle 设置为不自动启动。转到开始并搜索服务。向下滚动并查找 OracleServiceORCL(或 OracleServiceSID)。如果设置为手动,双击并将启动类型更改为自动。

回答by access_granted

Another possibility (esp. with multiple Oracle homes)

另一种可能性(尤其是多个 Oracle 主目录)

set ORACLE_SID=$SID

设置 ORACLE_SID=$SID

sqlplus /nolog

sqlplus / nolog

conn / as sysdba;

conn / 作为 sysdba;

回答by Himanshu Ahuja

The major issue might be the oracle database itself may not have started. So, you need to manually go via

主要问题可能是 oracle 数据库本身可能没有启动。所以,你需要手动通过

run command -> services.msc

运行命令 -> services.msc

check for OracleXEService surely, it may be disabled

确定检查 OracleXEService,它可能被禁用

right click go to properties-> set it to Automatic and press Ok. Then just right click again and start.

右键单击转到属性-> 将其设置为自动,然后按确定。然后只需再次右键单击并开始。

This will start your database making you to connect to it

这将启动您的数据库,使您能够连接到它

Finally, In sqlplus command line,

最后,在 sqlplus 命令行中,

connect as sysdba

作为 sysdba 连接

enter username as admin

输入用户名作为管理员

then press enter, you'll be connected

然后按回车,你将被连接