DB2 Server for VM: System Administration


Nonrecoverable Storage Pools

You can define storage pools that are not recoverable. Changes made to user data in nonrecoverable storage pools are not logged, which eliminates much of the overhead required for recovery operations described earlier in this chapter. Recovery is the responsibility of the user.

For some applications, the benefit derived from the reduced overhead far outweighs the effort of having to do your own recovery. The applications that benefit the most are those that do massive updating of a specific set of tables in the database. Such applications include:

If normal recovery procedures were in place, these applications would generate many log records. These not only cause processing overhead, but require a larger log, because the log must be large enough to hold all the records generated during the long-running LUW (along with the records of all other concurrent LUWs). Further, if you use archiving, the increased log activity causes more frequent archives.

For applications that cause excessive logging or archiving, you have two alternatives:

  1. Run the application in single user mode with LOGMODE=N.
  2. Place the tables that the application accesses in dbspaces that are assigned to nonrecoverable storage pools.

The first of these methods is usually preferable. For example, suppose you have an application that loads thousands of new records into an existing table. These records are the names and addresses of subscribers to a new monthly service that your company is offering. The data for new subscribers is loaded into the tables once a month. Between runs, users perform updates on the table using ISQL (for example, changing the address of an existing subscriber).

Now suppose you decide to run the application in single user mode with LOGMODE=N. The advantage is that after the application runs successfully and you create a database archive, the ISQL users have the benefit of full database recovery. The disadvantages are:

  1. You must stop the application server to run in single user mode.
  2. You must create a log or a database archive before running the application, and a database archive afterwards.
  3. If LOGMODE is L, you lose the potential to restore the database to its current level by using a back-level database archive and subsequent log archives, because you have broken the continuity of the log archives.

Consider, though, the alternative of placing the data in a nonrecoverable storage pool. By doing so, you avoid having to create the archives, and you can run the application in multiple user mode and so avoid interrupting other users. However, the data is nonrecoverable. The decision depends on whether your ISQL or DBSU utility users can work without recovery. If the answer is no, or if you are not certain you can foresee all possible recovery situations, use LOGMODE=N instead.

Characteristics of Dbspaces in Nonrecoverable Storage Pools

The following discussion provides the basis for you to determine whether it is feasible to store the data for a given application in a dbspace in a nonrecoverable storage pool, and what recovery procedures you will need for such data.

There is one situation where nonrecoverable and recoverable dbspaces have the same characteristics: when the database manager is running in single user mode with LOGMODE=N. In this situation, for both types of dbspaces, if there is a failure, all updates that were committed at the time of the failure are in the database; all those that were not committed are not. This applies to any ISQL or DBS utility command that updates the database. Note that commitment includes both an explicit COMMIT command and any implicit commitment (as described earlier in this chapter).

In any mode other than LOGMODE=N, the following characteristics apply to nonrecoverable dbspaces:

Data That Can be Placed in Nonrecoverable Storage Pools

When you are considering placing application data in a nonrecoverable storage pool, you must determine whether the user will be able to recover it in a reasonable and relatively simple manner. If so, then the table is a candidate for a nonrecoverable storage pool.

Some examples of such data follow, along with descriptions of how to recover it, based on the rules in the previous section.

Example 1

Some applications use data that is retrieved from a source outside the database, such as data from another DB2 Server for VM or non-DB2 Server for VM database, or data from sequential files (including CMS files and virtual reader files). Such tables are candidates for nonrecoverable storage pools if the following are true:

  1. The data, after being loaded into database tables, is used only for read-only applications.
  2. The data from the outside source is the only data in the tables. (That is, the data was not added to existing tables.)

If the application that loads the data into the database tables fails (does not COMMIT) for any reason, you can recover in either of the following ways:

If, after successfully loading the data, you restore the database from a database archive that was created before the data was loaded, the rows you loaded no longer exist in the database. You can recover as follows:

  1. Bypass any steps that delete all rows from the tables or that drop and recreate the tables.

    These steps are not necessary because the database manager always records DROP and CREATE table statements in the log, even for nonrecoverable dbspaces.

  2. Rerun the steps that load the data into the tables.

    You must redo the data manipulation statements (in this situation, INSERT and PUT) because they are not recorded in the log. (The restore defined the tables in the database, but did not insert any data.)

These recovery rules apply only to data that is imported and loaded once and is discarded when no longer needed. Each time the data is loaded, it completely replaces the previous version.

The key point is that the source data must exist so that it can be used to recover the read-only database version.

Example 2

Data that is retrieved from an outside source and added to existing data can also be stored in a nonrecoverable dbspace.

The data can be from any of the sources described in Example 1 above. To add it to an existing table, you could use the DBS utility DATALOAD command or an application program to perform a mass INSERT operation.

You can recover the data if each batch of added rows has a unique value in a column that identifies rows of the batch. You would need an application program that generates a unique batch identifier and places it into each record (or into each row, if the application loads the rows into a table).

If the application that loads the data fails (does not commit the work) for any reason, you can recover as follows:

  1. Specify the unique values that identify the rows added to the tables.
  2. Delete all the rows in tables that have these unique identifier values. These rows were inserted before the system failed.
  3. Rerun the step that loads the added data into the tables.

Note:Although it is tempting to commit work frequently during loading to avoid potential recovery problems, keep in mind that the commit operations cause checkpoints, which can adversely affect overall performance.

If you restore the database using a database archive that was created before one or more of the load operations, all rows loaded since that archive no longer exist in the database.

To recover those lost rows, either:

  1. Query the tables to determine the last batch of rows inserted that still exist in the database.
  2. Rerun the steps that added all subsequent batches of rows to the tables.

Alternatively:

  1. Delete all the rows that were loaded before the database archive was taken of the tables.
  2. Reload all of the rows from the original source.

Both methods of recovery assume that the loaded data still exists somewhere outside the database, and that each batch of rows has a unique identifier.

Example 3

Read-only data that is created by one or more INSERT via subselect statements can also be stored in a nonrecoverable dbspace. For recovery to be possible, the data must be inserted into empty tables.

If the loading of the table fails to be committed, you can recover the data as follows:

  1. If the LUW created the table:
    1. Recreate the table. (Because CREATE TABLE statements are always recoverable, the table is dropped when the LUW fails.)
    2. Rerun the INSERT via subselect statements to load the data.
  2. If the table already exists:
    1. Delete all the rows from the table, since they reflect an incomplete update.
    2. Rerun the INSERT via subselect statements to load the data.

If you restore the database from a database archive that was created before the data was loaded, the data that was loaded is not in the database. The table is not dropped, however, even if it was created after the archive, because CREATE TABLE statements are always logged. To restore the data that was eliminated by the database restore operation:

  1. If the table was created (or recreated) after the database archive, rerun the INSERT via subselect statements.
  2. If the table was created before the database archive, some rows may also exist in the table. It may be impossible to identify the INSERT via subselect statements that put these rows in the table. Even if you determine the INSERT responsible for a row, it is difficult to tell if all rows originally inserted by the statement still exist. (The statement may have been in progress at the time the database archive was taken.) For this situation:
    1. Delete all rows in the table.
    2. Rerun the INSERT via subselect statements.

Avoid loading (or otherwise updating) nonrecoverable dbspaces if an online database archive could occur at the same time, because such archives typically contain changes made by incomplete LUWs. For recoverable data, this is not a problem because the log contains the rest of the changes, so when you do a restore, the archive and the log are used together to reconstruct a consistent copy of the database. For nonrecoverable data however, changes are not recorded in the log, so data can be incomplete or inconsistent because no log records are available to complete the restoration of the database.

You should also not update nonrecoverable data when an online log archive can occur, because the database manager waits until all LUWs end before creating the log archive. Because LUWs that update nonrecoverable data are usually long-running, the log archive is forced to wait. If the log fills to the SLOGCUSH point, log overflow processing will be started: this involves rolling back the longest-running LUW, which is usually the one that is updating nonrecoverable data. (For a description of the SLOGCUSH parameter, see SLOGCUSH.)

Data That Should Not Be Placed in Nonrecoverable Dbspaces

Any data that would be difficult or impossible for a user to recover should not be put in nonrecoverable dbspaces. Some examples are:

Setting Up Nonrecoverable Storage Pools and Dbspaces

If you want the data for a particular application to reside in a nonrecoverable storage pool, do the following:

  1. Determine the dbspace requirements (size, type, and number).
  2. Design a recovery scheme to use in case an LUW fails while the nonrecoverable dbspaces are being updated.
  3. Design a recovery scheme to use in case restoring the database from an archive should be necessary.
  4. Allocate the nonrecoverable storage pool. You can do this either during database generation, or when adding a dbextent. In either situation, use the POOL control statement (see Adding Dbextents to a Storage Pool).

    Attention: Once a storage pool is defined, either by adding dbextents to it or by POOL(NOLOG), you must not change it from recoverable to nonrecoverable, or the reverse.

  5. Define dbspaces in this storage pool, either during database generation or when adding dbspaces (see Adding Dbspaces to the Database). On your control statements defining the dbspaces, specify the number of the storage pool.
  6. Acquire the dbspaces you want by using the ACQUIRE DBSPACE statement. You must specify the number of the storage pool you want with the STORPOOL parameter; otherwise, the database manager will not select a dbspace from a nonrecoverable storage pool.
  7. Create tables in these dbspaces. To do this, you must specify the dbspace name in the CREATE TABLE statement; otherwise, the database manager will not place a table in a nonrecoverable dbspace.

Remember to perform your recovery procedures whenever there is a LUW failure or when you must restore the database from an archive.

Querying for Nonrecoverable Storage Pools and Dbspaces

To determine whether a storage pool is nonrecoverable, issue the SHOW DBEXTENT operator command. The POOL NO. column shows the number of the pool. If it is positive, the storage pool is recoverable; if negative, it is nonrecoverable. For example, if the number displayed is -32, storage pool 32 is nonrecoverable; if it is 32, this storage pool is recoverable.

To determine what dbspaces are in nonrecoverable storage pools, look at the POOL column in the SYSTEM.SYSDBSPACES catalog table. If this value is positive, the pool where the dbspace is assigned is recoverable; if it is negative, the pool is nonrecoverable. Again, the absolute value of the number is the storage pool number.

Following are some sample queries you can use to determine the status of nonrecoverable storage pools and dbspaces:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]