db2 扩表空间 联合数据库

一、扩表空间

load from /db2_backup/info.ixf of ixf terminate into info nonrecoverable

 

db2 connect to bpfdb user db2admin using db2admin
db2 list tablespaces show detail


db2 list tablespace containers for 9 show detail


DB2Server:#db2 list tablespace containers for 9 show detail

            Tablespace Containers for Tablespace 9

 Container ID                         = 0
 Name                                 = /dev/rdb2temp1lv
 Type                                 = Disk
 Total pages                          = 262144
 Useable pages                        = 262112
 Accessible                           = Yes
 Container ID                         = 1
 Name                                 = /dev/rdb2temp2lv
 Type                                 = Disk
 Total pages                          = 262144
 Useable pages                        = 262112
 Accessible                           = Yes

显示TEMPSPACE表空间有两个容器/dev/rdb2temp1lv和/dev/rdb2temp2lv

lsvg db2vg ,得到PP SIZE: 256 megabyte(s),因此1G空间需要4个PP。

extendlv db2temp1lv 4
extendlv db2temp2lv 4

alter tablespace tempspace extend(device '/dev/rdb2temp1lv' 1G,device '/dev/rdb2temp2lv' 1G)

 

二、 联合数据库


    1、连接业务数据库,打开数据库管理器的联合(federated)属性
        db2
        db2 =>update dbm cfg using federated YES
        db2 =>db2stop force
        db2 =>db2start

    2.编目数据库

        db2 =>catalog tcpip node dbnode remote ip server 50000
        db2 =>catalog db platform as platform  at node dbnode

    3.登陆业务数据库
        db2 =>connect to platform user db2admin using 123

    4.建立db2(drda)包装器
        db2 =>create wrapper drda

    5.建立远程服务器(svr_dc)指向远程的数据源(数据中心DB),同时指定远程的验证信息(user:db2admin pwd:123),登陆和密码根据实际修改
        db2 =>create server svr_y type db2/aix version 8.2 wrapper drda authorization "db2admin" password "123" options(dbname 'platform')

    6.建立本地用户至远程登陆的映射,登陆和密码根据实际修改
        db2 =>create user mapping for "xxx" server svr_y options (remote_authid 'db2admin' , remote_password '123')

 

CREATE NICKNAME "XXX"."T_USER_LNK" FOR "SVR_Y"."DB2ADMIN"."T_USER";

你可能感兴趣的:(db2)