In an Oracle Database, what are the differences between the following:
sys_context('USERENV', 'CURRENT_SCHEMA') - The schema that is currently being used and as you already found out can be changed with alter session
sys_context('USERENV', 'SESSION_USER') - The user that was used for authentication during the creation of the session and cannot be changed
sys_context('USERENV', 'CURRENT_USER') - Pretty much like "session_user" deprecated (at least according to the 10g documentation)
(editted according to @a_horse_with_no_name's answer and the reference he gave to the 11g docs)
sys_context('USERENV', 'AUTHENTICATED_IDENTITY') - The identity used for authentication, depends on the "AUTHENTICATION_METHOD".
from documentation:
- Kerberos-authenticated enterprise user: kerberos principal name
- Kerberos-authenticated external user : kerberos principal name; same as the schema name
- SSL-authenticated enterprise user: the DN in the user's PKI certificate
- SSL-authenticated external user: the DN in the user's PKI certificate
- Password-authenticated enterprise user: nickname; same as the login name
- Password-authenticated database user: the database username; same as the schema name
- OS-authenticated external user: the external operating system user name
- Radius/DCE-authenticated external user: the schema name
- Proxy with DN : Oracle Internet Directory DN of the client
- Proxy with certificate: certificate DN of the client
- Proxy with username: database user name if client is a local database user; nickname if client is an enterprise user.
- SYSDBA/SYSOPER using Password File: login name
- SYSDBA/SYSOPER using OS authentication: operating system user name
user pseudo column - I'm not sure, according to documentation I'd think it's like CURRENT_SCHEMA but apparently it's like CURRENT_USER