Liron Amitzi Oracle ACE

Oded Raz Oracle ACE Director

Connect as an Oracle User Without Knowing the Password

Posted by Oded Raz on Feb 7th, 2010 and filed under Administration, Oracle, Tips & Tricks. You can follow any responses to this entry through the RSS 2.0. You can leave a response or trackback to this entry

In some cases we have to connect to the database as a specific user, but don’t know the password.

There are two ways to handle this problem:

1. There is a system privilege called “connect through”. Let’s say we have the user called “master” and we wish to connect as “app”. We will grant the privilege using the following syntax:

Alter user app grant connect through master;

After granting this privilege, the user “master” can connect as the user “app” without the password of “app” user.

To connect as “app” user, use the following syntax:

sqlplus master[app]/pwd@db

Note that the password given is the password of “master” user. But in this sqlplus session we are connected as “app” user.

2. If we can allow ourselves to change the password, but don’t want to change it permanently, there is a way to change the password back.

The DBA_USERS table contains the PASSWORD column. This column contains the encrypted password of the user.
Follow these steps to change the user’s password:

  1. Get the encrypted password of the user from DBA_USERS table and save it.
  2. Change the password by using the “alter user <user> identified by <pwd>” command.

Perform the following step to change the password back:

  1. Use the “alter user <user> identified by values <encrypted_password>” command.

Use the encrypted password you have and pay attention to the “values” keyword in the command, it specifies that the password given in the command is already encrypted.

1 Response for “Connect as an Oracle User Without Knowing the Password”

  1. Anil kumar Koyyada says:

    Thank you for the useful information.

Leave a Reply

 
Log in / Advanced NewsPaper by Gabfire Themes