如何在 OSX Mavericks 上安装 db2 Express-C 10.1 [英] How do I install db2 Express-C 10.1 on OSX Mavericks

查看:17
本文介绍了如何在 OSX Mavericks 上安装 db2 Express-C 10.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 OSX Mavericks 上安装 db2 Express-C 10.1,但我得到了这里列出的错误:Mac 的 db2 设置

I have attempted to install db2 Express-C 10.1 on OSX Mavericks, but I get the error listed here: db2 setup for Mac

推荐答案

以下是我在 Mac OSX Mavericks 上安装 db2 express C 的步骤.

Here are the steps I did to install db2 express C on Mac OSX Mavericks.

注意:我将所有命令都登录到我自己的用户中;当我需要以其他用户身份运行时,我使用了 sudo.

Note: I did all the commands logged into my own user; when I needed to run as a different user, I used sudo.

  1. 从这里下载 DB2 express C:https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=swg-db2expressc&S_PKG=dlmacosx&S_TACT=100KG31W&lang=en_US&cp=UTF-8&dlmethod=http

双击下载的文件解压并解压.

Double click the downloaded file to untar and unzip it.

使用此命令修改系统参数:

Modify system parameters with this command:

sudo vi/etc/sysctl.conf

并填充此信息:

kern.sysv.shmmax=1073741824
kern.sysv.shmmin=1
kern.sysv.shmmni=4096
kern.sysv.shmseg=32
kern.sysv.shmall=1179648
kern.maxfilesperproc=65536
kern.maxfiles=65536

  • 重启计算机#我非常难过地添加了该指令.

  • reboot computer # with great sadness I added that instruction.

    使用以下命令开始安装过程:
    cd ~/Downloads/expc ;sudo ./db2_install

    Begin the install process with these commands:
    cd ~/Downloads/expc ; sudo ./db2_install

    接受'/opt/IBM/db2/V10.1'的默认路径

    Accept the default path of '/opt/IBM/db2/V10.1'

    等待大约三分钟让脚本运行.

    Wait about three minutes for the script to run.

    请注意,成功运行以执行成功完成"结束.

    Note that a successful run ends in 'The execution completed successfully.'

    使用 mac gui(系统偏好设置 -> 用户和组)创建 db2inst1 用户.使用标准(非管理员)权限.

    create db2inst1 user using mac gui (System Preferences -> Users & Groups). Use Standard (Non-Admin) privileges.

    使用以下命令创建实例:
    cd/opt/IBM/db2/V10.1/instance ;sudo ./db2icrt -u db2inst1 db2inst1

    Create the instance with these commands:
    cd /opt/IBM/db2/V10.1/instance ; sudo ./db2icrt -u db2inst1 db2inst1

    使用以下命令修改您的个人资料:

    Modify your profile with this command:

    vim ~/.bash_profile
    并添加这些行(可能在文件末尾):
    PATH=$PATH:/opt/IBM/db2/V10.1/bin
    如果 [[ -f ~db2inst1/sqllib/db2profile ]]
    然后
    源 ~db2inst1/sqllib/db2profile

    vim ~/.bash_profile
    and add these lines (probably at the end of the file):
    PATH=$PATH:/opt/IBM/db2/V10.1/bin
    if [[ -f ~db2inst1/sqllib/db2profile ]]
    then
    source ~db2inst1/sqllib/db2profile
    fi

    登录新终端窗口以从 .bash_profile 获取新设置.退出旧窗口以避免混淆.

    Log into new terminal window to get new settings from .bash_profile. Exit old windows to avoid confusion.

    使用以下命令初始化示例数据库:
    db2sampl

    Initialize the sample database using this command:
    db2sampl

    使用以下命令启动数据库:
    sudo -u db2inst1 db2start

    Start the database using this command:
    sudo -u db2inst1 db2start

    使用以下命令测试示例数据库:
    db2 连接到 SAMPLE
    db2 列表

    Test the sample database using these commands:
    db2 connect to SAMPLE
    db2 list tables

    如果您需要从远程计算机连接到此数据库,或者想要使用 Java 连接到此数据库,其中连接需要主机和端口号,请按照说明启用删除连接.您可以推迟运行这些指令,直到您真正需要以这种方式进行连接.在不运行这些指令的情况下,您可以使用 db2 命令行进行连接,运行这些指令后,您将能够连接任意数量的需要主机和端口号的工具.

    If you need to connect to this database from a remote machine, or want to connect to this database using Java where the connection requires a host and port number, then follow the instructions to enable remove connections. You can defer running these instructions until you actually need to connect in this fashion. Without running these instructions you can connect using db2 command line, after running these instructions you will be able to connect with any number of tools that require a host and port number.

    1. 使用这些命令更新 db2 以允许远程服务:

    1. Update db2 to allow remote services using these commands:

    cd ~db2inst1

    sudo -u db2inst1 db2 update dbm cfg using svcename db2c_db2inst1

    cd是必要的,因为命令需要写入当前目录.

    The cd is necessary because the command needs to write to the current directory.

    使用此命令添加服务端口:

    Add the service port using this command:

    sudo vim/etc/services

    并将这一行添加为文件的最后一行.实际位置并不重要.

    and add this line as the last line in the file. The actual position is not important.

    db2c_db2inst1 50000/tcp

    使用此命令设置 db2 应使用 tcp/ip:

    Set that db2 should use tcp/ip using this command:

    sudo -u db2inst1 db2set DB2COMM=TCPIP

    使用以下命令停止和启动数据库:

    Stop and start the database with these commands:

    sudo -u db2inst1 db2stop force

    sudo -u db2inst1 db2start

    注意停止命令上的force.这将删除任何现有的连接.如果您想善待已连接的用户,请不要使用强制,只需在要求用户断开连接后继续重试命令即可.我在默认说明中包含了力,因为遵循这些说明的任何人都可能是数据库中唯一的用户.

    Note the force on the stop command. That will drop any existing connections. If you want to be kind to the users who are connected, do not use force and just keep retrying the command after asking the users to disconnect. I included the force in the default instructions because it is likely that anyone following these instructions is the only user on the database.

    参考资料:

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆