DB2 Version 10.1 for Linux, UNIX, and Windows

Changing raw devices to block devices (Linux)

Changing raw (character) devices to block devices on Linux operating systems is required before you upgrade to .

The previous raw I/O method that required binding the block device to a raw (character) device using the raw utility is deprecated since DB2® Version 9.1, and will be removed in a future release of DB2 database product. This raw I/O method is also deprecated in the Linux operating system and will be removed in a future release of Linux.

The block device method uses Direct I/O to achieve an equivalent performance compared to using the raw (character) device method.

Before you begin

Ensure the database is offline in order to relocate the containers or change the log file path.

Restrictions

In a partitioned database environment, the db2relocatedb command must be run against every database partition that requires changes. A different configuration file must be supplied for each database partition, and must include the NODENUM value of the database partition being changed.

If you are restoring from a pre-Version 9.7 backup in DB2 Version 9.7, you must do a redirected restore to indicate block devices instead of raw character devices for your containers and log path.

Procedure

  1. Perform a full offline backup of your database.
  2. Shut down your database. Also consider putting the database in quiesce mode using the QUIESCE DATABASE command as shown in the following example:
       db2 CONNECT TO sample
       db2 QUIESCE DATABASE DEFER FORCE CONNECTIONS
       db2 DEACTIVATE DATABASE database-alias
  3. Use the raw -a system command to see which raw bindings you defined. This information will help you determine the block device you should use to replace a raw device for each container on your table spaces.
  4. Create a configuration file for the db2relocatedb command. Use the clauses CONT_PATH and LOG_DIR to specify the old value with the new value. For example, you can create the moveraw.cfg file with the following content:
       DB_NAME=SAMPLE
       DB_PATH=/databases/SAMPLE
       INSTANCE=db2inst1
       NODENUM=0
       LOG_DIR=/dev/raw/lograw,/dev/sda5
       CONT_PATH=/dev/raw/raw1,/dev/sda1
       CONT_PATH=/dev/raw/raw2,/dev/sda2 
  5. Execute the db2relocatedb command to change the configuration of the database files as shown in the following example:
       db2relocatedb -f moveraw.cfg
  6. Activate your database as shown in the following example:
       db2 ACTIVATE DATABASE database-alias
  7. Test that your database is functioning as expected. Connect to the database and execute queries on tables created on the table spaces that you relocated.
  8. If you put the database in quiesce mode, you can restore the access and activate the database using the UNQUIESCE DATABASE command as shown in the following example:
       db2 CONNECT TO sample
       db2 UNQUIESCE DATABASE