シャドー・データ・セット(shadow data sets)
SHRLEVEL REFERENCE または SHRLEVEL CHANGE を用いて REORG ユーティリティーを 実行する場合、ユーティリティーはシャドー・データ・セットを使用します。
ユーザー管理のデータ・セットの場合、SHRLEVEL REFERENCE または SHRLEVEL CHANGE を 用いた REORG を実行する前に、シャドー・データ・セットを事前割り振りしておく必要があります。 表スペース、パーティション、または索引が DB2 管理対象のデータ・セットにあり、さらに REORG の実行時に シャドー・データ・セットがまだ存在していない場合は、DB2 がシャドー・データ・セットを作成し ます。REORG 処理の最後に、DB2 管理対象のシャドー・データ・セットは 削除されます。
http://www.iconocast.com/EB000000000000056/Z0/News6.htm
Title: Method of changing the page size of a db2 table space while keeping the object available
Abstract: Provided is a method for online reorganization and increasing the page size of a DB2 object. A base table and related auxiliary table spaces are reorganized concurrently via a database utility, DB2 REORG utility. The database utility determines which auxiliary tables are related to the base table and automatically includes their respective auxiliary table in the same invocation of the utility. The reorganization is performed via allocated shadow data sets; page size of the allocated shadow data sets is dynamically updated during reorganization. The original data sets are switched with the newly built shadow data sets, and DB2 catalog values and control blocks are updated with new page size values.
SUMMARY OF THE INVENTION
The method of the present invention provides for the reorganization of a table space to improve access performance and reclaim fragmented space. A database reorganization utility (hereafter, DB2 REORG) is utilized to write rows that are added to a designated object, to a larger page. In this manner, the designated object would remain available, would not require recreation, nor would existing DB2 authorizations be deleted. By reorganizing table space such that constituent rows are read from existing pages and then copied to larger pages, which will subsequently be externalized, the requirement to take the designated object offline while changing the page size is obviated. Subsequent to table reorganization, DB2 control blocks along with the DB2 catalog are updated to reflect the change in page size.
An exemplary embodiment comprises the steps of: (a) blocking write access to data being reorganized; (b) identifying object table spaces that are related to the table space being reorganized; (c) concurrently creating a shadow data set for each of the object table spaces and a shadow data set for the table space and associated indexes; (d) loading rows into shadow data sets, and for each row loaded, reading objects from each of object table spaces relating to a loaded row and writing the read object to a corresponding shadow data set; (e) switching original data set with shadow data sets; and (f) allowing write operations related to data being organized to proceed.
In using the DB2 REORG warehouse utility to increase page size, a decrease in performance degradation due to fragmentation is also affected. Database reorganization utilities allow one to rearrange a table in physical storage, thereby eliminating fragmentation and ensuring efficient storage in a database. The DB2 REORG utility is also used to compact data and control the order in which constituent rows of a table are stored, in most cases according to an index value on physically contiguous pages. During the reorganization process, information about the current progress of table reorganization is written to the history file for database activity. The history file contains a record for each reorganization event. Additionally, table snapshots are used to monitor the progress of reorganization. In a production environment, data remains available and users maintain read and write access to a designated table while indices are being rebuilt.
The DB2 REORG utility is such that changes made to an underlying table with the potential to affect indices while the reorganization is in progress, are logged. In addition, changes made during reorganization are placed in internal memory buffer space, if any such memory space exists. The internal memory buffer space is a designated memory area allocated on demand from the utility heap to store the changes to the object being created or reorganized. The use of the memory buffer space allows object reorganization by initially reading directly from memory, and if necessary, by later accessing change logs. Allocated memory is freed upon completion of reorganization. Subsequently, the DB2 reorganization utility processes change logs to maintain current writing activity.
Additionally, the method of the present invention occurs in a single step; as additional data (e.g., rows or columns) are written to an object (e.g., a table) it is also being simultaneously written to a larger page. Data comprising the designated object is therefore available for read access throughout a majority of the process.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21018850/viewspace-1018519/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21018850/viewspace-1018519/