首页 > 代码库 > ubuntu14.04安装oracle12c及错误解决方法
ubuntu14.04安装oracle12c及错误解决方法
1.更换apt源
cp /etc/apt/sources.list /etc/apt/sources.list.bak vim /etc/apt/sources.list cat /etc/apt/sources.list deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
2.更新系统
apt-get update apt-get dist-upgrade -y init 6 apt-get dist-upgrade -y
3.若ubuntu不是桌面版,则安装桌面
apt-get install x-window-system-core gnome-core -y
4.安装oracle依赖包
apt-get -y install alien binutils build-essential cpp-4.4 debhelper g++-4.4 gawk gcc-4.4 gcc-4.4-base gettext html2text lib32z1 lib32ncurses5 lib32bz2-1.0 intltool-debian ksh lib32bz2-dev lib32z1-dev libaio-dev libaio1 libbeecrypt7 libc6 libc6-dev libc6-dev-i386 libelf-dev libelf1 libltdl-dev libltdl7 libmotif4 libodbcinstq4-1 libodbcinstq4-1:i386 libqt4-core libqt4-gui libsqlite3-0 libstdc++5 libstdc++6 libstdc++6-4.4-dev lsb lsb-core lsb-cxx lsb-desktop lsb-graphics lsb-qt4 make odbcinst pax po-debconf rpm rpm-common sysstat unixodbc unixodbc-dev unzip
5.创建用户和用户组
addgroup oinstall addgroup dba addgroup nobody usermod -g nobody nobody useradd -g oinstall -G dba -p password -m -d /home/oracle -s /bin/bash oracle chown -R oracle:dba /home/oracle mkdir -p /u01/app/oracle mkdir -p /u01/binaries chown -R oracle:dba /u01
6.设置oracle用户密码及创建redhat标识
echo oracle | passwd --stdin oracle (ubuntu不支持) echo ‘Red Hat Linux release 6‘ | sudo tee -a /etc/redhat-release
7.创建redhat目录结构
mkdir /usr/lib64 ln -s /etc /etc/rc.d ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/ ln -s /usr/bin/awk /bin/awk ln -s /usr/bin/basename /bin/basename ln -s /usr/bin/rpm /bin/rpm ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/ ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/ ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /lib64/ ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib64/
cp /etc/security/limits.conf /etc/security/limits.conf.original echo "#Oracle 12C shell limits:" | tee -a /etc/security/limits.conf echo "oracle soft nproc 2048" | tee -a /etc/security/limits.conf echo "oracle hard nproc 16384"| tee -a /etc/security/limits.conf echo "oracle soft nofile 1024" | tee -a /etc/security/limits.conf echo "oracle hard nofile 65536" | tee -a /etc/security/limits.conf
echo "#" | tee -a /etc/sysctl.conf echo "# Oracle 12C entries" | tee -a /etc/sysctl.conf echo "fs.aio-max-nr=1048576" | tee -a /etc/sysctl.conf echo "fs.file-max=6815744" | tee -a /etc/sysctl.conf echo "kernel.shmall=2097152" | tee -a /etc/sysctl.conf echo "kernel.shmmni=4096" | tee -a /etc/sysctl.conf echo "kernel.sem=250 32000 100 128" | tee -a /etc/sysctl.conf echo "net.ipv4.ip_local_port_range=9000 65500" | tee -a /etc/sysctl.conf echo "net.core.rmem_default=262144" | tee -a /etc/sysctl.conf echo "net.core.rmem_max=4194304" | tee -a /etc/sysctl.conf echo "net.core.wmem_default=262144" | tee -a /etc/sysctl.conf echo "net.core.wmem_max=1048586" | tee -a /etc/sysctl.conf echo "kernel.shmmax=1073741824" | tee -a /etc/sysctl.conf
sysctl -p #使上面配置生效 mkdir /etc/rc.d ;for i in 0 1 2 3 4 5 6 S ;do sudo ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ;done
安装VNC服务:
apt-get -y install vnc4server vncpasswd #设置vnc登录密码
---------------------------------
vim /home/oracle/.vnc/xstartup #!/bin/sh export XKL_XMODMAP_DISABLE=1 unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS gnome-panel & gnome-settings-daemon & metacity & nautilus & gnome-terminal & -------------------------------- chmod 777 /root/.vnc/xstartup
#需要将最后一行“x-window-manager &”改为我们自己的Ubuntu图形界面服务,那么改成什么呢?这就要看你Ubuntu是什么桌面环境了,Ubuntu有gnome、KDE、Unity等桌面环境。
如果是gnome桌面,改成gnome-session &;
如果是KDE桌面,改成startkde &;
如果是Unity桌面,首先去 /usr/share/gnome-session/sessions/下看桌面session的名称
vncserver :1 #以oracle用户启动关闭vnc服务
vncserver -kill :1
#vnc客户端下载
https://www.realvnc.com/download/viewer/windows/
为oracle环境配置变量
vim /home/oracle/.bashrc export ORACLE_BASE=/u01/binaries export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export ORACLE_UNQNAME=orcl export LD_LIBRARY_PATH=$ORACLE_HOME/lib export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK export PATH=${PATH}:${ORACLE_HOME}/bin/;
将OpenJDK更改Oracle JDK
cd /opt tar xf jdk-7u67-linux-x64.tar.gz ln -s jdk1.7.0_67/ /java vim /etc/profile #set java environment export JAVA_HOME=/opt/java export JRE_HOME=/opt/java export CLASSPATH==.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
source /etc/profile java -version
8.安装oracle
cd /u01/binaries/ unzip linuxamd64_12102_database_1of2.zip unzip linuxamd64_12102_database_2of2.zip init 6 #重启进入桌面
以oracle用户登录VNC,执行下面命令 export DiSPLAY:0.0 xhost +
cd /u01/binaries/database/ ./runInstaller -ignoreSysPrereqs
#配置开机启动
vim /etc/oratab orcl:/u01/binaries/product/11.2.0/dbhome_1:Y
vim /etc/profile export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 export ORACLE_OWNR=oracle export PATH=$PATH:$ORACLE_HOME/bin export ORACLE_SID=orcl
vim /etc/rc.local su - oracle -lc "/u01/binaries/product/11.2.0/dbhome_1/bin/dbstart" su - oracle -lc "/u01/binaries/product/11.2.0/dbhome_1/bin/lsnrctl stop"
错误一:VNC无法打开桌面
解决:配置VNC登录用户家目录中的配置文件
错误二:java.lang.main classnotfind
解决:为oracle环境配置变量
vim /home/oracle/.bashrc
export ORACLE_BASE=/u01/binaries
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #unicode编码 无论配置成什么编码,格式一定要写对(language_territory.charset 语言_地域和字符集),否则会安装失败,或者不做配置(没试过)
export PATH=${PATH}:${ORACLE_HOME}/bin/;
错误三:提示DISPLAY not set. Please set the DISPLAY and try again。
解决:
export DISPLAY=:0.0
xhost +
执行以上命令后,再次切换到oracle用户执行安装即可。
错误四:
解决:缺少包
apt-get -y install alien binutils build-essential cpp-4.4 debhelper g++-4.4 gawk gcc-4.4 gcc-4.4-base gettext html2text lib32z1 lib32ncurses5 lib32bz2-1.0 intltool-debian ksh lib32bz2-dev lib32z1-dev libaio-dev libaio1 libbeecrypt7 libc6 libc6-dev libc6-dev-i386 libelf-dev libelf1 libltdl-dev libltdl7 libmotif4 libodbcinstq4-1 libodbcinstq4-1:i386 libqt4-core libqt4-gui libsqlite3-0 libstdc++5 libstdc++6 libstdc++6-4.4-dev lsb lsb-core lsb-cxx lsb-desktop lsb-graphics lsb-qt4 make odbcinst pax po-debconf rpm rpm-common sysstat unixodbc unixodbc-dev unzip
错误五:提示insufficient disk space on this volume for the selected oracle home
解决:安装目录磁盘空间不足
错误六:无法启动安装界面,且无报错信息
解决:
以oracle用户登录VNC,执行下面命令
export DiSPLAY:0.0
xhost +
错误七:
解决:
http://www.techienote.com/install-oracle-12c-on-ubuntu/
错误八:lsnrctl 1070
解决:
vim /etc/profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl
本文出自 “卫斯理” 博客,请务必保留此出处http://szk5043.blog.51cto.com/8456440/1850843
ubuntu14.04安装oracle12c及错误解决方法