75 ways to demystify DB2 #76: Techtip : Using Rebalance to Change Storage Path and Move Data
ChunGao 270006J5PY Visits (8260)
In the case customer wants to move the data from the current storage path to another storage path, or, simply wants to add/remove storage path, we can do it by rebalance. Below is an example:
db2 "CREATE DATABASE SAMPLE ON /hom
After the database is created, we can see the database files are created under the DBPATH (/ho
db2 "ALTER DATABASE ADD STORAGE ON '/ho
Now we can see that old container is still under /hom
db2 "SELECT DISTINCT TBSP_ID, VARCHAR(TBSP_NAME, 30) as TBSP_NAME
In this example there are 3 outputs:
3 record(s) selected.
db2 "ALTER TABLESPACE <tablespace_name> REBALANCE"
In this case:
This is a way to add/delete storage path, also it can be used to remove container files from one path to another.