Managing access in Oracle databases can get tricky, especially when multiple developers share the same schema or when DBAs need to perform tasks under specific accounts without knowing their passwords. That’s where proxy users come in.
A proxy user allows one account to connect through another, giving teams a secure and flexible way to manage access without exposing credentials.
A proxy user allows one account to connect through another, giving teams a secure and flexible way to manage access without exposing credentials.
Use-Cases
- DBA tasks without passwords – Perform administrative operations (like creating private database links or jobs with DBMS_JOB) under a specific user account without needing to know or share that account’s password.
- Shared schema access for teams – Allow multiple developers to work in the same schema using their own proxy accounts instead of sharing a single set of credentials.
- Auditing and accountability – Track individual actions inside a shared schema, since each user connects with their own credentials through the proxy.
How-To
In this example, the target schema account is named EDS (the application account). A separate account, proxy_user, will be created to connect through the EDS account.
col username form a20
select username from dba_users where username like upper('%eds%') or username like upper('%meris%')
USERNAME
--------------------
EDS
Create the proxy account.
create user proxy_user identified by passw0rd;
grant connect to proxy_user;
Grant permission connect through to proxy_user to login as EDS as proxy.
alter user EDS grant connect through proxy_user;
Connect via proxy user.sqlplus proxy_user[EDS]/passw0rd
SQL> show user
USER is "EDS"
SQL> set pages 400 lines 200
SQL> col session_user form a20
SQL> col session_schema form a20
SQL> col current_schema form a20
SQL> col proxy_user form a20
SQL> r
1 select sys_context('userenv','session_user') as session_user,
2 sys_context('userenv','session_schema') as session_schema,
3 sys_context('userenv','current_schema') as current_schema,
4 sys_context('userenv','proxy_user') as proxy_user
5* from dual
SESSION_USER SESSION_SCHEMA CURRENT_SCHEMA PROXY_USER
-------------------- -------------------- -------------------- --------------------
EDS EDS EDS PROXY_USER
Find the proxy session.
SQL> col username form a20
SQL> col osuser form a20
SQL> r
1 SELECT a.sid,
2 a.serial#,
3 a.username,
4 a.osuser,
5 b.authentication_type
6 FROM v$session a,
7 v$session_connect_info b
8 WHERE a.sid = b.sid
9 AND a.serial# = b.serial#
10* AND b.authentication_type = 'PROXY'
SID SERIAL# USERNAME OSUSER AUTHENTICATION_TYPE
---------- ---------- -------------------- -------------------- --------------------------
108 15998 EDS oracle PROXY
108 15998 EDS oracle PROXY
108 15998 EDS oracle PROXY
108 15998 EDS oracle PROXY
Comments
Post a Comment