Total Pageviews

Sunday 19 July 2015

Oracle Database catbundle.sql

Introduction : A database bundle series is a sequence of patches where each patch in the series includes the contents of the previous patch in the series. That is, the patches are cumulative. Database patches can consist of both code changes (.o files) that are linked into the Oracle Database binary file, and/or database changes (.sql or .plb files) that are loaded into the database after the binary has been patched. Code changes are applied through the OPatch utility, which takes care of archiving the provided .o files into the correct library, and relinking Oracle.

Installation of the database changes is done by catbundle.sql, which takes input from an XML file named bundledata_<bundle series>.xml. This file specifies the particular scripts that need to run for installation or rollback of each patch in the bundle series. The catbundle.sql script is executed as part of the application of a database bundle patch. It loads the script files (.sql, .plb) that are a part of the patch into a database. To minimize the amount of change when applying a bundle patch, the minimum list of scripts are executed. catbundle.sql determines the last bundle applied to the database and executes only the scripts in the patch that have changed since the last bundle patch was applied.


2 catbundle.sql and Patch Apply

During a bundle patch apply, catbundle.sql determines the last bundle in the series that was loaded in the database from information stored in the dba_registry_history view. It processes the information in bundle_data_<bundle series>.xml, which is in each bundle patch. It determines the script files that are to be loaded into the database for both a patch apply and a patch rollback. The patch apply script is then generated to catbundle_<bundle series>_<database SID>_APPLY.<TIMESTAMP>.sql, and the rollback script is generated to catbundle_<bundle series>_<database SID>_ROLLBACK.sql.

After generating both the patch apply and rollback scripts, catbundle.sql automatically runs the patch apply script, which adds a row to dba_registry_history view to document which patch bundle has been applied.


3 catbundle.sql and Patch Rollback

If a bundle patch needs to be rolled back, then catbundle_<bundle series>_<database SID>.sql is executed as part of the rollback. This script reloads all script files that are a part of the bundle series, then adds a row to the dba_registry_history view to indicate a rollback was executed.


4 Files Generated by catbundle.sql

The catbundle.sql and bundledata_<bundle series>.xml files are located in $ORACLE_HOME/rdbms/admin.

For Oracle Database 11.2.0.2 and later releases, the files generated by catbundle.sql are located in $ORACLE_BASE/cfgtoollogs/catbundle. For earlier releases, the generated files are located in $ORACLE_HOME/cfgtools/catbundle.

These include:

catbundle_<bundle series>_<database SID>_APPLY>_ROLLBACK.sql

catbundle_<bundle series>_<database SID>_ROLLBACK.sql

catbundle_<bundle series>_<database SID>_GENERATE_<TIMESTAMP>.log

catbundle_<bundle series>_<database SID>_APPLY_<TIMESTAMP>.log

catbundle_<bundle series>_<database SID>_ROLLBACK_<TIMESTAMP>.log


5 catbundle.sql and dba_registry_history View

catbundle.sql modifies the dba_registry_history view as follows:

Name                               Null?    Type
--------------------------------- ------- ----------------------------
ACTION_TIME                                TIMESTAMP(6)
ACTION                                     VARCHAR2(30)
NAMESPACE                                  VARCHAR2(30)
VERSION                                    VARCHAR2(30)
ID                                                      NUMBER
BUNDLE_SERIES                              VARCHAR2(30)
COMMENTS                                   VARCHAR2(255)

The ID, bundle_series, and comments columns come directly from the bundledata.xml input file. For a given database, the dba_registry_history view provides a log of the bundle patches for which the scripts have been loaded in that database. You can use the following query to report the actions for a given database:
select action_time, action, version, id, comments
  from dba_registry_history
  where bundle_series = '<bundle series>'
  order by action_time;
 
6 catbundle.sql after Database Creation and Upgrade

Execution of catbundle.sql is not always required for new and upgraded databases. The Readme documentation indicates when it is required. However, you can executecatbundle.sql when it is not required so that the new or upgraded database has an updated dba_registry_history table.
Starting with Database 11.2.0.2.0, a dummy catbundle.sql is run at database upgrade and creation time, which creates a dba_registry_history entry with bundle series PSUand ID = "0". Reports that query on this view for the PSU series returns a row for every upgraded and newly created database.

7 Bundle Series

The following table lists current bundle series and their names tracked in the dba_registry_history view.
Table 1 Names of Bundle Series in dba_registry_history view

Bundle Series                                            Name
----------------------------------------------------------------------
Exadata Database Recommended Patches                          EXA
Windows Bundles                                              WINBUNDLE
Critical Patch Updates                                       CPU
Patch Set Updates                                             PSU
Overlay Patch Set Updates                                      OPSU


8 Enterprise Manager Grid Control catbundle.sql Wrapper Scripts

Bundle patches include the wrapper scripts that invoke catbundle.sql, such as catcpu.sql and catcpu_rollback.sql.
These scripts enable Enterprise Manager Grid Control to apply the patch. Customers should not rely on these scripts,
but should directly execute catbundle.sql.

Reference : 605795.1




No comments:

Post a Comment