Re: Mistakenly changes db users passwords

From: Robert Freeman <>
Date: Tue, 8 Dec 2009 17:16:37 -0800 (PST)
Message-ID: <>

You did this in production? Holy cow...

How many users did you manage to change? If it's just a few, I'd just call them and tell them that they have new passwords. If you are talking about large scale then you have big problems... sure you can do a point-in-time recovery but what are the impacts of that? You COULD recover the database to a point-in-time prior to the change, get all the password hashes and then use the alter user command with the using values command. You can get the hashes from user$. So you would do something like this:

After the restore to ANOTHER database (you would only need the SYSTEM, SYSAUX, and UNDO tablespaces restored and then create a temporary tablespace.

On the temporary restored database log in as sysdba.

Issue this query:

select name, password from user$ where name='SCOTT';

name password
-------------- ----------------

SCOTT F09492C0593049B99 then in the messed up database simply change the password using the hash:

alter user scott identified by values ' F09492C0593049B99';

This should reset the password to the correct password. You could easily write a script to to massive changes if need be.

Then, I'd be updating my resume, depending on how forgiving your boss is. If it were me, you'd be cleaning bathrooms for at least a week. With a toothbrush..... :) But, I'm just a nice guy. :-)


 Robert G. Freeman
Oracle ACE
Ask me about on-site Oracle Training! RMAN, DBA, Tuning, you name it! Author:
Oracle Database 11g RMAN Backup and Recovery (Oracle Press) - ON ITS WAY SOON! OCP: Oracle Database 11g Administrator Certified Professional Study Guide (Sybex) Oracle Database 11g New Features (Oracle Press) Oracle Database 10g New Features (Oracle Press) Other various titles
Blog: Check out my new blog series on installing Oracle Database 11gR2 on Windows using VMWare!

From: Viktor <>
Sent: Tue, December 8, 2009 5:56:29 PM
Subject: Mistakenly changes db users passwords

Hi gurus, Linux Redhat:

I mistakely ran a script and changed db passwords for all users. Is the only option here RMAN restore/recovery? Would point-in-time work, won't it?

The database has not been set as a flashback db.

Thanks much in advance!
-- Received on Tue Dec 08 2009 - 19:16:37 CST

Original text of this message