Real Application Security (RAS) was introduced in 12c.
RAS Global Callbacks are mentioned in documentation here.
But, as of 23ai, there is still no data dictionary view for listing what procedure has been registered for which RAS Event.
List of documented views
23.4 FREE on VirtualBox
v$version.banner_full
"Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.4.0.24.05"
EXAMPLE
ADMIN/SYS/DBA
-- from RAS HR Demo
create user HR identified by Change0nInstall
default tablespace USERS
quota 10 MB on USERS
account unlock;
grant db_developer_role to hr;
exec sys.xs_principal.create_user(name => 'daustin', schema => 'hr');
exec sys.xs_principal.set_password('daustin', 'Change0nInstall');
exec sys.xs_principal.grant_roles('daustin', 'XSCONNECT');
exec sys.xs_principal.grant_roles('daustin', 'employee');
exec sys.xs_principal.grant_roles('daustin', 'it_engineer');
exec sys.xs_admin_util.grant_system_privilege( 'CALLBACK','HR' ); -- local
exec sys.xs_admin_cloud_util.grant_system_privilege( 'CALLBACK','HR' ); -- OCI ADB
HR
create table login_table (
ras_id raw(256),
ts timestamp with time zone default on null current_timestamp
);
create or replace
procedure init_ras_session( sessionid in raw, user in varchar2, error out pls_integer)
as
begin
error := 0;
insert into hr.login_table (ras_id) values ( sessionid );
commit;
end;
/
begin
SYS.dbms_xs_sessions.add_global_callback( SYS.dbms_xs_sessions.direct_login_event, 'hr', null, 'init_ras_session');
end;
/
DAUSTIN
just login using SQLPlus, SQLcli, SQL Developer (classic or VS Code).
The procedure is registered as if it was a LOGIN trigger for direct login RAS session (eg sqlplus daustin/Chang0nInstall
)
HR
-- Confirmed that the Global Callback was called
select * from login_table;
-- cleanup
begin
SYS.dbms_xs_sessions.delete_global_callback( SYS.dbms_xs_sessions.direct_login_event, 'hr', null, 'init_ras_session');
end;
/