Centos 7下安装Oracle 12c

SQL Server玩了有些年,最近想玩玩Oracle,于是想到装一台Oracle server来玩玩。第一次在Linux下安装Oracle,整个过程参考了一篇文章:http://blog.csdn.net/huangyanlong/article/details/45021171

环境:VMWare Workstatrion 8.0.3

操作系统:CentOS 7 x64

数据库:Oracle 12c x64

1)安装好Centos 7,这一步跳过

2)从Oracle官网下载12c的安装包,也跳过

3)把软件从本地上传到VM的linux服务器上

这一步的做法是:把虚机的网络连接方式设置成桥接>>在linux服务器上配置ip地址和本机处在同一个网络>>把本地机器上的包含Oracle 12c安装包的目录共享出来>>确保可以在linux服务器上Ping通本地机器>>用mount命令把共享目录挂载到linux服务器上>>解压linuxamd64_12102_database_1of2.zip,linuxamd64_12102_database_2of2.zip这两个zip包到linux服务器上

挂载:mount -t cifs -o username=Jerry,password=password,ip=192.168.1.100 //192.168.1.100/Oracle /mnt/oracle

解压:unzip ./linuxamd64_12102_database_1of2.zip -d /usr/Oracle; unzip ./linuxamd64_12102_database_2of2.zip -d /usr/Oracle;

禁用一些服务,用脚本来做

[root@localhost Oracle Installation]# cat servicestop.sh
chkconfig iptables off
chkconfig ip6tables off
chkconfig cups off
chkconfig firstboot off
chkconfig wpa_supplicant off
chkconfig postfix off
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config

这一步本来应该要去参考Oracle官方安装文档准备好要事先安装的安装包,不过由于上面参考的文章中作者已经列出,这里我直接借鉴那份列表

binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
ksh
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (x86_64)
libaio-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (x86_64)
libXext-1.1 (x86_64)
libXtst-1.0.99.2 (x86_64)
libX11-1.3 (x86_64)
libXau-1.0.5 (x86_64)
libxcb-1.5 (x86_64)
libXi-1.3 (x86_64)
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)

这些rpm包估计都在iso镜像中,要我去一个一个找我觉得太浪费时间,要是下次我要再装一台岂不是要再找多一次。于是我有了一个想法,就是用一个文件存储这份列表,然后写个shell通过关键字在安装盘上查找我们可能需要安装的包,然后拷贝到某个文件夹下

[root@localhost Oracle Installation]# vi cppkg

binutils
compat-libcap
compat-libstdc
gcc-
gcc-c++
glibc-
glibc-devel
ksh
libgcc
libstdc++
libstdc++-devel
libaio
libaio-devel
libXext
libXtst
libX11
libXau
libxcb
libXi-
make
sysstat

保存离开

建立bash_loop_test来拷贝rpm包到本地目录

[root@localhost Oracle Installation]# cat bash_loop_test 
#!/bin/bash

cat /home/jerry/Desktop/'Oracle Installation'/cppkg | while read line

do
find /mnt/cdrom/Packages/ -name ${line}'*' -exec cp {} /home/jerry/Desktop/'Oracle Installation'/ \;

echo $line

done

[root@localhost Oracle Installation]# sh bash_loop_test

生成安装包脚本

[root@localhost Oracle Installation]# echo /dev/null > rpm.sh; find . -name '*.rpm'|xargs -i echo 'rpm -ivh '{} >> rpm.sh ;

不过经过实践发现其实这个方法也不好,因为很多dependency在,所以其实还是要手动去安装这个包。不过至少自己知道去思考一些方法,算是练习练习shell吧

安装调用图形化需要的包,注意这里需要机器可以连接到Internet

[root@localhost Packages]#  yum -y install unixODBC
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB :
extras | 3.4 kB :
updates | 3.4 kB :
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirrors..com
Resolving Dependencies
--> Running transaction check
---> Package unixODBC.x86_64 :2.3.-.el7 will be installed
--> Finished Dependency Resolution
省略

Installed:
unixODBC.x86_64 0:2.3.1-10.el7

Complete!

[root@localhost Packages]# yum -y install unixODBC-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirrors..com
省略

Installed:
unixODBC-devel.x86_64 0:2.3.1-10.el7

Complete!

[root@localhost Packages]# yum install -y xterm
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirrors..com
省略
Installed:
xterm.x86_64 :-.el7 Dependency Installed:
libXaw.x86_64 :1.0.-6.1.el7 Complete!

添加用户和用户组,建立主目录

[root@localhost Packages]# groupadd oinstall
groupadd: group 'oinstall' already exists
[root@localhost Packages]# groupadd dba
groupadd: group 'dba' already exists
[root@localhost Packages]# useradd -g oinstall -G dba oracle
useradd: user 'oracle' already exists
[root@localhost Packages]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost Packages]# id oracle
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)
[root@localhost Packages]# mkdir -p /u01/app/oracle/product/12.1.0/db_1
[root@localhost Packages]# mkdir -p /u01/app/oraInventory
[root@localhost Packages]# chown -R oracle:oinstall /u01/app
[root@localhost Packages]# chmod -R 775 /u01/app
[root@localhost Packages]# vi /etc/sysctl.conf
[root@localhost Packages]# vi /etc/sysctl.conf
[root@localhost Packages]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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 = 1048576

[jerry@localhost Desktop]$ cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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 = 1048576

[root@localhost Packages]# vi /etc/security/limits.conf

把下面的内容添加到文件尾部

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  1024

oracle              hard    nofile  65536

[root@localhost Packages]# vi /etc/pam.d/login

把下面的内容添加到文件尾部

session    required     /lib/security/pam_limits.so

session    required     pam_limits.so

[root@localhost Packages]# vi /etc/profile

添加到文件尾部

if [ $USER = "oracle" ]; then

  if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

切换到oracle用户,修改.bash_profile文件

[root@localhost database]# su oracle
[oracle@localhost ~]$vi .bash_profile
[oracle@localhost ~]$ cat .bash_profile
# .bash_profile # Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs #PATH=$PATH:$HOME/.local/bin:$HOME/bin #export PATH ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/12.1./db_1
ORACLE_SID=jerrychen
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH
[oracle@localhost ~]$ source .bash_profile
 

然而似乎一切顺利可以进入安装阶段时

[oracle@localhost database]$ ./runInstaller
./runInstaller: line : [: /usr/oracle/Oracle: binary operator expected
./runInstaller: line : [: too many arguments
./runInstaller: line : /usr/oracle/Oracle: No such file or directory

一时搞不懂出了什么情况。Google了一下有了头绪,原因是安装目录的名字叫Oracle \Installation。这个命名包含了\符号,就是这个原因导致了runInstaller安装脚本报错,我把目录的名称修改了一下,去除空格和特殊符号好就没报这个错误了。但是,出现了另一个错误,Display变量相关

[oracle@localhost database]$ ./runInstaller
Starting Oracle Universal Installer... Checking Temp space: must be greater than MB. Actual MB Passed
Checking swap space: must be greater than MB. Actual MB Passed
Checking monitor: must be configured to display at least colors
>>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<< Some requirement checks failed. You must fulfill these requirements before continuing with the installation, Continue? (y/n) [n] n

用[oracle@localhost database]$ export DISPLAY=192.168.1.120:0.0设置一下这个变量,然后开启另一个终端来运行runInstaller

[oracle@localhost database]$ ./runInstaller
Starting Oracle Universal Installer... Checking Temp space: must be greater than MB. Actual MB Passed
Checking swap space: must be greater than MB. Actual MB Passed
Checking monitor: must be configured to display at least colors. Actual Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015--21_10--42PM. Please wait ...[oracle@localhost database]$

终于进入安装阶段了

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

有个包前面漏安装了。查了一下安装光盘没有找到这个包。原来linux 7上没有,要到linux 6上才有。但是我不可能跑去download一个linux 6的镜像嘛。用yum来安装咯。至于swap文件和oracle建议的2.8G差了800mb,我想这个不影响整个安装过程,可以等安装完再修改swap文件的大小。跳过(忽略)这项检查。

Centos 7下安装Oracle 12c

[root@localhost Packages]# yum -y install compat-libstdc++-
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package compat-libstdc++-.x86_64 :3.2.-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
compat-libstdc++- x86_64 3.2.-.el7 base k Transaction Summary
================================================================================
Install Package Total download size: k
Installed size: k
Downloading packages:
compat-libstdc++--3.2.-.el7.x86_64.rpm | kB :
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : compat-libstdc++--3.2.-.el7.x86_64 /
Verifying : compat-libstdc++--3.2.-.el7.x86_64 / Installed:
compat-libstdc++-.x86_64 :3.2.-.el7 Complete!

Centos 7下安装Oracle 12c

Centos 7下安装Oracle 12c

上一篇:avalon.js实践 svg地图配置工具


下一篇:css3 transform matrix矩阵的使用