db2 表空间扩容

DB2表空间扩容

1 - Detect what tablespace has size issues

db2 list tablespaces show detail

2 - Check the percentage of use from the tablespace

 
 
db2 list tablespace containers for <tablespace_id>  show detail

3 - Calculating the size of free space needed

Now you are able to calculate the percentage of use from the tablespace. To get this number, do (Used Pages / Useable Pages) * 100 and then with this percentage you can continue calculating how many pages you need to increase to obtain the acceptable amount of free pages.

4 - Verifying the filesystem and the free space

Continuing, now you should check the total amount of free space at the fileystem. Do this typing

df -k <tablespace.path>

And you'll be able to verify if it's enough space to extend the tablespace. Remember you can check the page size in the output of "db2 list tablespaces show detail" command.

5 - Extending the tablespace

Finally, after all checked, you can execute the command to extend the pages of that tablespace. Do this using:

db2 "alter tablespace <tablespace_name> extend (all <page_numbers>)"

 

This will extend the size of your tablespace. Be careful when using EXTEND ALL clause when the tablespace has more than one container; in cases where the tablespace has more than one container, divide the total number of pages you intent to increase by the number of total containers.

Example:

db2 alter "tablespace IBMDB2SAMPLEREL extend (all 1000)"

Alternatively, if it's not possible to extend the actual containers, a possibility is to add new containers to the tablespace. For that, you should enter the following command:

db2 "alter tablespace <tablespace_name> add (FILE '<new_container_file>' <size>)"

 Where size can be in pages (only using the numbers you want), in KBytes (using a K following the number), in MBytes (using a M following the number) or in GBytes (using a G following the number). Also, please note to use single quotes around the name of the file you'll use as a new container.

 

注意事项:(AIX)

1、hacmp 单点控制的lv操作,有时候出问题,建议在A 机直接扩lv, 在hacmp 切换到B机 hacmp自动importvg 会把lv 信息更新的。

2、扩容操作选择业务空闲时间进行,避免影响正常业务系统操作。

3、扩容前后确认数据库状态是否正常,日志有无报错,系统资源使用率是否正常,无异常报错。

4、表空间扩充还可以通过添加新容器或者改变当前容器大小两种方式来实现,加容器之后DB2会有一个自动balance的过程,可能会持续几个小时,而通过改变容器大小的方式不会触发balance,但如果表空间建立在裸设备上,则要扩冲裸设备空间。

转载于:https://www.cnblogs.com/dahaoran/p/9254763.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值