Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sys_context via dblink

just a DBAJul 31 2013 — edited Aug 7 2013

Hello.

How to create context that will work via database link ?
As per documentation, such context should be created as "Initialized Externally" and db link should be "Connected User".

Remote db :

CREATE CONTEXT con1 USING proc1 Initialized Externally;

CREATE PROCEDURE proc1(value IN VARCHAR2) IS
BEGIN
  DBMS_SESSION.SET_CONTEXT('con1', 'attr', value);
END;

Local db:

create database link link1 using 'remote_db';

exec proc1@link1 ('123')

SELECT * FROM SESSION_CONTEXT@link;

NAMESPACE ATTRIBUTE VALUE
--------- --------- -----
CON1      ATTR      123

As we see, context is set. But the following query returns null:

select sys_context('con1','attr') from dual@link1;

SYS_CONTEXT('CON1','ATTR')
--------------------------

1 row selected

What is wrong?

Thanks.

This post has been answered by Mihael on Aug 6 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2013
Added on Jul 31 2013
8 comments
3,331 views