Posted on

Editioning – Which edition is a session using?

So now you have 2 editions that have identical objects, one of them is set as the database default edition. How can you tell which edition a session is using?

If you are controlling the session and can run SQL, just run this:

SELECT sys_context(‘USERENV’, ‘CURRENT_EDITION_NAME’) edition FROM dual;

If you want to see what the current edition of other running sessions, try this:

SELECT o.object_name edition, s.*
FROM gv$session s
LEFT OUTER JOIN dba_objects o ON (s.session_edition_id = o.object_id);

Want to know the what the default edition is set to? Run this:

SELECT property_value FROM database_properties WHERE property_name = ‘DEFAULT_EDITION’;

Combining those, if you want to find all the sessions that are using a non-default edition, this will give you that information:

SELECT o.object_name edition, s.*
FROM gv$session s
LEFT OUTER JOIN dba_objects o ON (s.session_edition_id = o.object_id)
WHERE o.object_name NOT IN (SELECT property_value FROM database_properties WHERE property_name = ‘DEFAULT_EDITION’);

So now you know what edition a session is running, next time we’ll talk about how to change the edition and control how other sessions connect.