linux ubuntu系统安装及卸载oracle xe11.2.0

最近公司对盗版很忌讳,所以都换上免费的了,培训中心的操作系统选择ubuntu,oracle换成xe版的了,对于oracle xe在ubuntu 12.0.4上的安装也是小折腾了一把,毕竟oracle对ubuntu 12.04在原则上是不支持的。下面安装不算正规,但也总算装上了,有需要的可以参考。
1,建立oracle用户及属主
addgroup oinstall
addgroup dba
adduser oracle
usermod –g oinstall –G dba oracle
id oracle
id nobody
2,建立软链接
#ln -s /usr/bin/awk /bin/awk
#ln -s /usr/bin/rpm /bin/rpm
#ln -s /usr/bin/basename /bin/basename
3,检查包的依赖性(需要连网环境)
#apt-get update
#apt-get install alien
#apt-get install libaio1
4,准备安装文件
一般下载得到的是zip文件,需要先unzip解压
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
将解压出来的rpm文件转换成deb格式
alien -d --scripts oracle-xe-11.2.0-1.0.x86_64.rpm
这里如果alien没有安装,需要先安装alien。
5,安装oracle软件
oracle xe需要使用root用户进行
#dpkg -i oracle-xe-11.2.0-1.0.x86_64.deb
这个命令运行时中会报一个错,/sbin/chkconfig不存在。
检查/var/lib/dpkg/info/oracle-xe.postinst脚本,在这个脚本中找到下面这一段:
if [ -f /etc/SuSE-release ]
then cp -f /u01/app/oracle/product/11.2.0/xe/config/scripts/oracle-xe.sles /etc/init.d/oracle-xe /usr/lib/lsb/install_initd /etc/init.d/oracle-xe > /dev/null 2>&1
/sbin/insserv /etc/init.d/oracle-xe > /dev/null 2>&1
/sbin/SuSEconfig > /dev/null 2>&1
#else
#/sbin/chkconfig --add oracle-xe
fi
将上面粗体部分注释掉,然后再执行
#/var/lib/dpkg/info/oracle-xe.postinst
这时就不再报这个错了。
6,安装oracle-shm
这部分的安装主要是为了避免ORA-00845: MEMORY_TARGET问题,将下面一段拷贝到命令行,回车即可:
cat > /etc/init.d/oracle-shm <<-EOF
#! /bin/sh
# /etc/init.d/oracle-shm
#
case "\$1" in
start)
echo "Starting script /etc/init.d/oracle-shm"
# Run only once at system startup
if [ -e /dev/shm/.oracle-shm ]; then
echo "/dev/shm is already mounted, nothing to do"
else
rm -f /dev/shm
mkdir /dev/shm
#mount -B /run/shm /dev/shm
mount -t tmpfs shmfs -o size=2048m /dev/shm
touch /dev/shm/.oracle-shm
fi
;;
stop)
echo "Stopping script /etc/init.d/oracle-shm"
echo "Nothing to do"
;;
*)
echo "Usage: /etc/init.d/oracle-shm {start|stop}"
exit 1
;;
esac
#
EOF
下面接着配置一下oracle-shm
#chmod 755 /etc/init.d/oracle-shm
#update-rc.d oracle-shm defaults 01 99
#reboot 这时需要重启一下电脑
7,配置oracle,建库等操作
先建个目录(由于ubuntu下面无此目录,为防止安装oracle xe时报错):
#mkdir /var/lock/subsys
#/etc/init.d/oracle-xe configure
选择web管理端口默认8080
选择监听端口默认1521
输入管理员密码与确认密码(sys密码)
最后询问你是否自动启动默认y
8,检查安装
切换到oracle用户检查环境变量,查看/home/oracle/.profile,
如果没有添加oracle的环境变量则需要手工写入。
su – oracle
env |grep ORA
sqlplus /nolog
conn /as sysdba
/etc/init.d/oracle-xe start
/etc/init.d/oracle-xe stop
ps –ef|grep oracle
9,卸载oracle-xe
#apt-get remove --purge  oracle-xe
#rm /etc/default/oracle-xe
#rm –rf /u01
note:如果想通过sqlplus启动关闭数据库,还要设置oracle用户的环境变量,这里就不再设置了。
posted @ 2013-03-01 10:26  linux,dev  阅读(1250)  评论(0编辑  收藏  举报