Application developers who are upgrading their applications using edition-based redefinition may ask you to perform edition-related tasks that require DBA privileges.
In this section:
Edition-based redefinition enables you to upgrade an application's database objects while the application is in use, thus minimizing or eliminating down time. This is accomplished by changing (redefining) database objects in a private environment known as an edition. Only when all changes have been made and tested do you make the new version of the application available to users.
Table 18-1 summarizes the edition-related tasks that require privileges typically granted only to DBAs. Any user that is granted the DBA role can perform these tasks.
Table 18-1 DBA Tasks for Edition-Based Redefinition
Task | See |
---|---|
Grant or revoke privileges to create, alter, and drop editions |
The CREATE EDITION and DROP EDITION commands in Oracle Database SQL Language Reference |
Enable editions for a schema |
Oracle Database Advanced Application Developer's Guide |
Set the database default edition |
"Setting the Database Default Edition" |
Set the edition attribute of a database service |
"Setting the Edition Attribute of a Database Service" |
There is always a default edition for the database. This is the edition that a database session initially uses if it does not explicitly indicate an edition when connecting.
ALTER DATABASE DEFAULT EDITION = edition_name;
The database default edition is stored as a database property.
SELECT PROPERTY_VALUE FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME = 'DEFAULT_EDITION'; PROPERTY_VALUE ------------------------------ ORA$BASE
Note:
The property name DEFAULT_EDITION is case sensitive and must be supplied as upper case.
Note:
This functionality is available starting with Oracle Database 11g release 2 (11.2.0.2).
You can set the edition attribute of a database service when you create the service, or you can modify an existing database service to set its edition attribute. When you set the edition attribute of a service, all subsequent connections that specify the service, such as client connections and DBMS_SCHEDULER jobs, use this edition as the initial session edition. However, if a session connection specifies a different edition, then the edition specified in the session connection is used for the session edition. To check the edition attribute of a database service, query the EDITION column in the ALL_SERVICES view or the DBA_SERVICES view.
Note:
The number of database services for an instance has an upper limit. See Oracle Database Reference for more information about this limit.
Follow the instructions in "Creating Database Services" and use the appropriate option for setting the edition attribute for the database service:
For the database with the DB_UNIQUE_NAME of dbcrm, this example creates a new database service named crmbatch and sets the edition attribute of the database service to e2:
srvctl add service -d dbcrm -s crmbatch -t e2
You can use the SRVCTL utility or the DBMS_SERVICE package to set the edition attribute of an existing database service.
If your single-instance database is being managed by Oracle Restart, use the SRVCTL utility to modify the database service and specify the -t option to set its edition attribute.
For the database with the DB_UNIQUE_NAME of dbcrm, this example modifies a database service named crmbatch and sets the edition attribute of the service to e3:
srvctl modify service -d dbcrm -s crmbatch -t e3
To view or modify objects in a particular edition, you must use the edition first. You can specify an edition to use when you connect to the database. If you do not specify an edition, your session starts in the database default edition. To use a different edition, submit the following statement:
ALTER SESSION SET EDITION=edition_name;
The following statements first set the current edition to e2 and then to ora$base:
ALTER SESSION SET EDITION=e2; ... ALTER SESSION SET EDITION=ora$base;
There are several data dictionary views that aid with managing editions. The following table lists three of them. For a complete list, see Oracle Database Advanced Application Developer's Guide.
View | Description |
---|---|
*_EDITIONS | Lists all editions in the database. (Note:USER_EDITIONS does not exist.) |
*_OBJECTS | Describes every object in the database that is visible (actual or inherited) in the current edition. |
*_OBJECTS_AE | Describes every actual object in the database, across all editions. |