常用的DB2命令(2)

來源:互聯網
上載者:User

catalog資料庫:
catalog indirect: db2 catalog database on /db2sys[dir_name]
catalog remote:    db2 catalog database as at node    案例:        db2 catalog tcpip node NODESUN remote 192.168.1.1 server 50000 ostype aix        db2 catalog db SUNDB as SUN at node NODESUN
uncatalog資料庫:
db2 uncatalog database

查看本機資料庫最好的辦法:
db2 list db directory on /db2sys[dir_name]

更改DB2歸檔路徑:
db2  update db cfg for cmsdb using LOGARCHMETH1 disk:/home/db2inst1/archlog

查詢DB2下schema:
db2 "select * from sysibm.sysschemata"

db2資料表空間擴充(添加容器):
db2 "alter tablespace USERSPACE1 add (file '/db2data/db2inst1/cmsdb/db2data/userspacefs01/c00000006.LRG' 114688)"



db2做遷移恢複的時候,若從32位到64位執行個體的時候。需要做以下處理:
1、需要先將源端執行個體使用db2iupdt命令將執行個體升級到64位
root>./db2iupdt -w 64 db2inst1
2、對源端資料庫做冷備
3、將源端資料庫執行個體更改為32位
root>./db2iupdt -w 32 db2inst1
4、傳輸備份到目標端
5、在目標端上做恢複並升級資料庫
db2 migrade db sundb

資料庫做遷移後,出現大量的I/O等待,經過分析是db2資料庫的buffer pool設定過小導致,下面提供查詢和更改buffer pool的案例:
db2 connect to sundb
db2 "select bpname,npages from sysibm.sysbufferpools"
db2 "alter bufferpool IBMDEFAULTBP immediate size 10000"
可以參考:http://liqian-84.blog.163.com/blog/static/8813102010101562837232/
設定聯邦資料庫查詢(類似oracle dblink):db2 update dbm cfg using federated yesdb2stopdb2start

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.