ALTER USER command might be known to most of us. But it would be interesting to know that oracle provides an undocumented "identified by values" clause in this command. This clause can be very useful for DBA's in some cases. Many times DBA needs to log into user's account to make changes. Changes can be of any type like grant permission on user's table to another user etc. for this example there could be two cases where this clause can helpful. First DBA doesn't know the password of user and second he need to make changes to a set of users from a script, but, doesn't want to include their passwords in the script itself. Passwords of all the users are stored into dba_users table in encoded form. The encoded value can be used to generate an "alter user" command to reset the user's password back to its original value. . The user's password can be altered to a known value such as testPassword. Then jus log into the users account by connect userid/ testPassword, perform whatever changes you want to do and then run again generated "alter user command " that will put password to its original value.
I will show a sample sql to generate the password change script for setting all users of database to a known password. In this example that known password is testPassword. We need one more script for resetting the passwords to original value. just run the pwdChange.sql to change the passwords to a known value and after doing your work run the pwdReset.sql to change the passwords to original values.
Friday, May 1, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment