Re: What is an edition?

From: Michael Austin <maustin_at_firstdbasource.com>
Date: Tue, 04 Nov 2008 18:34:04 -0600
Message-ID: <2S5Qk.3838$hc1.3434@flpi150.ffdc.sbc.com>


Mladen Gogala wrote:
> Server is 11.1.0.7 on Linux/x86. I noticed processes sometimes holding an
> "edition lock" on object ORA$BASE. The
>
> V$LOCK_TYPE table says the following: "Prevent Dropping an edition in use
> ". To make things even more confusing,
>
> there is a very well hidden view named '_CURRENT_EDITION_OBJECT'. Here is
> the text:
>
>
>
> <code>select text
> from dba_views where view_name = '_CURRENT_EDITION_OBJ';
>
>
>
> TEXT
>
> --------------------------------------------------------------------------------
>
>
> select
> o."OBJ#",o."DATAOBJ#",o."OWNER#",o."NAME",o."NAMESPACE",o."SUBNAME",o."TY
>
>
> PE#",o."CTIME",o."MTIME",o."STIME",o."STATUS",o."REMOTEOWNER",o."LINKNAME",o."FL
>
>
> AGS",o."OID
> $",o."SPARE1",o."SPARE2",o."SPARE3",o."SPARE4",o."SPARE5",o."SPARE6",
>
>
>
>
> o.spare3,
>
> case when (o.type# not in (4,5,7,8,9,10,11,12,13,14,22,87) or
>
> bitand(u.spare1, 16) = 0) then
>
> null
>
>
> when (u.type# = 2) then
>
> (select eo.name from obj$ eo where eo.obj# = u.spare2)
>
> else
>
>
>
> TEXT
>
> --------------------------------------------------------------------------------
>
>
> 'ORA$BASE'
>
> end
>
> from obj$ o, user$ u
>
> where o.owner# = u.user#
>
> and ( /* non-versionable object */
>
> ( o.type#
> not in (4,5,7,8,9,10,11,12,13,14,22,87,88)
>
> or bitand(u.spare1, 16) = 0)
>
> /* versionable object visible in current edition
> */
>
> or ( o.type# in (4,5,7,8,9,10,11,12,13,14,22,87)
>
> and ( (u.type# <> 2 and
>
> sys_context('userenv', 'current_edition_name')
> = 'ORA$BASE')
>
>
>
> TEXT
>
> --------------------------------------------------------------------------------
>
>
>
> or (u.type#
> = 2 and
>
> u.spare2 = sys_context('userenv', 'current_edition_id'))
>
> or exists (select 1 from obj$ o2, user$ u2
>
> where o2.type#
> = 88
>
> and o2.dataobj# = o.obj#
>
> and o2.owner# = u2.user#
>
> and u2.type# = 2
>
> and u2.spare2 =
>
> sys_context('userenv',
> 'current_edition_id'))
>
> )
>
>
>
> TEXT
>
> --------------------------------------------------------------------------------
>
> )
>
> ) </code>
>
>
>
>
>
>
> OK. Here are the questions:
>
> What is the purpose of those "edition objects"? I figured out that it is
> about sys_context, but it's still unclear? The "CURRENT_EDITION_ID"
> option is not documented as a legal option for the SYS_CONTEXT function.
> What are the
>
> users of type# 2? I don't have any in my databases. Users of type#=0 are
> roles, users of type#=1 are the normal lusers.
>
> What in the world are the users of type#=2? Last but not least, what is
> protected by locks of the type AE? Did I mention
>
> that there is no documentation about this on Metalink? Nada, nil, zilch.
> On version 10, "editions" are not recognized:
>
>
>
> SQL> select sys_context('userenv','current_edition_id') from dual;
>
> select sys_context('userenv','current_edition_id') from dual
>
> *
>
> ERROR at line 1:
>
> ORA-02003: invalid USERENV parameter
>
>
>
> Version 11 recognizes the arguments as correct:
>
> Connected.
>
> SQL> select sys_context('userenv','current_edition_id') from dual;
>
>
>
> SYS_CONTEXT('USERENV','CURRENT_EDITION_ID')
>
> --------------------------------------------------------------------------------
>
> 99
>
>
>
>
>
>
>
>
>
> I am an oracle beginner with only a few months of experience. Please,
> gurus, help me with my questions.
>
>
>

I could be wrong and not having done very much research (only what has been explained here) it appears to resemble something from the Oracle/Rdb product (formerly DEC/Rdb) where it would be used to "version" an object whereby a new "version" is generated when you make ddl changes to an existing object. This allows for those on-the-fly changes like rolling upgrades. ie: InstanceA on nodeA has been upgraded using edition "2" while InstanceB on nodeB is still using edition/version "1". Simply bouncing node2 effects the upgrade.

The UNIX environment has a long way to go to catch up to the REAL high availability features or the DEC- now HP OpenVMS - such as file versioning - which is where Rdb got the concept to be able to do real rolling upgrades of databases. Received on Tue Nov 04 2008 - 18:34:04 CST

Original text of this message