Ubuntu 12.04下安装Oracle Express 11gR2

前端之家收集整理的这篇文章主要介绍了Ubuntu 12.04下安装Oracle Express 11gR2前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Ubuntu 12.04下安装OracleExpress 11gR2 [我的笔记]

参考1http://www.linuxidc.com/Linux/2012-09/71382.htm

参考2http://zhjack.blog.163.com/blog/static/14314920137153331286/

1、点击这里下载Oracle express的安装介质

Oracle Database Express Edition 11g Release 2 for Linux x64

2、转换为deb

由于下载的是rpmubuntu无法直接使用需要alien来转换

$ sudo apt-get install alien

$ sudo alien -d --scripts oracle-xe-11.2.0-1.0.x86_64.rpm

成功转换后得到oracle-xe_11.2.0-2_amd64.deb安装文件

3、安装deb

$ dpkg -i oracle-xe_11.2.0-2_amd64.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

else/sbin/chkconfig --add oracle-xe注释掉,然后再执行

$ sudo /var/lib/dpkg/info/oracle-xe.postinst

提示你运行/etc/init.d/oracle-xe configure进行配置。但别急,我们还需要一些步骤再执行。

4、安装依赖包

$ sudo apt-get install libaio1

5解决ORA-00845: MEMORY_TARGET问题

由于oracle查找的是/dev/shm,而Ubuntu已经换为/run/shm(虽然有链接还是有问题),

在初始化时会出现ORA-00845问题,解决方法如下:

$ sudo vi/etc/init.d/oracle-shm

粘贴下面的代码来创建oracle-shm

#! /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

mkdir /var/lock/subsys 2>/dev/null

touch /var/lock/subsys/listener

if [ -e /dev/shm/.oracle-shm ]; then

echo "/dev/shm is already mounted,nothing to do"

else

rm -f /dev/shm2>/dev/null

mkdir /dev/shm2>/dev/null

#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

#

### BEGIN INIT INFO

# Provides:oracle-shm

# required-Start:$remote_fs $syslog

# required-Stop:$remote_fs $syslog

# Default-Start:2 3 4 5

# Default-Stop:0 1 6

# Short-Description: Bind /run/shm to /dev/shm at system startup.

# Description:Fix to allow Oracle 11g use AMM.

### END INIT INFO

安装oracle-shm

$ sudo chmod 755 /etc/init.d/oracle-shm

$ sudo update-rc.d oracle-shm defaults 01 99

重启系统

$ sudoreboot

6、添加环境变量

$ sudo vi ~/.bashrc文件最后面加入以下代码

exportORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
exportORACLE_SID=
XE
exportNLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`

exportORACLE_BASE=/u01/app/oracle
exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

exportPATH=$ORACLE_HOME/bin:$PATH

$ sudo source ~/.bashrc

7、配置oracle xe

$ sudo /etc/init.d/oracle-xe configure

选择web管理端口默认8080

选择监听端口默认1521

输入管理员密码与确认密码(sys密码)

最后询问你是否自动启动默认y

8、最后,每次重启系统后

启动/关闭Oracle XE监听及实例:$ sudo /etc/init.d/oracle-xe { start | stop }

Shutting down Oracle Database 11g Express Edition instance.

Stopping Oracle Net Listener.

或者进入sqlPlus as sysdba

$ sqlplus /nolog

sql> conn sys as sysdba

Enter password:

Connected to an idle instance.

sql> startup;

ORACLE instance started.

Total System Global Area835104768 bytes
Fixed Size2231096 bytes
Variable Size490734792 bytes
Database Buffers339738624 bytes
Redo Buffers2400256 bytes
Database mounted.
Database opened.

sql> shutdown;

Database closed.

Database dismounted.

ORACLE instance shut down.

---以下为删除 oracle ---

$sudo -s/etc/init.d/oracle-xe stop
$ps -ef | grep oracle | grep -v grep | awk'{print $2}'| xargskill
$ sudodpkg --purge oracle-xe
$ sudorm -r /u01
$ sudorm /etc/default/oracle-xe
$ sudoupdate-rc.d -f oracle-xe remove

原文链接:https://www.f2er.com/ubuntu/354244.html

猜你在找的Ubuntu相关文章