DB2 v9.7 database instance creation



NOTE: Click Here for DB2 Augmenting/Configuring to create the DB instance specific to Websphere Portal (where it require to additional tablespaces for JCR …etc specific to WebSphere Portal) .

Following describes how to create a simple database instance  using the "DB2 first steps" wizard.

 

Following wizard allows to configure new DB database , allocate diskspace, notification, maintenance strategry and performances options . Give the DB2 database name


You can specify the storage space (Look at appendix below to resolve the problem while changing storage path )


You can specify maintenance strategy  ( It is good to run the "RUNSTATS" periodically to calculate the table sizes … that will improve the overall DB performance )
 

Optionally , To enable the DB health notifications you can specify the unauthenticated SMTP server details






 Following commands gets execute at backend

CREATE DATABASE RELDB AUTOMATIC STORAGE YES ON 'C:\';
UPDATE DB CFG FOR RELDB USING AUTO_MAINT ON;
UPDATE DB CFG FOR RELDB USING AUTO_TBL_MAINT ON;
UPDATE DB CFG FOR RELDB USING AUTO_RUNSTATS ON;
UPDATE ALERT CFG FOR DATABASE ON RELDB USING db.db_backup_req SET THRESHOLDSCHECKED YES;
UPDATE ALERT CFG FOR DATABASE ON RELDB USING db.tb_reorg_req SET THRESHOLDSCHECKED YES;
UPDATE ALERT CFG FOR DATABASE ON RELDB USING db.tb_runstats_req SET THRESHOLDSCHECKED YES;


Appendix

Changing the default storage path while creating the instance using wizard caused problem like below



SQL's executed for this are

CREATE DATABASE WPS7DB AUTOMATIC STORAGE YES ON 'C:\DB2\wps7db' DBPATH ON 'C:\IBM\DB2';
UPDATE DB CFG FOR WPS7DB USING AUTO_MAINT ON;
UPDATE DB CFG FOR WPS7DB USING AUTO_TBL_MAINT ON;
UPDATE DB CFG FOR WPS7DB USING AUTO_RUNSTATS ON;
UPDATE ALERT CFG FOR DATABASE ON WPS7DB USING db.db_backup_req SET THRESHOLDSCHECKED YES;
UPDATE ALERT CFG FOR DATABASE ON WPS7DB USING db.tb_reorg_req SET THRESHOLDSCHECKED YES;
UPDATE ALERT CFG FOR DATABASE ON WPS7DB USING db.tb_runstats_req SET THRESHOLDSCHECKED YES;


Error Details are :

SQL1052N  The database path "C:\IBM\DB2" does not exist.

Explanation:
The path specified in the "<path>" parameter of the command is not valid. Either there is no path with that name, or a path has been specified when the DB2_CREATE_DB_ON_PATH registry variable is disabled (Windows only).

In a partitioned database environment on Windows or UNIX environments, each node in the partitioned database group must have the same hard drive specification (path) available with usable space for the CREATE DATABASE command to succeed. The hard drive path is specified in the database manager configuration. If DFTDBPATH is left blank the default will be the hard drive path where DB2 is installed on the instance owning machine (db2 installation path).

The command cannot be processed.

User response:

Resubmit the command with the correct database path.

In a partitioned database environment on Windows or UNIX environments, follow the following steps:

*  Determine which hard drive specification (path) is required. The path is specified in the error message.
*  Determine which node/s of the database partition are experiencing the problem. You can usually find this information in the db2diag log file of the instance owning node.
*  Correct the drive problem on the node that is experiencing the problem, or change the drive specification in the database manager configuration so that the same drive is available and has sufficient space on each node of the partitioned database group.
*  Re-issue the command.
*  On Windows if all applications that will access the database are built on at least Version 9 external APIs then the DB2_CREATE_DB_ON_PATH registry variable can be enabled to support a
   path as the database path.

To avoid this problem

  1. stop the database
  2. From the command prompt , run "db2set DB2_CREATE_DB_ON_PATH=YES"
C:\IBM\DB2\BIN>db2set DB2_CREATE_DB_ON_PATH=YES
  1. Now , create the database as in above steps.

Reference

No comments:

Post a Comment