设为首页 收藏本站
查看: 820|回复: 0

[经验分享] Use a Script to Create a DB2 Database

[复制链接]

尚未签到

发表于 2016-11-16 03:59:46 | 显示全部楼层 |阅读模式
vSphere 4.1 - ESX and vCenter > ESX and vCenter Server Installation Guide > vCenter Server Databases > Configure DB2 Databases


 

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.






Previous topic: Add the Client Instance Registry Variable


Next topic: Use a Script to Create the DB2 Database Schema (Optional)
















Help us improve this information. Send feedback to docfeedback@vmware.com.

 

 

 

***************************************************************************************8

 

Creating a DB2 database on Linux or UNIX

Resource Center » Administrator Library » Administering geodatabases licensed through ArcGIS Server Enterprise » Geodatabases in DB2 » Setting up a geodatabase in DB2 » Setting up a geodatabase on Linux or UNIX




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).

DSC0000.png 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.
    DSC0001.png 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;

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-300787-1-1.html 上篇帖子: db2 原因码为7的解决方案 下篇帖子: DB2的冷备份、在线全备份和在线增量备份
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表