1. 操作系统环境、安装包准备
- 宿主机:Max OSX 10.10.5
- 虚拟机:Parallel Desktop 10.1.1
- 虚拟机操作系统:CentOS-7-x86_64-DVD-1511.iso
- Oracle:linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
- JDK:jdk1.8.0_77.zip
2. 安装CentOS7虚拟机
2.1 新建虚拟机
- cpu:2核
- 内存:4G
- 硬盘:60G,扩展磁盘
2.2 安装配置
2.3 账户配置
使用centos账户登录后,打开终端,切换到root账户
su root
root
预先为centos、oracle账户添加免密码sudo权限
echo "centos ALL=(ALL) nopASSWD:ALL" >> /etc/sudoers
echo "oracle ALL=(ALL) nopASSWD:ALL" >> /etc/sudoers
允许账户使用弱密码
sed 's/^password requisite.*/password requisite pam_cracklib.so try_first_pass retry=3 type=/g' -i /etc/pam.d/system-auth
3. 安装Oracle11g
3.1 设置内核版本
echo redhat-7 > /etc/redhat-release
3.2 安装依赖包
yum install -y binutils compat-gcc* compat-glibc* compat-libcap1 compat-libstd* compat-libstdc++-33 compat-libstdc++-33.i686 compat-libstdc++-33*.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-devel.i686 glibc-devel*.i686 glibc-headers glibc.i686 glibc*.i686 ksh libaio libaio-devel libaio-devel.i686 libaio-devel*.i686 libaio.i686 libaio*.i686 libgcc libgcc.i686 libgcc*.i686 libstdc++ libstdc++-devel libstdc++-devel*.i686 libstdc++.i686 libstdc++*.i686 libXp make numactl sysstat unixODBC unixODBC-devel unixODBC-devel*.i686 unixODBC*.i686
3.3 创建oracle用户及用户组
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
oracle
3.4 设置内核参数
echo >> /etc/sysctl.conf << EOM
fs.aio-max-nr = 1048576
fs.file-ax = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
EOM
sysctl -p # 立即生效内核参数
3.5 设置oracle账户环境变量
echo >> /home/oracle/.bashrc << EOM
JAVA_HOME=/usr/local/jdk1.8.0_77/ # JDK home目录
ORACLE_BASE=/opt/oracle # oracle安装目录
ORACLE_HOME=$ORACLE_BASE/11g # oracle home目录
ORACLE_SID=orcl # oracle实例名
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$JAVA_HOME/bin:$PATH:$ORACLE_HOME/bin:$HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH
EOM
3.6 设置PAM资源限制
echo >> /etc/security/limits.conf << EOM
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOM
3.7 关闭SELinux
sed 's/SELINUX=.*/SELINUX=disabled/g' -i /etc/selinux/config
setenforce 0 # 立即生效
3.8 创建安装目录
mkdir -p /opt/oracle
chown oracle:oinstall /opt/oracle
chmod 755 /opt/oracle
mkdir -p /opt/oraInventory
chown oracle:oinstall /opt/oraInventory
chmod 755 /opt/oraInventory
3.9 准备安装包
通过移动设备将linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip和jdk1.8.0_77.zip拷贝到桌面,解压
mkdir -p /usr/local/jdk1.8.0_77/
tar xf jdk1.8.0_77.zip -C /usr/local/jdk1.8.0_77/ # 解压安装安装JDK
tar xf linux.x64_11gR2_database_1of2.zip -C /home/oracle
tar xf linux.x64_11gR2_database_2of2.zip -C /home/oracle
chmod -R 700 /home/oracle/database # 只允许oracle账户访问
chown -R oracle:oinstall /home/oracle/database
3.10 使用oracle账户启动安装
su oracle -c 'export LANG=C /home/oracle/database/runInstaller'
3.11 安装错误解决
(1)启动安装时报错java.lang.NoClassDefFoundError
Exception in thread "main" java.lang.NoClassDefFoundError
at java.lang.class.forName0(Native Method)
at java.lang.class.forName(Class.java:164)
at java.awt.Toolkit$2.run(Toolkit.java:821)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)
at com.jgoodies.looks.LookUtils.isLowResolution(UnkNown Source)
at com.jgoodies.looks.LookUtils.<clinit>(UnkNown Source)
at com.jgoodies.looks.plastic.PlasticLookAndFeel.<clinit>(PlasticLookAndFeel.java:122)
at java.lang.class.forName0(Native Method)
at java.lang.class.forName(Class.java:242)
at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1783)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:480)
at oracle.install.commons.util.Application.startup(Application.java:758)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:164)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:181)
at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:265)
at oracle.install.ivw.db.driver.DBInstaller.startup(DBInstaller.java:114)
at oracle.install.ivw.db.driver.DBInstaller.main(DBInstaller.java:132)
解决办法:
标准化图形安装配置
sudo yum install -y xorg-x11-utils xorg-x11-apps
sudo xhosts + # 对所有账户开放XServer
检查设置是否生效
xclock
[Ctrl+C]
(2)链接错误/usr/bin/ld: crt1.o: No such file: No such file or directory
Error in invoking target ‘install’ of makefile ‘/opt/oracle/11g/ctx/lib/ins_ctx.mk’. See ‘/opt/oraInventory/logs/installActions2016-08-07_02-58-49AM.log’ for details.
查看安装日志/opt/oraInventory/logs/installActions2016-08-07_02-58-49AM.log
INFO: /usr/bin/ld: crt1.o: No such file: No such file or directory
INFO: collect2: ld ?? 1
INFO: make: *** [ctxhx] ?? 1
INFO: End output from spawned process.
解决办法:
安装glibc-devel的32位包
yumdownloader glibc-devel
rpm -ivh glibc-devel-2.17-106.el7_2.8.i686.rpm
rm -f glibc-devel-2.17-*.rpm
重试
(3)链接错误/lib64/libstdc++.so.5: undefined reference to memcpy@GLIBC_2.14
Error in invoking target ‘install’ of makefile ‘/opt/oracle/11g/ctx/lib/ins_ctx.mk’. See ‘/opt/oraInventory/logs/installActions2016-08-07_02-58-49AM.log’ for details.
查看安装日志/opt/oraInventory/logs/installActions2016-08-07_02-58-49AM.log
INFO: /lib64/libstdc++.so.5: undefined reference to `memcpy@GLIBC_2.14'
collect2: error: ld returned 1 exit status
INFO: make: *** [ctxhx] Error 1
INFO: End output from spawned process.
解决办法:
if [[ ! -f /usr/lib64/libc.a ]]; then yum -y install glibc-static; fi
sed 's/.*\$(LINK_CTXHX) \$(CTXHXOBJ) \$(INSO_LINK)$/-static \/usr\/lib64\/libc.a \$(LINK_CTXHX) \$(CTXHXOBJ) \$(INSO_LINK)/g' -i /opt/oracle/11g/ctx/lib/ins_ctx.mk
重试
(4)链接错误ins_emagent.mk 'agent nmhs'
Error in invoking target 'agent nmhs' of makefile '/opt/oracle/11g/sysman/lib/ins_emagent.mk'
解决办法:
sed 's/$(MK_EMAGENT_NMECTL)$/\$(MK_EMAGENT_NMECTL) -lnnz11/g' -i /opt/oracle/11g/sysman/lib/ins_emagent.mk
重试
(5)netca无法启动
/u01/Oracle/bin/netca: line 178: 11819 Aborted $JRE $JRE_OPTIONS -classpath $CLAsspATH oracle.net.ca.NetCA $*
解决办法:
cat > /etc/sysconfig/network << EOM
NETWORKING=yes
HOSTNAME=hotDB11g
GATEWAY=192.168.1.1
EOM
echo '127.0.0.1 hotDB11g' /etc/hosts
hostname hotDB11g
4. 测试
启动服务
su - oracle -c 'lsnrctl start'
连接查询所有数据库
su - oracle -c 'sqlplus / as sysdba'
sql> statup
sql> select name from v$database;
5. 参考资料
http://blog.chinaunix.net/uid-21562515-id-4964631.html
http://www.cnblogs.com/mophee/archive/2013/06/01/3107137.html
http://blueaeri.iteye.com/blog/1832590
http://unix.stackexchange.com/questions/117626/installing-oracle-11g-r2-on-linux-6-1
https://community.oracle.com/thread/995965?start=0&tstart=0
http://blog.csdn.net/u011451049/article/details/9411341
http://www.cnblogs.com/junnyfeng/archive/2013/01/09/2853705.html
http://www.linuxidc.com/Linux/2015-02/113222p8.htm
http://blog.csdn.net/rudygao/article/details/24025687
http://www.jianshu.com/p/2fda26a7edf1
https://community.oracle.com/thread/3635853
http://www.linuxidc.com/Linux/2011-04/35085.htm
http://blog.csdn.net/he_jian1/article/details/41869189
原文地址:https://www.cnblogs.com/fanzhidongyzby/p/5769424.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。