Oracle® Database Administrator's Guide 11g Release 2 (11.2) Part Number E25494-02 |
|
|
PDF · Mobi · ePub |
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.
See Also:
Oracle Database Advanced Application Developer's Guide for a complete discussion of edition-based redefinitionTable 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 |
Enable editions for a schema |
|
Set the database default edition |
|
Set 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.
To set the database default edition:
Connect to the database as a user with the ALTER
DATABASE
privilege.
Enter the following statement:
ALTER DATABASE DEFAULT EDITION = edition_name;
The database default edition is stored as a database property.
To query the database default edition:
Connect to the database as any user.
Enter the following statement:
SELECT PROPERTY_VALUE FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME = 'DEFAULT_EDITION'; PROPERTY_VALUE ------------------------------ ORA$BASE
Note:
The property nameDEFAULT_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:
If your single-instance database is being managed by Oracle Restart, use the SRVCTL
utility to create 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 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
If your single-instance database is not being managed by Oracle Restart, use the DBMS_SERVICE.CREATE_SERVICE
procedure, and specify the edition
parameter to set the edition attribute of the database service.
You can use the SRVCTL
utility or the DBMS_SERVICE
package to set the edition attribute of an existing database service.
To set the edition attribute of an existing database service:
Stop the database service.
Set the edition attribute of the database service using the appropriate option:
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
If your single-instance database is not being managed by Oracle Restart, use the DBMS_SERVICE.MODIFY_SERVICE
procedure, and specify the edition
parameter to set the edition attribute of the database service. Ensure that the modify_edition
parameter is set to TRUE
when you run the MODIFY_SERVICE
procedure.
Start the database service.
See Also:
Chapter 4, "Configuring Automatic Restart of an Oracle Database" for information managing database services using Oracle Restart
Oracle Database PL/SQL Packages and Types Reference for information about managing database services using the DBMS_SERVICE
package
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;
See Also:
Oracle Database Advanced Application Developer's Guide for more information about using editions, and for instructions for determining the current edition
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. |