Connect to user without knowing password with Grant connect in Oracle

You can connect to another user without knowing the password, with grant connect through privilege.

Suppose a user TEST1 wants to connect to TEST2 user and create a table and we don’t know the password of TEST2

Connect with Sys user and Grant Connect TEST2 to TEST1.

Conn / as sysdba
SQL >alter user TEST2 grant connect through TEST1;
User altered.

You can now connect with TEST1 user by specify TEST2 in bracket.


--Specify in bracket
SQL> conn test1[TEST2]@pdb1
Enter password:
Connected.
SQL> show user
USER is "TEST2"

--Example just to show 
SQL> conn test1@pdb1
Enter password:
Connected.
SQL> show user
USER is "TEST1"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.