Adding multiple databases in a Db2 or Db2 Warehouse deployment
You can run more than one database in a single Db2® deployment on Red Hat OpenShift by using a tool that enables you to add or drop all of the databases under that specific deployment.
About this task
You run the manage_databases
tool after deploying the Db2 service. The following limitations apply:
- A maximum of eight databases are supported.
- All databases share the same Db2 or Db2 Warehouse instance registry and database manager
configuration, and the basic characteristics of all the databases that you create by default use the
settings in the
Db2uCluster
custom resource definition (CRD). But you can specify database-specific customizations by using an option in the tool to override the CRD.
manage_databases
tool must be run under the db2inst1
user ID.manage_databases
tool to add databases to
your existing Db2 or Db2 Warehouse
deployments.Procedure
manage_databases
tool to add or drop databases
within a single Db2 or Db2 Warehouse deployment:
Operation | Command |
---|---|
Add |
You provide a list of database names and use the
|
Drop |
You provide a list of database names and use the
|
To specify a custom configuration for a database, you specify the
--db-cfg-overrides
option followed by list of database-specific overrides in the
following format:
'database1_name:parameter1@value|database2_name:parameter1@value,parameter2@value'
For example, the following command adds the databases mydb1
and
mydb2
to the Db2 or Db2 Warehouse service deployment and specifies custom overrides
that set the LOGARCHMETH1 configuration parameter to OFF for mydb1
and the
DFT_EXTENT_SZ and DBHEAP parameters to 128 and 1500 for mydb2
:
oc exec -it c-db2oltp-1618958410448015-db2u-0 -- manage_databases --dblist "mydb1,mydb2" --db-cfg-overrides "'mydb1:LOGARCHMETH1@OFF|mydb2:DFT_EXTENT_SZ@128,DBHEAP@1500'" --add
You can use the tool to display all databases within the deployment by name, alias, and local
directory from the system database directory by using the --show
or
-s
)option, for example:
oc exec -it c-db2oltp-1619534024988588-db2u-0 -- manage_databases --show
You can use the --verbose
or -v
option at the end of any
command to provide additional debugging information in the output.
The --help
or -h
option provides command help.