Db2

Db2

Where DBAs and data experts come together to stop operating and start innovating. Connect, share, and shape the AI era with us.


#Data


#Data
#Databases
#Operatingsystems
#Db2
#Databasesolutions
 View Only
  • 1.  Docker image with DB2

    Posted 03/17/20 09:38 AM
    Edited by System Admin 01/20/23 04:34 PM
    Hello,

    I'm trying to Dockeraize a DB2 database that is already running in a server.

    It's fine when I run an empty DB and then I import the schemas manually but I'm having problems generating an image from that container.
    I exported all the schemas from my actual db on .sql extension files. Then I created the schemas manually and I imported all .sql files to my new db running in the container, at this point the DB is fine as I expexted but I would like to generate a new image from that container. I tried to execute a docker commit command with the container but when I run the new image it doesn't work.

    There is the output from the container:

    (*) Creating instance ...
    DB2 installation is being initialized.
    
     The home directory "/database/config/db2inst1" does not exist for the user name
    "db2inst1". Create the specified home directory, and re-run the command.
    
    A major error occurred during the execution that caused this program to
    terminate prematurely. If the problem persists, contact your technical service
    representative.
    
    For more information see the DB2 installation log at "/tmp/db2icrt.log.44".
    DBI1446I  The db2icrt command is running.
    
    
    DBI1264E  This program failed. Errors encountered during execution were
          written to the installation log file. Program name:
          db2icrt. Log file name: /tmp/db2icrt.log.44.
    
    Explanation:
    
    This message is returned when some processes and operations have failed.
    Detailed information about the error was written to the log file.
    
    User response:
    
    Contact IBM support to get assistance in resolving this issue. Keep the
    log file intact as this file is an important reference for IBM support.
    
    
       Related information:
       Contacting IBM Software Support
    
    
    (!) There was a problem configuring the instance. Copying over logs and traces to /database/config ...
    
    
                  _______   D B 2  S u p p o r t   ______
    
    
    This program generates information about a DB2 server, including information
    about its configuration and system environment. The output of this program
    is stored in a file named 'db2support.zip'. If possible, run this program
    while the problem is occurring.
    
    
    For the most complete output, this utility should be invoked with root
    authority. Users with more limited privileges on the system can run this tool,
    however, some of the data collection actions will result in reduced reporting
    and reduced output.
    
    Output file is "/database/config/db2icrt/db2support.zip"
    Time and date of this collection: 2020-03-16-18.13.10.252372
    
    Creating directory /database/config/db2icrt/DB2SUPPORT
    Starting collection on host 6519436e59cb
     Creating directory /database/config/db2icrt/DB2SUPPORT/6519436e59cb_IIH
    Collecting resources group information
       The following file was not found or could not be executed during diagnostic
       data collection: /usr/bin/lssam
       The following file was not found or could not be executed during diagnostic
       data collection: /usr/bin/lsrsrc
       The following file was not found or could not be executed during diagnostic
       data collection: /usr/bin/lsrsrc
    Collecting user identity information
    Collecting current process information
    Collecting active interprocess communications facilities information
    Collecting system information
    Collecting detailed data on system and hardware errors
       The following file was not found or could not be executed during diagnostic
       data collection: /usr/bin/errpt
    Collecting registry contents
    Collecting GPFS information
       The following file was not found or could not be executed during diagnostic
       data collection: /usr/lpp/mmfs/bin/gpfs.snap
    Collecting configuration, log and trace information for RSCT
       The following file was not found or could not be executed during diagnostic
       data collection: /usr/bin/ctsnap
    Collecting information about installed DB2 products
    Collecting information about state of db2 instance
    Collecting information about DB2 product prerequisites
    Collecting /etc/services
    Collecting /tmp/db2icrt.log.44
    Collecting /tmp/db2icrt_local.log.1290
    Collecting /tmp/db2icrt.log.74
    Collecting /tmp/db2icrt.log.749
    Collection on host 6519436e59cb completed
    Compressing files in /database/config/db2icrt/DB2SUPPORT directory
    Collecting /database/config/db2icrt/db2support.log
    Collecting db2support.out
    
    
    db2support is now complete.
     An archive file has been produced: "/database/config/db2icrt/db2support.zip"
    
    "15" warnings found during db2support collection​

    Is that the way to do that or I'm missing something?

    I just pulled the image with docker pull ibmcom/db2.

    Many thanks!

    ------------------------------
    Raul Maza
    ------------------------------
    #Db2


  • 2.  RE: Docker image with DB2

    Posted 03/18/20 03:25 AM
    Hi,

    the official ibm db2 image has some persistent volumes / bind mounts. With docker commit command you are only persisting the non persistent layers / thin-rw layers layers. e.g. /opt is now within your new committed image, but /database is not (its a persistent volume).  therefore you get the error above, trying to find the instance owners home, which is not there yet. 

    look for volumes in your old container (docker inspect / the folder you set with the -v paramter), copy the data within that volume/folder to a new one and restart your new container with that volume mapping to /database (docker run ... -v myNewVol:/database .... my_registry/my_db2_image).


    ------------------------------
    Markus Fraune
    ------------------------------



  • 3.  RE: Docker image with DB2

    Posted 03/18/20 02:37 PM
    Hi Markus,

    thats completly right, commit doesn't persist volumes.

    Thank you master!

    ------------------------------
    Raul Maza
    ------------------------------