Mac OS yosemite手动卸载db2 v10.1以及重新安装过程(不断更新中...)

来源:互联网 发布:阿里云个人备案照片 编辑:程序博客网 时间:2024/05/22 00:20

好不容易安装完,结果在create sample数据库的时候报错……

bash-3.2$ 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  'db2sampl' processing complete.

看来是安装db2没有安装正确,没办法,推倒重来吧。决定卸载db2数据库。结果输入./db2_deinstall命令一看,image都没找到……

huangs-mbp:expc Elsa$ ./db2_deinstalldyld: Library not loaded: /db2unix/db2galileo/db2_galileo_darwinport/darwin64/s120905/engn/lib/libdb2locale.dylib  Referenced from: /Users/Elsa/Downloads/expc/db2/macos/install/../bin/db2langdir  Reason: image not founddyld: Library not loaded: /db2unix/db2galileo/db2_galileo_darwinport/darwin64/s120905/engn/lib/libdb2locale.dylib  Referenced from: /Users/Elsa/Downloads/expc/db2/macos/install/../bin/db2langdir  Reason: image not foundDBI1055E The message file db2install.cat cannot be found.Explanation:  The message file required by thisscript is missing from the system; it may have beendeleted or the database products may have been loadedincorrectly.User Response:  Verify that the product option containingthe message file is installed correctly.  If there areverification errors; reinstall the product option.

既然这样,就不能怪我手下无情了。昨天搞了一天都没安装成功。
开始手动卸载吧。


第一步:卸载db2整个文件夹

看了一下当初安装的目录/opt/IBM/db2下面,发现有两个版V10.1和V9.5,然而我对后者一点印象都没有,难道说我在装其他应用比如notes或者sametime的时候系统偷偷地给我下了一个?不过我在linux操作系统上新装V10.1版本是没有这种情况的。不知道会不会有影响。不管了,都先删掉吧。到时候再看看。

cd /opt/IBM/db2ls /opt/IBM/db2

回退到/opt/目录下面,然后输入必杀命令

rm -rf IBM/ //注释:此命令有风险,输入需谨慎

这样就删掉了整个db2的文件夹


第二步:卸载db2inst1用户

因为之前是用system preference的users&group安装的db2inst1的用户权限,直接用用户界面卸载掉这个db2inst1。
回到terminal里面,登录root用户,然后输入:

sh-3.2# su db2inst1su: unknown login: db2inst1

找不到db2inst1,说明删除用户成功。


第三步:去把之前设置的path给屏蔽掉

然后找到.bash_profile

vim ~/.bash_profile
#屏蔽掉之前配置的路径#PATH=$PATH:/opt/IBM/db2/V10.1/bin#if [[ -f ~db2inst1/sqllib/db2profile ]]#then#source ~db2inst1/sqllib/db2profile#fi

真的这么顺利吗?我不信,按照我奇葩的从业经历,不整出点幺蛾子不是我的风格。接着重新安装看看。

按照之前官网论坛的攻略:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014927797

又遇到类似的问题……使用非root权限输入./db2_install安装, 就会出错:

huangs-mbp:expc Elsa$ ./db2_install DBI1324W  Support of the db2_install command is deprecated. For      more information, see the DB2 Information Center.DBI1244I  Directory for non-root installation of DB2 - /Users/Elsa/sqllibDBI1160I  Non-root install is being performed.A major error occurred during the execution that caused this program toterminate prematurely. If the problem persists, contact your technical servicerepresentative.For more information see the DB2 installation log at"/tmp/db2_install_Elsa.log".

输入vi /tmp/db2_install_Elsa.log查看我的log发现:

ERROR: The user name specified is invalid.

这个问题修复的方法之一是用sudo权限安装,但是需要使用mac的系统偏好->用户和群组的界面手动地加入db2inst1用户。跟之前的方法一样。具体流程可以参考:
http://stackoverflow.com/questions/23341171/how-do-i-install-db2-express-c-10-1-on-osx-mavericks

但是我想用非root用户的权限安装,于是就输入./db2setup进行安装。
由于担心会出错。参考了以下这个方案修改了。
http://stackoverflow.com/questions/7072871/how-do-i-install-ibm-db2-express-c-on-mac-os-x-10-7-lion

修改了db2setup的只读权限为755,然后开始./db2setup run,依然跳出一个空白的java安装界面对话框。又绕回了java的问题。然并卵。

Huangs-MacBook-Pro:expc Elsa$ ./db2setupDBI1190I  db2setup is preparing the DB2 Setup wizard which will guide      you through the program setup process. Please wait./Users/Elsa/Downloads/expc/db2/macos/install/db2setup: line 606: /tmp/db2_Elsa.tmp.11824/db2/macos/install/../java/jre/bin/java: No such file or directoryDBI1160I  Non-root install is being performed.You are using a Java(TM) Runtime Environment that has not been officially tested for use with DB2.  This command will continue to execute, however if you experience problems, refer to the DB2 installation documentation for a list of supported environments.

检查了一下我的jdk和jre版本都为最新的1.8.0_51:

Huangs-MacBook-Pro:Desktop Elsa$ javac -versionjavac 1.8.0_51Huangs-MacBook-Pro:Desktop Elsa$ java -versionjava version "1.8.0_51"Java(TM) SE Runtime Environment (build 1.8.0_51-b16)Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)Huangs-MacBook-Pro:Desktop Elsa$ which javac/usr/bin/javacHuangs-MacBook-Pro:Desktop Elsa$ which java/usr/bin/java

没办法,重来吧……用mac的system preference->users&groups的图形界面创建完db2inst1用户以后,在terminal输入以下命令创建:

Huangs-MacBook-Pro:instance Elsa$ sudo ./db2icrt -u db2inst1 db2inst1DBI1446I  The db2icrt command is running, please wait.DB2 installation is being initialized. Total number of tasks to be performed: 4 Total estimated time for all tasks to be performed: 309 second(s) Task #1 startDescription: Setting default global profile registry variables Estimated time 1 second(s) Task #1 end Task #2 startDescription: Initializing instance list Estimated time 5 second(s) Task #2 end Task #3 startDescription: Configuring DB2 instances Estimated time 300 second(s) Task #3 end Task #4 startDescription: Updating global profile registry Estimated time 3 second(s) Task #4 end The execution completed successfully.For more information see the DB2 installation log at "/tmp/db2icrt.log.52790".DBI1070I  Program db2icrt completed successfully.

未完待续。。。

0 0
原创粉丝点击