Search notes:

Oracle: SYS_CONTEXT('USERENV', 'DBLINK_INFO')

create database link tq84_to_10101010
connect to rene identified by supersecretpassword
using '(DESCRIPTION=(ADDRESS= (PROTOCOL=tcp) (Host=10.10.10.10) (Port=1521)) (CONNECT_DATA=(service_name=svc_10)))';

begin
   dbms_utility.exec_ddl_statement@tq84_to_10101010(q'[

create view tq84_dblink_info as
select
   sys_context('userenv', 'dblink_info') val
from
   dual

]');
end;
/
Selecting from the view on the local database via the database link ‥
select * from tq84_dblink_info@tq84_to_10101010;
‥ returns something like:
SOURCE_GLOBAL_NAME=mydb, DBLINK_NAME=TQ84_TO_10101010, SOURCE_AUDIT_SESSIONID=244407039
If directly selected on the remote database, the result is NULL.

Index