I am using SQL Developer for Oracle, but I forgot my username and password. I need help finding the username and password enter image description here
Is there a command-line option for recovering my username and password from the login?
Well, you should be able to connect to database, somehow. If there's a DBA available to you, contact them and ask for assistance. If you're a DBA, then you'll have to do it yourself.
If operating system user you're connected to also owns Oracle database software, try with operating system authentication:
c:\temp>sqlplus / as sysdba
Oracle trusts that this (operating system) user is allowed to establish connection.
My operating system user isn't the one, but I do know sys
password so I can connect:
c:\temp>sqlplus sys@pdb1 as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Sun Jan 21 16:48:28 2024
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
OK, we're in.
You said you don't know your username; that's kind of unusual as people forget passwords, but do know usernames. Never mind that objection; query all_users
and see whether any of these ring a bell. If not, then I presume nobody can help you. I recognize my user, its name is SCOTT
:
SQL> select username from all_users where username like 'S%';
USERNAME
--------------------------------------------------------------------------------
SYS
SYSTEM
SYSBACKUP
SYSDG
SYSKM
SYSRAC
SYS$UMF
SI_INFORMTN_SCHEMA
SCOTT --> this one
9 rows selected.
If you don't know its password, reset it:
SQL> alter user scott identified by tiger;
User altered.
Connect as SCOTT
, using newly set password:
SQL> connect scott/tiger@pdb1
Connected.
SQL>
That's all.