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"
This entry was posted in Oracle on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Leave a Reply