When you create a database in the partitioned database environment, you can specify a drive letter for the create database command to indicate where the database is to be created.
|Note:||You do not set database drive mapping for single-partition database environments.|
When the create database command runs, it expects that the drive that you specify will be simultaneously available to all the machines that participate in the instance. Because this is not possible, DB2 uses database drive mapping to assign the same drive a different name for each machine.
For example, assume that a DB2 instance called DB2 contains two database partition servers:
NODE0 is active on machine WOLF_NODE_0 NODE1 is active on machine WOLF_NODE_1
Also assume that the share disk E: belongs to the same group as NODE0, and that the share disk F: belongs to the same group as NODE1.
To create a database on the share disk E:, the create database command would be as follows:
db2 create database mppdb on E:
For the create database command to be successful, drive E: must be available to both machines. In a mutual takeover configuration, each database partition server may be active on a different machine, and the cluster disk E: is only available to one machine. In this situation, the create database command will always fail.
To resolve this problem, the database drive should be mapped as follows:
For NODE0, the mapping is from drive F: to drive E: For NODE1, the mapping is from drive E: to drive F:
Any database access for NODE0 to drive F: is then mapped to drive E:, and any database access for NODE1 to drive E: is mapped to drive F:. Using drive mapping, the create database command will create database files on drive E: for NODE0 and drive F: for NODE1.
Use the db2drvmp command to set up the drive mapping. The command is as follows:
The parameters are as follows:
If you wanted to set up database drive mapping from F: to E: for NODE0, you would use the following command:
db2drvmp add 0 F E
|Note:||Database drive mapping does not apply table spaces, containers, or any other database storage objects.|
Similarly, to set up database drive mapping from drive E to drive F for NODE1, you would issue the following command:
db2drvmp add 1 E F
|Note:||Any setup of, or changes to, database drive mapping do not take effect immediately. To activate the database drive mapping, use the Cluster Administrator tool to bring the DB2 resource offline, then online.|
When a database is created on a machine that has database drive mapping in effect, the map is saved on the drive in a hidden file. This is to prevent the database drive from being removed after the database is created. To reconcile the map, run the db2drvmp reconcile command for each database partition server that contains the database. (A situation in which you would want to reconcile the database drive mapping would be if you accidentally dropped the database drive map.) The command syntax is as follows:
The parameters are as follows:
The db2drvmp command scans all drives on the machine for database partitions that are managed by the database partition server, and reapplies the database drive mapping to the registry as required.
[ DB2 List of Books | Search the DB2 Books ]