- IBM DB2 9.7 Advanced Administration Cookbook
- Adrian Neagu Robert Pelletier
- 515字
- 2021-08-20 15:33:24
Removing database partitions
Practically this recipe is linked with the previous one. Here, we will continue to remove the partitions 3
and 4
from the database.
Getting ready
Before deleting a partition, our first concern would be to make sure that the partition contains no data. Therefore, verification will be the first operation to be executed. If database partitions are empty, we can proceed further with removal. In this recipe, we will verify and remove the partitions 3
and 4
, added previously, in the Adding database partitions recipe in this chapter.
How to do it...
You can perform these operations with Control Center or using the command line.
- In Control Center, navigate to instance db2instp, and right-click on Open Database partition servers. Next, right-click on the partition number and choose Drop….
- Follow these steps, as instructed by the wizard:
- Drop Database Partition from Database Partition Groups
- Redistribute Data
- Drop Database Partitions from Instance
In order to remove partitions, we have to switch the current partition to the one that we want to drop. We have the possibility to switch between partitions by setting the DB2NODE
environment variable to the number of partitions. The main reason to use DB2NODE
is that the drop dbpartitionnum verify
command, used for verification, has no option to specify the partition number. Therefore, it must be used on the current node.
- First, issue the
terminate
command to close any remaining backend connection:[db2instp@nodedb21 sqllib]$ db2 terminate DB20000I The TERMINATE command completed successfully. [db2instp@nodedb21 sqllib]$
- Set the current node planned for removal:
[db2instp@nodedb21 sqllib]$ export DB2NODE=3 [db2instp@nodedb21 sqllib]$
- Now, verify that the database partition is empty:
[db2instp@nodedb21 ~]$ db2 "drop dbpartitionnum verify" SQL6034W Database partition "3" is not being used by any databases. [db2instp@nodedb21 ~]$
- The database partition is clear, so we will proceed with dropping partition
3:
[db2instp@nodedb21 ~]$ db2stop drop dbpartitionnum 3 SQL6076W Warning! This command will remove all database files on the node for this instance. Before continuing, ensure that there is no user data on this node by running the DROP NODE VERIFY command. Do you want to continue ? (y/n)y 06/28/2011 16:08:54 2 0 SQL1064N DB2STOP processing was successful. 06/28/2011 16:08:54 1 0 SQL1064N DB2STOP processing was successful. 06/28/2011 16:08:55 4 0 SQL1064N DB2STOP processing was successful. 06/28/2011 16:09:05 3 0 SQL1064N DB2STOP processing was successful [db2instp@nodedb21 ~]$
- Start all the remaining partitions:
[db2instp@nodedb21 sqllib]$ export DB2NODE=0 [db2instp@nodedb21 sqllib]$ db2start
- Repeat steps 1 to 4 to remove database partition
4
. - Finally, the partitions
3
and4
are removed:
[db2instp@nodedb21 sqllib]$ db2 list DBPARTITIONNUMS DATABASE PARTITION NUMBER ---------------------------- 0 1 2 [db2instp@nodedb21 sqllib]$
How it works...
Dropping partitions is very similar to adding partitions. Corresponding entries are removed from db2nodes.cfg
database partition configuration file.
There's more...
After you are sure that your partitions do not contain data you can remove partitions by editing db2node.cfg
.
- DevOps with Kubernetes
- ReSharper Essentials
- DevOps for Networking
- Python深度學習
- Vue.js快速入門與深入實戰(zhàn)
- Banana Pi Cookbook
- 深入淺出RxJS
- 大學計算機基礎(chǔ)(第2版)(微課版)
- 人人都懂設(shè)計模式:從生活中領(lǐng)悟設(shè)計模式(Python實現(xiàn))
- C語言程序設(shè)計
- Visual Basic程序設(shè)計上機實驗教程
- 學習OpenCV 4:基于Python的算法實戰(zhàn)
- 新一代SDN:VMware NSX 網(wǎng)絡(luò)原理與實踐
- QGIS 2 Cookbook
- uni-app跨平臺開發(fā)與應(yīng)用從入門到實踐