Creating database containers as Quick I/O files using qiomkfile with DB2 databases

You can create Database Managed Space (DMS) containers with the type 'DEVICE' using Quick I/O. The best way to preallocate space for tablespace containers and to make them accessible using the Quick I/O interface is to use the qiomkfile command. You can use the qiomkfile command to create the Quick I/O files for either temporary or permanent tablespaces.

Prerequisites

  • If you are creating containers on an existing file system, run fsadm or a similar utility to report and eliminate fragmentation.

  • You must have read/write permissions on the directory in which you intend to create DB2 Quick I/Ofiles.

Usage notes

  • When you create the DB2 DMS tablespace using a Quick I/O file and the DEVICE container type, you cannot extend the size of the tablespace container.

Warning:

Exercise caution when using absolute path names. Extra steps can be required during database backup and restore procedures to preserve symbolic links. If you restore files to directories different from the original paths, you must change the symbolic links that use absolute path names to point to the new path names before the database is restarted.

To create a container as a Quick I/O file using qiomkfile

  1. Create a Quick I/O-capable file using the qiomkfile command:

      # /opt/VRTS/bin/qiomkfile  -s file_size /mnt1/file1
  2. As the DB2 instance owner, create tablespace containers using the Quick I/O-capable file with the following SQL statements:

      $ db2 connect to database
      $ db2 create tablespace tbsname managed by database using \
      ( DEVICE /mnt1/file1 size )
      $ db2 terminate

The following example shows how to create a 100MB Quick I/O-capable file named dbfile on the VxFS file system /db01 using a relative path name:

  # /opt/VRTS/bin/qiomkfile -s 100m /db01/dbfile
  # ls -al
  -rw-r--r--   1 db2inst1  db2iadm1 104857600  Oct 2 13:42  .dbfile
  lrwxrwxrwx   1 db2inst1  db2iadm1        19  Oct 2 13:42   dbfile ->
  .dbfile::cdev:vxfs:

In the example, qiomkfile creates a regular file named /db01/.dbfile, which has the real space allocated. Then, qiomkfile creates a symbolic link named /db01/dbfile. This symbolic link is a relative link to the Quick I/O interface for /db01/.dbfile, that is, to the .dbfile::cdev:vxfs: file. The symbolic link allows .dbfile to be accessed by any database or application using its Quick I/O interface.

You can then add the file to the DB2 database PROD:

  $ db2 connect to PROD
  $ db2 create tablespace NEWTBS managed by database using \
  ( DEVICE '/db01/dbfile' 100m )
  $ db2 terminate