Converting DB2 containers to Quick I/O files

Special commands, available in the /opt/VRTSdb2ed/bin directory, are provided to assist you in converting an existing database to use Quick I/O. You can use the qio_getdbfiles command to extract a list of file names from the database system tables and the qio_convertdbfiles command to convert this list of database files to use Quick I/O.

Note:

Storage Foundation for DB2 does not support Quick I/O for DB2 9.5.

Note:

It is recommended that you create a Storage Checkpoint before converting to or from Quick I/O.

Before converting database files to Ouick I/O files, the following conditions must be met:

Prerequisites

  • Log in as the DB2 instance owner (typically, the user ID db2inst1) to run the qio_getdbfiles and qio_convertdbfiles commands.

  • You must predefine the DB2 environment variable $DB2DATABASE.

  • The SFDB repository must exist before you can convert to Quick I/O files. Run the db2ed_update command to update or create the repository.

  • Files you want to convert must be regular files on VxFS file systems or links that point to regular VxFS files

Usage notes

  • Converting existing database files to Quick I/O files may not be the best choice if the files are fragmented. Use the -f option to determine the fragmentation levels and choose one of two approaches: Either exclude files that are highly fragmented and do not have sufficient contiguous extents for Quick I/O use, or create new files with the qiomkfile command, rather than convert them with the qio_convertdbfiles command.

  • If you choose to create new files, they will be contiguous. You must then move data from the old files to the new files using the DB2 database export/import facility db2move or restore redirect, and then define the new files to the database.

  • qio_getdbfiles skips any tablespaces that have a type of system managed space (SMS), as these tablespaces are based on a directory format and not suitable for conversion.

    The qio_getdbfiles command retrieves a list of database files and saves them in a file named mkqio.dat in the current directory.

  • Instead of using the qio_getdbfiles command, you can manually create the mkqio.dat file containing the DB2 instance filenames that you want to convert to Quick I/O files.

  • The qio_convertdbfiles command exits and prints an error message if any of the database files are not on a VxFS file system. If this happens, you must remove any non-VxFS files from the mkqio.dat file before running the qio_convertdbfiles command.

The following options are available for the qio_getdbfiles command:

-T

Lets you specify the type of database as db2. Specify this option only in environments where the type of database is ambiguous (for example, when multiple types of database environment variables, such as $ORACLE_SID, SYBASE, DSQUERY, and $DB2INSTANCE, are present on a server).

The following options are available for the qio_convertdbfiles command:

-a

Changes regular files to Quick I/O files using absolute path names. Use this option when symbolic links need to point to absolute path names (for example, at a site that uses SAP).

-f

Reports on the current fragmentation levels for database files listed in the mkqio.dat file. Fragmentation is reported as not fragmented, slightly fragmented, fragmented, highly fragmented.

-h

Displays a help message.

-T

Lets you specify the type of database as db2. Specify this option only in environments where the type of database is ambiguous (for example, when multiple types of database environment variables, such as $ORACLE_SID, SYBASE, DSQUERY, and $DB2INSTANCE are present on a server).

-u

Changes Quick I/O files back to regular files. Use this option to undo changes made by a previous run of the qio_convertdbfiles script.

To extract a list of DB2 containers to convert

To convert the DB2 database files to Quick I/O files

  1. Make the database inactive by either shutting down the instance or disabling user connections.

    Warning:

    Running the qio_convertdbfiles command while the database is up and running can cause severe problems with your database, including loss of data and corruption.

  2. Run the qio_convertdbfiles command from the directory containing the mkqio.dat file:

    $ cd /extract_directory 
    $ export DB2DATABASE=database_name
    $ /opt/VRTSdb2ed/bin/qio_convertdbfiles

    The list of files in the mkqio.dat file is displayed. For example:

    file1 --> .file1::cdev:vxfs:
    file2 --> .file2::cdev:vxfs:
    file3 --> .file3::cdev:vxfs:
    file4 --> .file4::cdev:vxfs:
    file5 --> .file5::cdev:vxfs:

    Run the qio_convertdbfiles command (with no options specified) to rename the file filename to .filename and creates a symbolic link to .filename with the Quick I/O extension. By default, the symbolic link uses a relative path name.

    The qio_convertdbfiles script exits and prints an error message if any of the database files are not on a VxFS file system. If this happens, you must remove any non-VxFS files from the mkqio.dat file before running the qio_convertdbfiles command again.

  3. Make the database active again.

    You can now access these database files using the Quick I/O interface.

To undo the previous run of qio_convertdbfiles and change Quick I/O files back to regular VxFS files

  1. If the database is active, make it inactive by either shutting down the instance or disabling user connections.

  2. Run the following command from the directory containing the mkqio.dat file:

    $ cd /extract_directory
    $ export DB2DATABASE=database_name
    $ /opt/VRTSdb2ed/bin/qio_convertdbfiles -u

    The list of Quick I/O files in the mkqio.dat file is displayed. For example:

    .file1::cdev:vxfs: --> file1
    .file2::cdev:vxfs: --> file2
    .file3::cdev:vxfs: --> file3
    .file4::cdev:vxfs: --> file4
    .file5::cdev:vxfs: --> file5

    The qio_convertdbfiles command with the undo option (-u) specified renames the files from <.filename> to <filename> and undoes the symbolic link to .filename that was created along with the Quick I/O files.

More Information

Creating Storage Checkpoints using db2ed_ckptcreate