Data Source Use of Oracle Edition Based Redefinition (EBR)
- by Steve Felts
Edition-based redefinition is a new feature in the 11gR2 release of the Oracle database. It enables you to upgrade the database component of an application while it is in use, thereby minimizing or eliminating down time. It works by allowing for a pre-upgrade and post-upgrade view of the data to exist at the same time, providing a hot upgrade capability. You can then specify which view you want for a particular session. See the Oracle Database Advanced Application Developer's Guide for further information. There is also a good white paper at Edition Based Definition.
Using this feature of the Oracle database does not require any new WebLogic Server functionality. It is set for each connection in the pool automatically by simply specifying
SQL ALTER SESSION SET EDITION = edition_name
in the Init SQL parameter in the data source configuration. This can be configured either via the console or via WLST (setInitSQL on the JDBCConnectionPoolParams). This SQL statement is executed for each newly created physical database connection.Note that we are assuming that a data source references only one edition of the database.
To make use of this feature, you would have an earlier version of the application with a data source that references the earlier EDITION and a later version of the application with a data source that references the later EDITION. Once you start talking about multiple versions of a WLS application, you should be using the WLS "side-by-side" or "versioned" deployment feature. See Developing Applications for Production Redeployment for more information. By combining Oracle database EBR and WLS versioned deployment, the application can be failed over with no downtime, making the combination of features more powerful than either independently.
There is a catch - you need to be running with a versioned database and a versioned application initially so then you can switch versions. The recommended way to version a WLS application is to simply add the "Weblogic-Application-Version" property in the MANIFEST.MF file(you can also specify it at deployment time). The recommended way to configure the data source is to use a packaged data source descriptor that's stored in the ear or war so that everything is self-contained. There are some restrictions. You can't use a packaged data source with Logging Last Resource (LLR) - you need to use a system resource. You can't use an application-scoped packaged data source with EmulateTwoPhaseCommit for the global-transactions-protocol with a versioned application - use a global scope. See Configuring JDBC Application Modules for Deployment for more details.
There's one known problem - it doesn't work correctly with an XA data source (patch available with bug 14075837).