标签归档:卸载

Linux卸载原生MySQL数据库

在安装Linux系统时,如果同时选择安装MySQL数据库,则默认是5.1版本,这对于目前新上线的生产系统而言,数据库版本太低。因此就需要卸载原生MySQL数据库,安装功能及稳定性更好的5.5或5.6版本。
卸载原生MySQL请参考潇湘隐者的文章《Linux平台卸载MySQL总结》http://www.cnblogs.com/kerrycode/p/4364465.html

1.检查是否安装了MySQL组件
[root@dbtest5 ~]# rpm -qa|grep -i mysql
mysql-5.1.73-3.el6_5.x86_64
mysql-server-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64
以上显示,说明安装了MySQL 5.1.73这个版本的server、devel、libs、perl-DBD四个组件。

2.关闭MySQL服务
--- 方式1
[root@dbtest5 ~]# service mysqld status
mysqld (pid  29140) is running...
[root@dbtest5 ~]# service mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@dbtest5 ~]# service mysqld status
mysqld is stopped
--- 方式2 
[root@dbtest5 ~]# /etc/init.d/mysqld start
Starting mysqld:                                           [  OK  ]
[root@dbtest5 ~]# /etc/init.d/mysqld status
mysqld (pid  29630) is running...
[root@dbtest5 ~]# /etc/init.d/mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@dbtest5 ~]# /etc/init.d/mysqld status
mysqld is stopped

3.收集MySQL对应的文件信息
[root@dbtest5 ~]# whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
[root@dbtest5 ~]# which mysql
/usr/bin/mysql
[root@dbtest5 ~]# find / -name mysql
/usr/share/mysql
/usr/bin/mysql
/usr/lib64/mysql
/usr/lib64/perl5/auto/DBD/mysql
/usr/lib64/perl5/DBD/mysql
/var/lib/mysql
/var/lib/mysql/mysql

4.卸载删除MySQL组件
[root@dbtest5 ~]# rpm -ev mysql-server-5.1.73-3.el6_5.x86_64
warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave
[root@dbtest5 ~]# rpm -ev mysql-5.1.73-3.el6_5.x86_64
[root@dbtest5 ~]# rpm -ev perl-DBD-MySQL-4.013-3.el6.x86_64
[root@dbtest5 ~]# rpm -ev mysql-libs-5.1.73-3.el6_5.x86_64
error: Failed dependencies:
        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64
        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64
        mysql-libs is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64
由于包依赖性关系,卸载mysql-libs包时出错,这里可以加--nodeps参数强制卸载:
[root@dbtest5 ~]# rpm -ev mysql-libs-5.1.73-3.el6_5.x86_64 --nodeps
到此MySQL组件已经全部卸载,使用rpm -qa|grep -i mysql确认所有组件包均已卸载
[root@dbtest5 ~]# rpm -qa|grep -i mysql

5.删除MySQL对于的文件
[root@dbtest5 ~]# which mysql
/usr/bin/which: no mysql in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@dbtest5 ~]# whereis mysql
mysql:
[root@dbtest5 ~]# find / -name mysql
/var/lib/mysql
/var/lib/mysql/mysql
[root@dbtest5 ~]# rm -rf /var/lib/mysql
[root@dbtest5 ~]# rm -rf /var/lib/mysql/mysql

6.删除MySQL用户及组
如果存在MySQL相关用户和组信息,则进行删除:
[root@dbtest5 ~]# more /etc/passwd | grep mysql
mysql:x:101:501::/home/mysql:/bin/bash
[root@dbtest5 ~]# more /etc/shadow | grep mysql
mysql:!!:16496::::::
[root@dbtest5 ~]# more /etc/group | grep mysql
mysql:x:501:
[root@dbtest5 ~]# userdel mysql
[root@dbtest5 ~]# groupdel mysql
groupdel: group mysql does not exist

Manual deinstall 11gR2 RAC in Linux Platform

两个节点分别执行如下操作:

两个节点分别执行如下操作:
crsctl stop crs -f
cd /etc/oracle/
rm -rf scls_scr oprocd lastgasp o* setasmgid
vi  /etc/inittab(去掉ohas那一行[通常是最后一行])
rm -f /etc/init.d/init.cssd 
rm -f /etc/init.d/init.crs 
rm -f /etc/init.d/init.crsd 
rm -f /etc/init.d/init.evmd 
rm -f /etc/rc2.d/K96init.crs 
rm -f /etc/rc2.d/S96init.crs 
rm -f /etc/rc3.d/K96init.crs 
rm -f /etc/rc3.d/S96init.crs 
rm -f /etc/rc5.d/K96init.crs 
rm -f /etc/rc5.d/S96init.crs 
rm -Rf /etc/oracle/scls_scr
rm -f /etc/inittab.crs 
cp /etc/inittab.orig /etc/inittab
rm -rf /etc/init.d/ohasd
rm -rf /etc/init.d/init.ohasd 
rm -rf /etc/oratab
rm -rf /etc/oraInst.loc 
rm -rf /var/tmp/.oracle
rm -rf /tmp/.oracle
rm -rf /u01/app
cd /tmp
rm -rf CVU_11.2.0.3.0_grid logs Logs OraInstall*
mkdir -p /u01/app/11.2.0.3/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle
chown -R grid:oinstall /u01/app/11.2.0.3/grid
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle/product/11.2.0.3/dbhome_1
chown -R oracle:oinstall /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle/product/11.2.0.3/dbhome_1
---检查是否还有d.bin进程,如果kill掉:
ps -ef|grep d.bin
kill -9 pid
---检查ifconfig|grep 169.254如果有类似如下输出,需要重启eth1网卡:
eth1:1    Link encap:Ethernet  HWaddr 08:00:27:89:81:66  
          inet addr:169.254.159.3  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1 
ifdown eth1
ifup eth1
ifconfig|grep 169.254
---两节点执行完后可以重新安装

PS: 文章来源于Lunar的oracle实验室