Platinum Solutions Corporate Website


Becoming another user

There are times when it's useful for a DBA to login as a specific user temporarily in order to troubleshoot and diagnose problems.  Here's a way to do this without changing the password (at least as far as the user can see).  Since all Oracle user passwords are encrypted, the following technique can be used by a DBA who wants to take over a user account and then return it to it's original password:

-Query the DBA_USERS view to find the encrypted password for the user's account.

-Generate an ALTER USER command to return the account to the encrypted password by issuing the following command:

SELECT 'ALTER USER JSMITH IDENTIFIED BY VALUES '''|PASSWORD|''':' FROM DBA_USERS WHERE USERNAME = 'JSMITH' 

(Of course, you would replace JSMITH with the account name you want to login as.).  Save the output from this command (either cut and paste it into a text file or use the SPOOL command to save it to a file). 

-Change the user account's password to whatever you want for the short term with the ALTER USER command.  

-Login as the account and do whatever you need to do.

-When finished, run the ALTER USER command you saved earlier that contained the original encrypted password.

Note:  This technigue will work when the default Oracle security profile is being used.  If a custom profile is being used that maintains a password history, it won't (you'll get a "password cannot be reused" error message).

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.

More information about formatting options