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.
Prerequisites
■
|
Configure an IBM DB2 database user and group.
|
■
|
Add the database instance registry variables.
|
■
|
Add the client instance registry variable.
|
Procedure
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.
What to do next
Configure a connection to a local or remote database.
***************************************************************************************8
Geodatabases are collections of tables and procedures in a database. Therefore, a database must be created prior to creating a geodatabase.
For DB2, ArcSDE requires the use of a DB2 global temporary table (DECLARE GLOBAL TEMPORARY TABLE). As per DB2 documentation, you must have SYSADMIN or DBADM privileges or have been granted USE privilege on a USER TEMPORARY table space to declare global temporary tables. A user temporary table space can be created using the DB2 Control Center or from the command line using the CREATE USER TEMPORARY TABLESPACE command. Be sure to create the user temporary table space as a system-managed space (SMS).
Tip:
Though you should use SMS for user temporary table spaces, you should use database-managed space (DMS) table spaces for storing user data.
There are many options for table space storage. See the DB2 Information Center topic "Automatic storage table spaces" for more information.
The following steps contain an example script to create a DB2 database, create a user temporary table space, and grant the use of all table spaces to PUBLIC.
Steps:
-
Create a script to create the database.
Note:
The name of a database used to store a geodatabase cannot contain special characters.
The following is an example script. Replace variables such as database name, password names, and container names and paths to match the information needed at your site.
db2 -tvf <script.clp>
FORCE APPLICATION ALL;
DB2STOP;
DB2START;
CREATE DATABASE mysdedb USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM USER TABLESPACE MANAGED BY DATABASE USING (FILE '/db2_data/mysdedb/sdetbsp' 51200);
CONNECT TO mysdedb user db2admin using <your password>;
CREATE REGULAR TABLESPACE regtbs PAGESIZE 4 K MANAGED BY DATABASE USING ( FILE '/db2_data/mysdedb/regtbs' 125000);
CREATE LONG TABLESPACE lobtbs PAGESIZE 4 K MANAGED BY DATABASE USING ( FILE '/db2_data/mysdedb/lobtbs' 51200);
CREATE USER TEMPORARY TABLESPACE sdespace PAGESIZE 4 K MANAGED BY SYSTEM USING ('/db2_data/mysdedb/sdespace' );
GRANT USE OF TABLESPACE regtbs TO PUBLIC;
GRANT USE OF TABLESPACE lobtbs TO PUBLIC;
GRANT USE OF TABLESPACE sdespace TO PUBLIC;
GRANT DBADM ON DATABASE mysdedb TO USER SDE;
UPDATE DATABASE CONFIGURATION FOR mysdedb USING APP_CTL_HEAP_SZ 2048;
UPDATE DATABASE CONFIGURATION FOR mysdedb USING APPLHEAPSZ 2048;
UPDATE DATABASE CONFIGURATION FOR mysdedb USING LOGPRIMARY 10;
FORCE APPLICATION ALL;
DB2STOP FORCE;
DB2START;
-
Create a user temporary table space as a system-managed space (SMS).
For example:
CREATE USER TEMPORARY TABLESPACE sdespace PAGESIZE 4 K MANAGED BY SYSTEM USING ('d:\db2_data\sdespace' );
COMMENT ON TABLESPACE sdespace IS '';
-
Grant the use of all table spaces to PUBLIC.
GRANT USE OF TABLESPACE regtbs TO PUBLIC;
分享到:
相关推荐
describes how to use CLI to create database applications for DB2® for Linux, UNIX, and Windows. Volume 2 is a reference that describes CLI functions, keywords and configuration. The Call Level ...
Create, manage, and alter Db2 database objects Use the partitioning capabilities available within Db2 Enforce constraint checking with the SET INTEGRITY command Utilize the Db2 problem determination ...
CREATE TABLESPACE exoatbs IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8K MANAGED BY SYSTEM USING ('/home/exoa2/exoacontainer') EXTENTSIZE 32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT8K OVERHEAD ...
`CREATE TABLESPACE exoatbs IN DATABASE PARTITION GROUP Ibmdefaultgroup PAGESIZE 8K MANAGED BY SYSTEM USING('/home/exoa2/exoacontainer') EXTENTSIZE 32 PREFETCHSIZE 16 BUFFERPOOL ibmdefault8k OVERHEAD ...
GRANT USE OF TABLESPACE exoatbs TO PUBLIC; 其中,exoatbs是表空间的名称,TO PUBLIC表示授予的对象是公共用户。 创建系统表空间: 系统表空间是Db2数据库中用于存储系统数据的表空间。创建系统表空间可以使用...
6. **创建临时表空间**:`create temporary tablespace temp pagesize 32k managed by database using (file '/home/db2inst1/rdl/data' 5000) extentsize 80 bufferpool testpool`定义了一个名为`temp`的临时表空间...
- `GRANT CREATE TAB, CONNECT ON DATABASE TO USER FUJIE`:授予用户FUJIE创建表和连接数据库的权限。 - `GRANT SELECT, UPDATE, DELETE ON TABLE EMPLOYEE TO USER JOHN WITH GRANT OPTION`:授权JOHN对EMPLOYEE表...
`GRANT CREATE TAB, CONNECT ON DATABASE TO USER FUJIE;` 将创建表和连接到数据库的权限授予用户`FUJIE`。 - **示例** `grant select, update, delete on table employee to user john with grant option;` ...
CREATE TABLESPACE exoatbs IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8K MANAGED BY SYSTEM USING ('/home/exoa2/exoacontainer') EXTENTSIZE 32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT8K OVERHEAD ...
'database' => env('DB2_DATABASE', 'your_database_name'), 'username' => env('DB2_USERNAME', 'your_username'), 'password' => env('DB2_PASSWORD', 'your_password'), 'charset' => 'UTF-8', 'collation' ...
CREATETEMPORARY TABLESPACE exoasystmp IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 8K MANAGED BY SYSTEM USING('/home/exoa2/exoasystmp') EXTENTSIZE 32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT8K ...
CREATE TABLESPACE EXOATBS IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8K MANAGED BY SYSTEM USING('/home/exoa2/exoacontainer') EXTENTSIZE 32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT8K OVERHEAD ...
- 示例:`GRANT CREATE TAB, CONNECT ON DATABASE TO USER FUJIE;` - 示例:`GRANT SELECT, UPDATE, DELETE ON TABLE EMPLOYEE TO USER JOHN WITH GRANT OPTION;` #### 四、数据库参数设置 - **db2set**: 设置或...
CREATE DATABASE arcsde USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM USERTABLESPACE MANAGED BY DATABASE USING (FILE 'd:\db2\arcsde\sde.tbsp' 51200) EXTENTSIZE 16 PREFETCHSIZE 16 OVERHEAD 24.1...
CREATE TABLESPACE [表空间名] IN DATABASE PARTITION GROUP [分区组名] PAGESIZE [页面大小] MANAGED BY SYSTEM USING (['物理路径']) EXTENTSIZE [扩展单元大小] PREFETCHSIZE [预读大小] BUFFERPOOL [缓冲池名] ...
GRANT USE OF TABLESPACE DZHT_L_SPACE TO USER yy_sc; GRANT USE OF TABLESPACE DZHT_L_SPACE TO USER yy_sg; ``` 通过以上步骤,可以完成DB2数据库在AIX系统上的基本搭建,并解决了在创建表空间过程中遇到的...
CREATE TABLESPACE exoatbs IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8K MANAGED BY SYSTEM USING ('/home/exoa2/exoacontainer') EXTENTSIZE 32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT8K OVERHEAD ...
CREATE TABLESPACE exoatbs IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8K MANAGED BY SYSTEM USING ('/home/exoa2/exoacontainer') EXTENTSIZE 32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT8K OVERHEAD ...
**DB2**(Database 2)是IBM开发的一款关系型数据库管理系统,广泛应用于企业和组织的数据管理之中。DB2提供了强大的数据处理能力,并且支持多种操作系统平台。 ### DB2命令概述 #### 连接到DB2数据库 - **`...
- **示例**: `db2 connect to mydb user db2admin using password` #### 2. 创建缓存池(Buffer Pool) - **命令格式**: - `CREATE BUFFERPOOL [缓存池名称] IMMEDIATE SIZE [大小] PAGESIZE [页大小]` - **功能**: ...