Saturday, July 14, 2012

How do switch to another user or reset that user password temporary in Oracle

As DBA, there are situations you need to upgrade an Oracle application or schema by log-in as that user but you might don't know the password. The best way to get around this is to change that user password temporary and change it back to that password again after you finish your task.
The problem is always that encrypted password  cannot be de-crypted so that password can be reset to its original one easy.We have to use VALUES keyboard which is same as what import or data pump does when it creates users.
For instance, if you as DBA you don't know SCOTT password, first you can save the password and do your task and then change it back to what it was.
You can follow the steps below to accomplish this:


Sqlplus system/password
In 10g and before:
SQL>select password from dba_users where username = 'SCOTT';
PASSWORD
------------------------------
F894844C34402B67
For 11g and above:
SQL>select password from sys.user$ where name='SCOTT';

PASSWORD
------------------------------
F894844C34402B67
SQL>alter user scott identified by temporary;

Now you can connect to scott with new password and do the job you need and then change the password back to what it was after you done as below:
SQL>alter user SCOTT identified by VALUES 'F894844C34402B67';





No comments:

Post a Comment

Please feel free to leave your comments.