无法使用 Oracle SQL Developer 以 SYS 身份登录到数据库

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

Unable to log in to database as SYS with Oracle SQL Developer

oracleloginoracle-sqldeveloper

提问by owlie

I've worked with Oracle for some time but very much a noob with the Admin side of things and am learning, so bear with me.

我已经与 Oracle 合作了一段时间,但在管理方面非常菜鸟并且正在学习,所以请耐心等待。

I cannot log on to my database (orcl_test) with SQL Developer with the SYS username. I can log on just fine in SQLPlus with SYS as SYSDBA - when I try with SQL Developer I get an error:
ORA-01017: invalid username/password; logon denied.

我无法使用 SYS 用户名使用 SQL Developer 登录到我的数据库 (orcl_test)。我可以使用 SYS 作为 SYSDBA 在 SQLPlus 中正常登录 - 当我尝试使用 SQL Developer 时出现错误:
ORA-01017:无效的用户名/密码;登录被拒绝。

Logging on as SYS as SYSDBA in SQLPlus, I created a test table within the database and granted the test user SCOTT with SELECT permissions. The Scott user can log on through SQL Developer w/o problem and access the allowed tables.

在 SQLPlus 中以 SYS 身份作为 SYSDBA 登录,我在数据库中创建了一个测试表,并授予测试用户 SCOTT SELECT 权限。Scott 用户可以在没有问题的情况下通过 SQL Developer 登录并访问允许的表。

I have checked that the Scott user and SYS are logging in using the same settings -
Hostname: (ip address)
Port: 1521
SID: orcl_test

我已检查 Scott 用户和 SYS 是否使用相同的设置登录 -
主机名:(IP 地址)
端口:1521
SID:orcl_test

For SYS I flag the role SYSDBA - but otherwise the settings are the same.

对于 SYS,我标记角色 SYSDBA - 但其他设置是相同的。

Any thoughts on why I can't log on using SYS? Am I just overlooking something or have I configured my db incorrectly?

关于为什么我无法使用 SYS 登录的任何想法?我只是忽略了某些东西还是我错误地配置了我的数据库?

Not sure if this is relevant but I cannot use 'localhost' for the hostname, I have to enter the IP address. Where do I configure Oracle to recognize localhost?

不确定这是否相关,但我不能使用“localhost”作为主机名,我必须输入 IP 地址。我在哪里配置 Oracle 以识别本地主机?

This is a new installation of Oracle 11.2.0.1.0 on a standalone test box running Windows XP. Running Oracle SQL Developer 1.5.5.

这是在运行 Windows XP 的独立测试盒上新安装的 Oracle 11.2.0.1.0。运行 Oracle SQL Developer 1.5.5。

回答by Witold Kaczurba

From the The SYSDBA System Privilegeand (Logging In and Connecting to the Database as SYSDBA:

SYSDBA 系统特权(以 SYSDBA 身份登录并连接到数据库

1--Connecting AS SYSDBA invokes the SYSDBA privilege. If you omit the AS SYSDBA clause when logging in as user SYS, the SQL Command Line rejects the login attempt.

2--Using SQL Developer, open a database connection to the SYS user AS SYSDBA.

1--连接AS SYSDBA 调用SYSDBA 权限。如果在以 SYS 用户身份登录时省略 AS SYSDBA 子句,SQL 命令行将拒绝登录尝试。

2--使用 SQL Developer,打开到 SYS 用户AS SYSDBA的数据库连接。

So - if this works for you:

所以 - 如果这对你有用:

sqlplus sys/Oracle_1@pdborcl as sysdba;

Try: "SYS AS SYSDBA" as below:

尝试:“ SYS AS SYSDBA”如下:

enter image description here

在此处输入图片说明

Alternatively:

或者

you can type in: "SYS" and select from dropdown-menu ROLE: SYSDBA.

您可以输入:“SYS”并从下拉菜单中选择角色:SYSDBA。

enter image description here

在此处输入图片说明

回答by j.b.

If I understand correctly the database is on the same host as the SQL Developer installation? Are you fully qualifying the connection when testing with SQLPlus:

如果我理解正确,数据库与 SQL Developer 安装在同一台主机上?使用 SQLPlus 进行测试时,您是否完全限定了连接:

sqlplus "sys/password@database as sysdba"

It may be the case that the error is correct. Make sure you've created a password file.

错误可能是正确的。确保您已创建密码文件。

回答by mehdi

The sys password that you are using is not valid.

您使用的 sys 密码无效。

But because you are connecting to oracle by command on an Oracle machine, Oracle does not check your password even though your password is not right.

但是因为您在 Oracle 机器上通过命令连接到 oracle,即使您的密码不正确,Oracle 也不会检查您的密码。

Just change the sys password and try again.

只需更改 sys 密码并重试。

回答by 42n4

su - oracle

su - 甲骨文

orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=Euro2016 entries=5

orapwd 文件=$ORACLE_HOME/dbs/orapw$ORACLE_SID 密码=Euro2016 条目=5

which means: write to a file $ORACLE_HOME/dbs/orapw$ORACLE_SID a password Euro2016 which is used by SYSDBA

这意味着:将 SYSDBA 使用的密码 Euro2016 写入文件 $ORACLE_HOME/dbs/orapw$ORACLE_SID

Now you can connect with sqldeveloper: username sys, password Euro2016 with chosen SYSDBA , hostname, port, sid from $ORACLE_SID

现在您可以使用 sqldeveloper 连接:用户名 sys,密码 Euro2016,选择 SYSDBA ,主机名,端口,来自 $ORACLE_SID 的 sid