Use a Script to Create a DB2 Database

 
Use a Script to Create a DB2 Database

When you use a DB2 database with vCenter Server, the database must have certain buffer pools, table spaces, and privileges. To simplify the process of creating the database, you can run a DB2 script.

Configure an IBM DB2 database user and group.

Add the database instance registry variables.

Add the client instance registry variable.

1

Copy the following DB2 script into a text editor and save it with a descriptive filename, such as vcdbcreate.sql.

The script is located in the /<installation directory>/vpx/dbschema/db2_prereq_connection_configuration.txt vCenter Server installation package file.

CREATE DATABASE VCDB 
AUTOMATIC STORAGE YES ON 'C:\' 
DBPATH ON 'C:\' USING CODESET UTF-8 
TERRITORY US 
COLLATE USING SYSTEM PAGESIZE 4096;

UPDATE DB CFG FOR VCDB USING AUTO_MAINT ON;
UPDATE DB CFG FOR VCDB USING AUTO_TBL_MAINT ON;
UPDATE DB CFG FOR VCDB USING AUTO_RUNSTATS ON;
UPDATE DB CFG FOR VCDB USING logprimary 32 logsecond 6 logfilsiz 2048;
UPDATE ALERT CFG FOR DATABASE ON VCDB USING db.db_backup_req SET THRESHOLDSCHECKED YES;
UPDATE ALERT CFG FOR DATABASE ON VCDB USING db.tb_reorg_req SET THRESHOLDSCHECKED YES;
UPDATE ALERT CFG FOR DATABASE ON VCDB USING db.tb_runstats_req SET THRESHOLDSCHECKED YES;

CONNECT TO VCDB;
grant select on sysibmadm.applications to user vcx;
CREATE BUFFERPOOL VCBP_8K IMMEDIATE SIZE 250 AUTOMATIC PAGESIZE 8K;
CREATE LARGE TABLESPACE VCTS_8k PAGESIZE 8K MANAGED BY AUTOMATIC STORAGE EXTENTSIZE 32 OVERHEAD 12.67 PREFETCHSIZE 32 TRANSFERRATE 0.18 BUFFERPOOL VCBP_8K;
CREATE BUFFERPOOL VCBP_16K IMMEDIATE SIZE 250 AUTOMATIC PAGESIZE 16K;
CREATE LARGE TABLESPACE VCTS_16k PAGESIZE 16K MANAGED BY AUTOMATIC STORAGE EXTENTSIZE 32 OVERHEAD 12.67 PREFETCHSIZE 32 TRANSFERRATE 0.18 BUFFERPOOL VCBP_16K;
CREATE BUFFERPOOL VCBP_32K IMMEDIATE SIZE 250 AUTOMATIC PAGESIZE 32K;
CREATE LARGE TABLESPACE VCTS_32k PAGESIZE 32K MANAGED BY AUTOMATIC STORAGE EXTENTSIZE 32 OVERHEAD 12.67 PREFETCHSIZE 32 TRANSFERRATE 0.18 BUFFERPOOL VCBP_32K;
CREATE TABLESPACE SYSTOOLSPACE IN IBMCATGROUP MANAGED BY AUTOMATIC STORAGE EXTENTSIZE 4;
CREATE USER TEMPORARY TABLESPACE SYSTOOLSTMPSPACE IN IBMCATGROUP MANAGED BY AUTOMATIC STORAGE EXTENTSIZE 4;
CREATE SYSTEM TEMPORARY TABLESPACE VCTEMPTS_8K PAGESIZE 8K MANAGED BY AUTOMATIC STORAGE BUFFERPOOL VCBP_8K;
CREATE SYSTEM TEMPORARY TABLESPACE VCTEMPTS_16K PAGESIZE 16K MANAGED BY AUTOMATIC STORAGE BUFFERPOOL VCBP_16K;
CREATE SYSTEM TEMPORARY TABLESPACE VCTEMPTS_32K PAGESIZE 32K MANAGED BY AUTOMATIC STORAGE BUFFERPOOL VCBP_32K;

GRANT USE OF TABLESPACE VCTS_16K TO USER vcx WITH GRANT OPTION;
GRANT USE OF TABLESPACE VCTS_32K TO USER vcx WITH GRANT OPTION;
GRANT USE OF TABLESPACE VCTS_8K TO USER vcx WITH GRANT OPTION;

commit work;
connect reset; 
terminate;
2

Customize the following values in the script.

Database name: VCDB. You must use the same value for the ODBC setup.

Database path: C:\ for Microsoft Windows, or a UNIX path with sufficient permissions.

User name: vcx. You must use the same value for the ODBC setup.

Do not modify the script in any other way. Changing the setup for table spaces or buffer pools might prevent successful installation of vCenter Server.

3

Run the script in a DB2 Command window.

db2 -svtf vcdbcreate.sql

You now have a DB2 database that you can use with vCenter Server.

Configure a connection to a local or remote database.

猜你喜欢

转载自hai0378.iteye.com/blog/1870568