How To Connect To Oracle When You Forgot Your Password

Back in July, I installed an instance of Oracle on my laptop. It is now September. Late September, actually, and almost a full three months since I installed that instance. Can you guess what I may have forgotten in that time? That’s right, I forgot the password. Actually, I forgot more than just the password, I couldn’t even remember that the Oracle equivalent of ‘sa’ is named ‘SYS’. And even after I found the SYS name I just could not remember the password.

I pinged one of my colleagues at Confio for some help. His first reply suggested that there wasn’t much he could do for me since it would require using a command window and he wasn’t sure that a SQL Server DBA was able to use a command line interface (well, he wasn’t sure that *I* could use one, but I think he was being polite by grouping me in with others. I work with some truly thoughtful people.)

He did, however, point me in the direction of the local Windows group named ora_dba. Apparently, it is possible for me to add my local account to this group and then I can get access to the instance through SQL*Plus. So I did that…and it didn’t work.

[Bonus points awarded to the person that explains why.]

It didn’t work because I needed to bounce the instance (obviously). And once I did that I was able to connect by issuing the following command:

>sqlplus "/ as sysdba"

After connecting I was able to reset the password

>alter user sys identified by <whatever pwd you want>;

After that, I was able to connect to the Database Control panel in my browser.

So there you go, that’s how to connect to Oracle when you forgot your password. Of course, this method works if your system isn’t locked down. If you are able to use this method then your system is not secure.

13 thoughts on “How To Connect To Oracle When You Forgot Your Password”

  1. I thought it was safe to assume your password was Bacon.

    Seriously, going back to my Oracle DB days TOAD for Oracle was a great application. It was like SSSMS before its time and better. I think it also had source control back in 2005. If you can snag a copy it might help eliminate the text commands.

    Reply
    • Well, “bacon” didn’t work, so I really don’t know what I was thinking when I configured the instance.

      Regardless of TOAD, I would still need to be able to connect to the instance, and I couldn’t do that until I hacked my way in first (since I had forgotten the password).

      Reply
  2. Is the ‘ora_dba’ group something that can be overridden, much like removing the ‘Administrators’ group from the sysadmin role in MS-SQL?

    Reply
    • Dave,

      I would imagine that it can be overridden. Unfortunately the interface I am using to admin the Oracle instance is less than intuitive for navigation. So, I haven’t been able to find it easily. But there must be a way to override the default settings, otherwise this steamer would never pass an audit.

      Reply
  3. Hie guys…

    I recently install Oracle R12 on Windows Xp (vision install- for my study purposes, connected to the Ms loop adapter). The thing is when I try to use the Oracle forms.. they were not opening at all. So ,I tried to run the Ad utility(adadmin) but then my access to it got locked coz I confused the passwords. Now I have to use SQLplus to unlock it..when I log in SQLplus using system / sydba it is rejected, i have tried Scott / tiger stil it does not work now Im stuck..Any help..i would appreciate it!!!

    Reply
  4. i am a sql+ user and i changes the user name ‘scott’ to my name and some password during installation after ~ a mounth i forgot my password and tried your code in another account but i got an error which says that i have insufficient privileges to do that
    now please take me out of this problem i am in great danger ‘cuz i have exams

    Reply
    • RocketX,

      If the ora_dba group isn’t a login to the Oracle instance, then you are out of luck if you don’t remember your password. I’d suggest you contact the admin for the instance or think about doing a reinstall. Good luck on your exams.

      Reply
  5. i created my database in oracle, entered my password and username but when i now use the sqlplus, it tells me wrong password and username i would like to change my username and password but when i try it, it using >sqlplus “/as sysdba” then alter user sys identified by ;,it brings me an error saying “missing or invalid option” what would be the problem tank you

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.