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,但如果表空間建立在裸設備上,則要擴沖裸設備空間。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM