| tenant-type | | slug | proxy-user-login-obclient |
OceanBase Database in Oracle-compatible mode supports the proxy user feature: after being authorized, User A (the proxy user) can log in using its own credentials and execute database operations on behalf of User B (the target user), with the role privileges of the target user taking effect.
Note
Proxy user is a user privilege capability in Oracle-compatible mode, which is different from the connection middleware ODP (OceanBase Database Proxy). This topic describes the former. When accessing the database through ODP, you can still use --proxy_user to specify the target user. For authorization and management of proxy users, see the OceanBase Database documentation "Use proxy users".
Prepare the environment
Create users
CREATE USER test IDENTIFIED BY test;
GRANT CONNECT, RESOURCE, DBA TO test;
CREATE USER test2 IDENTIFIED BY test2;
GRANT CONNECT, RESOURCE, DBA TO test2;
Authorize a proxy user
Authorize user test as the proxy user for user test2:
ALTER USER test2 GRANT CONNECT THROUGH test;
Remove proxy privileges:
ALTER USER test2 REVOKE CONNECT THROUGH test;
Log in as a proxy user
Log in as the proxy user test and act on behalf of the target user test2:
obclient -h100.88.109.130 -P38884 -utest@oracle -Dtest -ptest --proxy_user=test2
Use the --proxy_user option to specify the username to be proxied.
