如何在OSX Mavericks上安装db2 Express-C 10.1 ?

时间:2021-10-11 09:11:40

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

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

2 个解决方案

#1


12  

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

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

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

注意:我将所有的命令都记录到我自己的用户中;当我需要作为一个不同的用户运行时,我使用了sudo。

Steps:

  1. Download DB2 express C from here: 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

    从这里下载DB2 express C: https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?

  2. Double click the downloaded file to untar and unzip it.

    双击下载的文件,将其解压缩。

  3. Modify system parameters with this command:

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

    sudo vi /etc/sysctl.conf

    sudo vi /etc/sysctl.conf

    and populate with this information:

    用这些信息填充:

    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
    
  4. reboot computer # with great sadness I added that instruction.

    重新启动计算机#和巨大的悲伤,我添加了那个指令。

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

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

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

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

  7. Wait about three minutes for the script to run.

    等待脚本运行3分钟。

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

    注意,成功的运行结束在“执行成功完成”。

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

    使用mac gui创建db2inst1用户(系统首选项——>用户和组)。使用标准(非管理)的特权。

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

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

  11. Modify your profile with this command:

    使用以下命令修改您的配置文件:

    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

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

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

    登录到新的终端窗口,从.bash_profile获得新的设置。退出旧窗口以避免混淆。

  13. Initialize the sample database using this command:
    db2sampl

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

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

    使用此命令启动数据库:sudo -u db2inst1 db2start。

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

    使用以下命令测试示例数据库:db2连接到示例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.

如果您需要从远程机器连接到这个数据库,或者希望使用Java连接到这个数据库,其中的连接需要主机和端口号,然后按照说明来启用删除连接。您可以延迟执行这些指令,直到您实际需要以这种方式连接。如果没有运行这些指令,您可以使用db2命令行连接,在运行这些指令之后,您将能够连接任何需要主机和端口号的工具。

Steps to Enable Remote Connections:

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

    使用以下命令更新db2以允许远程服务:

    cd ~db2inst1

    cd ~ db2inst1

    sudo -u db2inst1 db2 update dbm cfg using svcename db2c_db2inst1

    sudo -u db2inst1 db2 update dbm cfg使用svcename db2c_db2inst1。

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

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

  2. Add the service port using this command:

    使用以下命令添加服务端口:

    sudo vim /etc/services

    vim sudo / etc / services

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

    将这一行添加到文件的最后一行。实际情况并不重要。

    db2c_db2inst1 50000/tcp

    db2c_db2inst1 50000 / tcp

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

    设置db2应该使用这个命令使用tcp/ip:

    sudo -u db2inst1 db2set DB2COMM=TCPIP

    sudo -u db2inst1 db2set DB2COMM=TCPIP。

  4. Stop and start the database with these commands:

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

    sudo -u db2inst1 db2stop force

    sudo -u db2inst1 db2stop force。

    sudo -u db2inst1 db2start

    sudo - u db2inst1 db2start

    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.

    注意停止命令的力量。这将删除任何现有的连接。如果您想对连接的用户友好,请不要使用force,并且在请求用户断开连接后继续重新尝试命令。我在默认指令中加入了这个力,因为很有可能,遵循这些指令的任何人都是数据库中唯一的用户。

References:

If you determine improvements to these instructions please post a comment. I will get notified and make the change.

如果你决定对这些指令进行改进,请发表评论。我会得到通知并做出改变。

#2


1  

Excellent instructions Leons! FYI for those who ran into DB2 errors when following his step-by-step and his updated guide for El Capitan, this may help.

优秀的指令莱昂!对于那些在遵循他的步骤和更新的El Capitan指南时遇到DB2错误的人来说,这可能会有帮助。

1) I got the following errors when running the above steps 13 & 14 as db2inst1 (I was not able to run step 13 with my Mac userid, it likely gave some other error regarding userId/password, can't remember):

1)在运行上面的步骤13和14时,我有以下错误:db2inst1(我无法用我的Mac userid运行第13步,它可能会给用户id /密码造成其他错误,不记得):

db2inst1$ db2sampl

db2inst1 db2sampl美元

Starting the DB2 instance... Creating database "SAMPLE"... Attempt to create the database "SAMPLE" failed. SQL1032N No start database manager command was issued. SQLSTATE=57019

启动DB2实例…创建数据库“SAMPLE”……尝试创建数据库“SAMPLE”失败。SQL1032N没有启动数据库管理器命令。SQLSTATE = 57019

'db2sampl' processing complete.

“db2sampl”处理完成。

db2inst1$ db2start

db2inst1 db2start美元

SQL1652N File I/O error occurred.

出现了SQL1652N文件I/O错误。

2) The errors were due to a locking issue that was somehow introduced:

2)错误是由于某种原因导致的锁定问题:

2016-08-02-16.43.26.649406-300 I8390E1394 LEVEL: Error PID : 19747 TID : 4515377152 PROC : db2sysc INSTANCE: db2inst1 NODE : 000 EDUID : 1 EDUNAME: db2sysc FUNCTION: DB2 Common, Generic Registry, GenRegFile::Lock, probe:50 MESSAGE : ECF=0x900001DA=-1879047718=ECF_GENREG_UNABLE_TO_OPEN_LOCK_FILE Unable to open the lock file CALLED : DB2 Common, OSSe, OSSHFile::open RETCODE : ECF=0x90000001=-1879048191=ECF_ACCESS_DENIED Access denied

mso - ascii - font - family: tahoma; mso - hansi - font - family: tahoma; mso - fareast - font - family:宋体;mso - bidi - font - family: " times new roman "; mso - bidi - theme - font: minor - bidi ' > < span

3) Turns out in my ~db2inst1/sqllib there were 2 files that were somehow created under my Mac userid instead of db2inst1, and they were preventing db2inst1 from obtaining the registry lock:

3)在我的~db2inst1/sqllib中,有两个文件是在我的Mac userid下创建的,而不是db2inst1,它们阻止db2inst1获得注册表锁:

-rw-r--r-- 1 myMacUserId staff 0 29 Jul 15:58 .global.reg.lock
-rw-r--r-- 1 myMacUserId staff 90 29 Jul 15:58 global.reg

-rw-r- r- 1 myMacUserId staff 0 29 Jul 15:58 .global.reg。锁定-rw-r- 1 myMacUserId工作人员9029 Jul 15:58 global.reg。

4) Once I deleted these 2 files, DB2 was able to start successfully and create the SAMPLE database. :)

4)一旦我删除了这两个文件,DB2就能够成功启动并创建SAMPLE数据库。:)

#1


12  

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

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

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

注意:我将所有的命令都记录到我自己的用户中;当我需要作为一个不同的用户运行时,我使用了sudo。

Steps:

  1. Download DB2 express C from here: 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

    从这里下载DB2 express C: https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?

  2. Double click the downloaded file to untar and unzip it.

    双击下载的文件,将其解压缩。

  3. Modify system parameters with this command:

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

    sudo vi /etc/sysctl.conf

    sudo vi /etc/sysctl.conf

    and populate with this information:

    用这些信息填充:

    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
    
  4. reboot computer # with great sadness I added that instruction.

    重新启动计算机#和巨大的悲伤,我添加了那个指令。

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

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

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

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

  7. Wait about three minutes for the script to run.

    等待脚本运行3分钟。

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

    注意,成功的运行结束在“执行成功完成”。

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

    使用mac gui创建db2inst1用户(系统首选项——>用户和组)。使用标准(非管理)的特权。

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

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

  11. Modify your profile with this command:

    使用以下命令修改您的配置文件:

    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

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

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

    登录到新的终端窗口,从.bash_profile获得新的设置。退出旧窗口以避免混淆。

  13. Initialize the sample database using this command:
    db2sampl

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

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

    使用此命令启动数据库:sudo -u db2inst1 db2start。

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

    使用以下命令测试示例数据库:db2连接到示例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.

如果您需要从远程机器连接到这个数据库,或者希望使用Java连接到这个数据库,其中的连接需要主机和端口号,然后按照说明来启用删除连接。您可以延迟执行这些指令,直到您实际需要以这种方式连接。如果没有运行这些指令,您可以使用db2命令行连接,在运行这些指令之后,您将能够连接任何需要主机和端口号的工具。

Steps to Enable Remote Connections:

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

    使用以下命令更新db2以允许远程服务:

    cd ~db2inst1

    cd ~ db2inst1

    sudo -u db2inst1 db2 update dbm cfg using svcename db2c_db2inst1

    sudo -u db2inst1 db2 update dbm cfg使用svcename db2c_db2inst1。

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

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

  2. Add the service port using this command:

    使用以下命令添加服务端口:

    sudo vim /etc/services

    vim sudo / etc / services

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

    将这一行添加到文件的最后一行。实际情况并不重要。

    db2c_db2inst1 50000/tcp

    db2c_db2inst1 50000 / tcp

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

    设置db2应该使用这个命令使用tcp/ip:

    sudo -u db2inst1 db2set DB2COMM=TCPIP

    sudo -u db2inst1 db2set DB2COMM=TCPIP。

  4. Stop and start the database with these commands:

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

    sudo -u db2inst1 db2stop force

    sudo -u db2inst1 db2stop force。

    sudo -u db2inst1 db2start

    sudo - u db2inst1 db2start

    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.

    注意停止命令的力量。这将删除任何现有的连接。如果您想对连接的用户友好,请不要使用force,并且在请求用户断开连接后继续重新尝试命令。我在默认指令中加入了这个力,因为很有可能,遵循这些指令的任何人都是数据库中唯一的用户。

References:

If you determine improvements to these instructions please post a comment. I will get notified and make the change.

如果你决定对这些指令进行改进,请发表评论。我会得到通知并做出改变。

#2


1  

Excellent instructions Leons! FYI for those who ran into DB2 errors when following his step-by-step and his updated guide for El Capitan, this may help.

优秀的指令莱昂!对于那些在遵循他的步骤和更新的El Capitan指南时遇到DB2错误的人来说,这可能会有帮助。

1) I got the following errors when running the above steps 13 & 14 as db2inst1 (I was not able to run step 13 with my Mac userid, it likely gave some other error regarding userId/password, can't remember):

1)在运行上面的步骤13和14时,我有以下错误:db2inst1(我无法用我的Mac userid运行第13步,它可能会给用户id /密码造成其他错误,不记得):

db2inst1$ db2sampl

db2inst1 db2sampl美元

Starting the DB2 instance... Creating database "SAMPLE"... Attempt to create the database "SAMPLE" failed. SQL1032N No start database manager command was issued. SQLSTATE=57019

启动DB2实例…创建数据库“SAMPLE”……尝试创建数据库“SAMPLE”失败。SQL1032N没有启动数据库管理器命令。SQLSTATE = 57019

'db2sampl' processing complete.

“db2sampl”处理完成。

db2inst1$ db2start

db2inst1 db2start美元

SQL1652N File I/O error occurred.

出现了SQL1652N文件I/O错误。

2) The errors were due to a locking issue that was somehow introduced:

2)错误是由于某种原因导致的锁定问题:

2016-08-02-16.43.26.649406-300 I8390E1394 LEVEL: Error PID : 19747 TID : 4515377152 PROC : db2sysc INSTANCE: db2inst1 NODE : 000 EDUID : 1 EDUNAME: db2sysc FUNCTION: DB2 Common, Generic Registry, GenRegFile::Lock, probe:50 MESSAGE : ECF=0x900001DA=-1879047718=ECF_GENREG_UNABLE_TO_OPEN_LOCK_FILE Unable to open the lock file CALLED : DB2 Common, OSSe, OSSHFile::open RETCODE : ECF=0x90000001=-1879048191=ECF_ACCESS_DENIED Access denied

mso - ascii - font - family: tahoma; mso - hansi - font - family: tahoma; mso - fareast - font - family:宋体;mso - bidi - font - family: " times new roman "; mso - bidi - theme - font: minor - bidi ' > < span

3) Turns out in my ~db2inst1/sqllib there were 2 files that were somehow created under my Mac userid instead of db2inst1, and they were preventing db2inst1 from obtaining the registry lock:

3)在我的~db2inst1/sqllib中,有两个文件是在我的Mac userid下创建的,而不是db2inst1,它们阻止db2inst1获得注册表锁:

-rw-r--r-- 1 myMacUserId staff 0 29 Jul 15:58 .global.reg.lock
-rw-r--r-- 1 myMacUserId staff 90 29 Jul 15:58 global.reg

-rw-r- r- 1 myMacUserId staff 0 29 Jul 15:58 .global.reg。锁定-rw-r- 1 myMacUserId工作人员9029 Jul 15:58 global.reg。

4) Once I deleted these 2 files, DB2 was able to start successfully and create the SAMPLE database. :)

4)一旦我删除了这两个文件,DB2就能够成功启动并创建SAMPLE数据库。:)