zoukankan      html  css  js  c++  java
  • db2新建数据库

    一、建表空间和数据库

    1.在db2ad、db2db和db2ap上均执行:

    [sql] view plaincopyprint?

    1. db2set db2comm=tcpip  
    2. db2set db2codepage=1386  

    db2set db2comm=tcpip

    db2set db2codepage=1386

    2.新建数据库:

    [sql] view plaincopyprint?

    1. db2 create db <dbname> using codeset gbk territory CN collate using identity  

    db2 create db <dbname> using codeset gbk territory CN collate using identity

    3.连接上数据库:

    [sql] view plaincopyprint?

    1. db2 "connect to  <dbname>"  

    db2 "connect to  <dbname>"

    4.创建缓冲池 + 建立表空间;
    1).删除旧的表空间:

    [sql] view plaincopyprint?

    1. db2 drop tablespace  tablespace1, tablespace2, tablespace3  

    db2 drop tablespace  tablespace1, tablespace2, tablespace3

    2).新建缓冲池:

    [sql] view plaincopyprint?

    1. db2 create bufferpool bp32k all nodes size -1 pagesize 32k  

    db2 create bufferpool bp32k all nodes size -1 pagesize 32k

    bp32k为该缓冲池的名称;
    32K为页大小;
    size=-1表示使用缺省的buffpage,而buffpage可以通过db2 get db cfg|grep -i buff参数查看到;
    3).新建表空间:

    [sql] view plaincopyprint?

    1. db2 "create regular tablespace  tablespace1 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace1' 5g) bufferpool bp32k"  
    2. db2 "create regular tablespace  tablespace2 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace2' 10g) bufferpool bp32k"  
    3. db2 "create regular tablespace  tablespace3 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace3' 2g) bufferpool bp32k"  

    db2 "create regular tablespace  tablespace1 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace1' 5g) bufferpool bp32k"

    db2 "create regular tablespace  tablespace2 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace2' 10g) bufferpool bp32k"

    db2 "create regular tablespace  tablespace3 pagesize 32k managed by database using(file '/usr/yixiayizi/tablespace3' 2g) bufferpool bp32k"

    注意(file '/usr/yixiayizi/tablespace1' 5g)的设置:
    第一个参数:
     当指向外置盘时,file改为device;
     当指向文件路径时,为file;
    第二个参数:需要是绝对路径;
    第三个参数:该表空间的大小;

  • 相关阅读:
    canvas游戏开发系列(1):基础知识
    HTML5拖拽实例
    Jfinal 源码分析之拦截器的使用
    jfinal ——AOP面向切面编程
    JFinal框架源码分析(二)——JFinal控制器
    企业级Tomcat部署配置
    KICKSTART无人值守安装
    ELK 企业内部日志分析系统
    全球性WannaCry蠕虫勒索病毒感染前后应对措施
    LAMP架构应用实战—Apache服务介绍与安装01
  • 原文地址:https://www.cnblogs.com/zuo-zijing/p/3965615.html
Copyright © 2011-2022 走看看