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

孤街醉人 提交于 2019-12-04 10:22:43

问题


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.

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.

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.

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

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

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

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?

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.


回答1:


From the The SYSDBA System Privilege and (Logging In and Connecting to the Database as 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.

So - if this works for you:

sqlplus sys/Oracle_1@pdborcl as sysdba;

Try: "SYS AS SYSDBA" as below:

Alternatively:

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




回答2:


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:

sqlplus "sys/password@database as sysdba"

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




回答3:


The sys password that you are using is not valid.

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.

Just change the sys password and try again.




回答4:


su - oracle

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

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

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



来源:https://stackoverflow.com/questions/9129664/unable-to-log-in-to-database-as-sys-with-oracle-sql-developer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!