添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
精彩文章免费看

docker安装db2

1、查询可安装的db2镜像

这里是单机安装,直接安装db2express-c,介绍网址 : libmcom / db2express-c

    docker search db2express-c
  • -p 50000:50000 允许远程的客户端可以从50000 端口连接到数据库实例.
  • 通过指定 -e DB2INST1_PASSWORD=db2root-pwd 参数, 你可以为缺省的Db2实例用户db2inst1设置密码.注意:这里“DB2INST1”是用户名,而“b2root-pwd”是密码。
  • 通过指定-e LICENSE=accept参数, 表示你接受了使用Db2软件的许可证协议.
  • 有教程说要添加 --network=host ,我在添加后各种莫名的报错╮(╯▽╰)╭

    4、切换用户并运行DB2

        $ su - db2inst1     //切换用户
        $ db2start          //启动DB2
        $ db2sampl          //创建默认数据库“SAMPLE”
    

    5、常用命令

        db2 create db [dbname] #创建数据库 
        db2 list db directory #列出所有数据库 
        db2 list active databases #列出所有激活的数据库 
        db2 get db cfg #列出所有数据库配置 
    

    6、遇到的坑

    1.DB2 启动SQL5043N
    

    解决方案: DB2 启动SQL5043N

    官方解答: infocenter答案

    [db2inst1@connections ~]$ db2level

    DB21085I This instance or install (instance name, where applicable:
    "db2inst1") uses "64" bits and DB2 code release "SQL10014" with level
    identifier "0205010E".
    Informational tokens are "DB2 v10.1.0.4", "s140509", "IP23584", and Fix Pack
    Product is installed at "/opt/ibm/db2/V10.1".

    [db2inst1@connections ~]$ db2start
    08/20/2014 22:19:54 0 0 SQL5043N Support for one or more communications protocols specified in the DB2COMM environment variable failed to start successfully. However, core database manager functionality started successfully.
    SQL1063N DB2START processing was successful.

    [db2inst1@connections ~]$ db2set DB2COMM=tcpip
    

    [db2inst1@connections ~]$ db2stop
    2014-08-20 22:21:17 0 0 SQL1064N DB2STOP processing was successful.
    SQL1064N DB2STOP processing was successful.

    [db2inst1@connections ~]$ db2start
    08/20/2014 22:21:20 0 0 SQL5043N Support for one or more communications protocols specified in the DB2COMM environment variable failed to start successfully. However, core database manager functionality started successfully.
    SQL1063N DB2START processing was successful.

    [db2inst1@connections ~]$ db2 get dbm cfg

    这里重点看SVCENAME属性,修改命令:db2 update dbm cfg using SVCENAME 50000
    

    [db2inst1@connections ~]$ db2 update dbm cfg using SVCENAME 50000
    DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
    successfully.

    [db2inst1@connections ~]$ db2stop
    2014-08-20 22:22:07 0 0 SQL1064N DB2STOP processing was successful.
    SQL1064N DB2STOP processing was successful.

    [db2inst1@connections ~]$ db2start
    08/20/2014 22:22:11 0 0 SQL1063N DB2START processing was successful.
    SQL1063N DB2START processing was successful.

    [db2inst1@connections ~]$ db2 get dbm cfg | grep SVCENAME
    TCP/IP Service name (SVCENAME) = 50000
    SSL service name (SSL_SVCENAME) =

    7、参考文章

    1.Docker中安装DB2的详细教程和DBVisualize的安装教程

    2.DB2 启动SQL5043N