1

I created a user and granted it privileges but I cannot connect to the database as that user from SQL Developer.

When I enter the code in SQL*Plus it shows that it has connected as in the picture below

picture

However when I try the same thing in Oracle SQL Developer, it shows me SYS user.

enter image description here

How to fix this?

EDIT

picture

1 Answer 1

6

In your SQL Developer screen shot you're looking at the 'Other Users' section of the navigation panel on the left, under your existing connection as SYS.

You can temporarily change to another user in that SQL Worksheet by doing:

connect c##murat/<password>

and then if you run as a script the statements after that will be performed as that user - and it will disconnect and revert to SYS when the script finishes.

But I wouldn't recommend that, except maybe as part of a schema-build script where you might want to switch back and forth. Particularly when you're really connected SYS. It's too easy to accidentally run something as the wrong user.

Really you need to create a new connection. At the top of the 'Connections' panel, click the green plus symbol and find your current connection in the list. Change the connection name (important!), username and password, set the role to 'default', click 'Test' to verify, and then click 'Save'.

You will then have two connections, and you can choose which to connect to and open SQL Worksheets as. As you're hopefully aware, you should not do any normal work as SYS, so you'll rarely need to connect as that again. I'd suggest you make it obvious in the connection name which is which, and that will appear in unsaved worksheet titles; and maybe use the connection colour option to further highlight and give you some visual warning when you are connecting as SYS.

When you are connected as your new user, you will not see their name in the 'Other Users' list. You will see SYS though.

Sign up to request clarification or add additional context in comments.

11 Comments

can you look edit? when I set and clicked test as you said, I got failure
Did you select your existing connection first, and then overtype, as I said? It should have a service name not a SID for a start, in 12c. (I'm a bit confused by your new screenshot though; which connection were you using - did 'murat' connect as SYS?)
yes exactly. It was firstly set local/bequeath as connection type and sysdba as role. I guess due to changing them I get failure
Did you get an error with local/bequeath? And why are you now trying to connect as system instead of c##murat? If you don't want SQL Developer to ever connect as SYS then you can change the credentials (and role) for your existing one, without changing the name, which will overwrite it.
yes , I don't know why but murat is connecting as sys
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.