Database Administration Guide

     Previous  Next    Open TOC in new window  Open Index in new window  View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Using DB2

This chapter describes the steps necessary to use a DB2 database with WebLogic Portal, and includes the following sections:

Review this entire chapter and any release notes before proceeding. The tasks in this chapter should be performed by a database administrator.

 


Configuring DB2 Databases

Before proceeding, read Overview of Enterprise-Quality Database Configuration for WebLogic Portal.

The database creation scripts install domain-specific tables. It is recommended that you work with a database administrator to modify the sample scripts, and to create the database users and tablespaces needed for your environment.

Multiple database schemas are required if you have multiple domains, or to run multiple environments using the same DB2 instance (for example, if you want to run development and system test from a single DB2 installation). GroupSpace requires a separate user, as do any additional content management repositories.

Note: To ensure that portal applications run correctly on DB2, you must set some minimum configuration parameters. If you do not, heavy portal activity might exceed database capacity. Use the following settings as guidelines to configure your DB2 database:

To configure a DB2 database:

  1. Be sure to back up your database before installing any new database objects. See your database documentation for details.
  2. Review the provided sample scripts, located in the WL_HOME/portal/db/oracle/admin directory. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the scripts for additional information.
  3. Copy and modify the sample scripts appropriately for your environment to create each of the following database schemas:
    1. Follow the steps in Configuring the Main WebLogic Portal Database to create the main WebLogic Portal user and database objects.
    2. If you want to use GroupSpace, follow the steps in Configuring the GroupSpace Database to create the GroupSpace user and database objects.
    3. If you want to create a separate behavior tracking database, follow the steps in Manually Creating a Separate Database and Database Objects for Behavior Tracking.

 


Configuring the Main WebLogic Portal Database

To configure the main WebLogic Portal database, follow these steps:

  1. If you do not already have an 8K buffer pool to use:
    1. Copy the create_bufferpool.sql script and modify it appropriately for your environment. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the script for additional information.
    2. Connect to the database that you want to work with. For example, from the CLP:
    3. Db2 connect to database user username password password
    4. Run create_bufferpool.sql. For example, from the CLP:
    5. Db2 -tf create_bufferpool.sql -v
    6. Restart your database instance.
  2. If you do not have an existing an 8K temporary tablespace, or you want to a create new 8K temporary tablespace:
    1. Copy the create_temp_tablespace.sql script and modify it appropriately for your environment. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the script for additional information.
    2. Run create_temp_tablespaces.sql. For example, from the CLP:
    3. Db2 -tf create_temp_tablespaces.sql -v
  3. If you do not have existing 4K and 8K regular tablespaces, or you want to a create new regular tablespaces:
    1. Copy the create_tablespace.sql script and modify it appropriately for your environment. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the script for additional information.
    2. Run create_tablespaces.sql. For example, from the CLP:
    3. Db2 -tf create_tablespaces.sql -v
  4. Create the main WebLogic Portal database user:
    1. Copy the create_users.sql script and modify it appropriately for your environment. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the script for additional information.
    2. Run create_user.sql. For example, from the CLP:
    3. Db2 -tf create_user.sql -v

Follow the remaining steps only if you want to create database objects manually rather than using the Configuration Wizard. To perform the remaining steps using the Configuration Wizard, see Creating WebLogic Configurations Using the Configuration Wizard.

  1. Open your domain's database.properties file for edit.
  2. Set database=db2.
  3. Update the following settings (by replacing the @ symbols and the text between the symbols with the correct values) for your main WebLogic Portal database:
  4. db2.user=@DB_USER@
    db2.password=@DB_PASSWORD@
    db2.url=jdbc:bea:db2://@DB_HOST@:@DB_PORT@;DatabaseName=@DB_NAME@
  5. Create the database objects.
    1. Navigate to the BEA_HOME\user_projects\domains\myPortalDomain directory.
    2. Enter one of the commands:
      • On Windows, double-click create_db.cmd.
      • On UNIX, run create_db.sh.
      • If any error messages are displayed, check the create_db.log file for additional information.

  6. Replace the JDBC data sources in your domain (except for appsGroupSpaceDataSource), which point to PointBase by default, with data sources that point to DB2. You can configure them using the WebLogic Server Administration Console or choose from the samples provided and update them for your database environment. Sample jdbc.xml definition files for each database and driver that BEA supports are available in the WL_HOME\portal\db\jdbc\database_driver directory; for example, db2_bea. Follow the instructions in the WL_HOME\portal\db\jdbc\README.txt file.

 


Configuring the GroupSpace Database

To configure the GroupSpace database, follow these steps:

  1. If you do not already have an 8K buffer pool to use:
    1. Copy the create_bufferpool.sql script and modify it appropriately for your environment. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the script for additional information.
    2. Connect to the database that you want to work with. For example, from the CLP:
    3. Db2 connect to database user username password password
    4. Run create_bufferpool.sql. For example, from the CLP:
    5. Db2 -tf create_bufferpool.sql -v
    6. Restart your database instance.
  2. If you do not have an existing an 8K temporary tablespace, or you want to a create new 8K temporary tablespace:
    1. Copy the create_temp_tablespace.sql script and modify it appropriately for your environment. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the script for additional information.
    2. Run create_temp_tablespaces.sql. For example, from the CLP:
    3. Db2 -tf create_temp_tablespaces.sql -v
  3. If you do not have existing 4K and 8K regular tablespaces, or you want to a create new regular tablespaces:
    1. Copy the create_tablespace.sql script and modify it appropriately for your environment. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the script for additional information.
    2. Run create_tablespaces.sql. For example, from the CLP:
    3. Db2 -tf create_tablespaces.sql -v
  4. Create the GroupSpace user:
    1. Copy the create_users.sql script and modify it appropriately for your environment and the GroupSpace settings. See Table 8-1, Database Scripts and Usage Notes, on page 8-8 and the comments in the script for additional information.
    2. Run create_user.sql. For example, from the CLP:
    3. Db2 -tf create_user.sql -v

Follow the remaining steps only if you want to create database objects manually rather than using the Configuration Wizard. To perform the remaining steps using the Configuration Wizard, see Creating WebLogic Configurations Using the Configuration Wizard.

  1. Open your domain's groupspace_database.properties file for edit.
  2. Set database=db2.
  3. Update the following settings (by replacing the @ symbols and the text between the symbols with the correct values) for your GroupSpace database:
  4. db2.user=@DB_USER@
    db2.password=@DB_PASSWORD@
    db2.url=jdbc:bea:db2://@DB_HOST@:@DB_PORT@;DatabaseName=@DB_NAME@
  5. Create the database objects.
    1. Navigate to the BEA_HOME\user_projects\domains\myPortalDomain directory.
    2. Enter one of the commands:
      • On Windows:
      • create_db.cmd -database.properties=groupspace_database.properties
      • On UNIX:
      • create_db.sh -database.properties=groupspace_database.properties

        If any error messages are displayed, check the create_db_groupspace.log file for additional information.

  6. Replace the appsGroupSpaceDataSource JDBC data source (which points to PointBase by default) with a data source that points to DB2. Use the WebLogic Server Administration Console or update the sample jdbc.xml definition file provided for each database and driver that BEA supports, in the WL_HOME\portal\db\jdbc\database_driver directory; for example db2_bea. Follow the instructions in the WL_HOME\portal\db\jdbc\README.txt file.

 


Manually Creating a Separate Database and Database Objects for Behavior Tracking

For improved performance, you might want to store behavior tracking events in a different location from other WebLogic Portal database objects. For more information about behavior tracking, see Setting Up Events and Behavior Tracking in the Interaction Management Guide.

Note: By default, behavior tracking database objects are created in the same database as other WebLogic Portal database objects. You need to perform these steps only if you are configuring a separate database for behavior tracking events.

To create a separate database for behavior tracking:

  1. Edit the bt_create_tablespaces.sql file and the bt_create_users.sql file for your environment, as indicated in the instructions contained in the scripts and in Table 8-1, Database Scripts and Usage Notes, on page 8-8.
  2. From the CLP, run the bt_create_tablespaces.sql script. For example:
  3. Db2 -tf bt_create_tablespaces.sql -v

  4. From the CLP, run the bt_create_users.sql script. For example:
  5. Db2 -tf bt_create_users.sql -v

  6. Navigate to the appropriate database directory based on your environment: WL_HOME\portal\db\db2
  7. Connect as the user WEBLOGIC_EVENT and run the following scripts:
    • bt_create_tables.sql
    • bt_create_fkeys.sql
    • bt_create_indexes.sql
    • bt_create_triggers.sql
  8. Run the following scripts from the path WL_HOME\portal\db\data\required:
    • bt_insert_system_data.sql
    • bt9_insert_system_data.sql
  9. Use the WebLogic Server Administration Console to configure a non-XA JDBC data source to access your behavior tracking database. Associate the JNDI name p13n.trackingDataSource with that data source and then remove p13n.trackingDataSource from p13nDataSource.

 


Database Scripts and Usage Notes

Table 8-1 describes the scripts that enable you to configure the Oracle database and create WebLogic Portal objects in that database.

Table 8-1 Database Scripts and Usage Notes 
Script Name
Description
create_user.sql
Grants DB2 createtab, bindadd, and connect privileges to the schema owner user.
Because IBM DB2 databases authenticate users using the operating system, you must create an operating system user that owns database schema objects.

Note: Make a copy of this script and edit it to replace <<WEBLOGIC>> with the schema user name.

For the main WebLogic Portal database, the schema user name is typically WEBLOGIC.

Note: To use GroupSpace, you must create an additional user.

For the GroupSpace database, the schema user name is typically WEBLOGIC_GROUPSPACE.

Note: If you decide to create an additional content management repository, you must create a schema with different user names for it. For additional information, see the Content Management Guide.

create_bufferpool.sql
Creates an 8K buffer pool, if one does not already exist. You must stop and restart DB2 to utilize new buffer pools.
Edit the script to change the 8K buffer pool name. The default buffer pool name is BP8K.
create_tablespaces.sql
Creates 4K and 8K regular tablespaces. If you want to use existing regular tablespaces of the correct sizes, you do not need to run this script. You can use new or existing tablespaces for the main WebLogic Portal database, the GroupSpace database, and any additional content management repositories.

Note: Make a copy of this script and edit it to replace <<WEBLOGIC>> with the appropriate tablespace and user names. You must also edit the script to reflect valid disk locations for your environment.

Typical names for the main WebLogic Portal database are:
  • Tablespace for tables with a rowsize smaller than 4K: WEBLOGIC_DATA_4K
  • Tablespace for tables with a rowsize larger than 4K and smaller than 8K: WEBLOGIC_DATA_8K
  • Database user: WEBLOGIC
Typical names for the main GroupSpace database are:
  • Tablespace for tables with a rowsize smaller than 4K: WEBLOGIC_GROUPSPACE_DATA_4K
  • Tablespace for tables with a rowsize larger than 4K and smaller than 8K: WEBLOGIC_GROUPSPACE_DATA_8K
  • Database user: WEBLOGIC_GROUPSPACE
create_temp_tablespaces.sql
Creates an 8K temporary tablespace. If you want to use an existing temporary tablespace of the correct size, you do not need to run this script. You can use new or existing tablespaces for the main WebLogic Portal database, the GroupSpace database, and any additional content management repositories.
The default temporary tablespace name is TEMPSPACE_8K.

Note: Edit this script to use the correct buffer pool name. You must also edit the script to reflect valid disk locations for your environment.

statistics_build.sql
Builds a file of runstats commands for each table that will compute database statistics needed for the database optimizer. Update statistics periodically and whenever any significant changes in database data occur.
install_report.sql
Builds an informational installation report about the database objects created in the WEBLOGIC schema.
bt_create_tablespace.sql
Creates the WEBLOGIC_EVENT_DATA tablespace.

Note: Edit the script to specify valid physical disk locations for your environment (event_container), and to use a buffer pool other than the DB2 default buffer pool.

bt_create_users.sql
Creates the WEBLOGIC_EVENT schema owner user and grants DB2 createtab, bindadd, and connect privileges to the schema owner user.
Because IBM DB2 databases authenticate users using the operating system, you must create an operating system user that owns database schema objects.
Edit the script to change the schema user name and system administrator password.
The default schema owner user name is WEBLOGIC_EVENT.


  Back to Top       Previous  Next