Monday, August 25, 2008

Oracle Tip

There are lot of interesting stuffs that can be done using the data dictionary tables in oracle. There are lot of data dictionary available in oracle. Some of them are

user_tables,
user_tab_cols
user_views

The different data dictionaries that are available in oracle can be viewed by querying ALL_VIEWS

select * from all_views ;

Now one of the data dictionary or one of the most powerful and useful one in oracle is dba_users. This data dictionary gives you the details about the database users that are available for a particular database. Now if suppose you want to access the database using a specific userid and you dont have the password of the user,however have the privilige to do things in the database then you can try to use the following stuff

SQL > select username,password from dba_users where username = 'SCOTT'

USERNAME PASSWORD
---------------------------
SCOTT F894844C34402B677


now alter the user to specify your custom password

SQL > Alter user scott identified by mypassword

Then login to the user scott using the password specified by you now and start working.
Once you have done with the work restore the old password by using the undocumented thing called by value

SQL> Alter user scott identified by values ' F894844C34402B677'

So that the password is restored to its originial value.

Hope the tip is helpful in certain aspects for the database administrators or it might be a way to provide an insight to the ways security breaches can be made if priviliges are available for database users.
SQL> select username,password from dba_users where username='SCOTT';

USERNAME PASSWORD
-------- ----------------
SCOTT F894844C34402B677

No comments: