Loading data into Db2
To load data into Db2 on Cloud Pak for Data, the data must be in a location that is visible from within the Db2 container. Supported loading methods differ for the web console and command line.
Web console
The Db2 console allows to load Data from CSV files, Amazon S3, and Cloud Object Storage.
Command line
Loading methods that are supported by commands differ depending on whether you are using traditional storage or software-defined storage such as Red Hat® OpenShift® Data Foundation or Portworx.
- Creating a staging area
- Place the data, for example from flat files, in a folder that is visible under the
System Storage area that you defined when you deployed Db2.
System storage is shared. User data storage is not shared. Inside the Db2 container, the location
for system storage is mounted as /mnt/blumeta0/ and you can create a staging
area by running the following commands:
mkdir /mnt/blumeta0/load chmod 777 /mnt/blumeta0/load
- Using OpenShift to copy data to the staging area
- You can use an OpenShift command to
load data into the staging area. For
example:
oc rsync source-directory db2oltp-1592325602159-db2u-0:/mnt/blumeta0/load
- Using an NFS mount or container-defined storage tools to copy data to the staging area
-
- NFS
- The system storage area, exposed as an NFS persistent volume, can be directly mounted through an NFS mount.
- Portworx
- Portworx has an import command that
loads files into the volume from a directory. You can transfer flat files to the Portworx volume from a directory. The directory
should be accessible by the server where the Portworx volume is located.
For example, the following command imports data from a Portworx volume
myVol
that is located in the /path/to/files directory:pxctl volume import --src /path/to/files myVol
For more information, see Create and manage volumes using pxctl in the Portworx documentation.
- Load copy
- Loaded data is copied by default to the /mnt/bludata0/db2/copy directory inside the Db2 container. After the loading process is completed, you can delete the data from this directory.
For more information, see Loading data in the Db2 documentation.