数据库运维
记录DBA学习成长历程

Centos7安装Oracle11.2.0.4

文章目录

建用户,组,目录,权限

创建用户和组

有两个组,oinstall是主组,dba是附组

[root@test ~]# groupadd oinstall
[root@test ~]# groupadd dba
[root@test ~]# useradd oracle -g oinstall -G dba
[root@test ~]# passwd oracle
Changing password for user oracle.
New password: oracle
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: oracle
passwd: all authentication tokens updated successfully.

创建oracle安装目录

[root@test ~]# mkdir -p /u01/oracle
[root@test ~]# chown -R oracle:oinstall /u01
[root@test ~]# chmod -R 775 /u01/oracle

设置系统参数

[root@test ~]# vi /etc/sysctl.conf
文件中加入下列行

multi-user.target
systemctl set-default graphical.target
systemctl set-default multi-user.target

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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@test ~]# sysctl -p

设置Shell Limits(系统资源限制),提高软件的运行效率

[root@test ~]# vi /etc/security/limits.conf
文件中加入下列
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384

在/etc/pam.d/login文件中加入下列行,如果里面没有的话

[root@test ~]# vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so

在/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

在/home/oracle/.bash_profile中删掉原来的最下面三行,然后加添下面的oracle环境变量

# add for oracle11g
ORACLE_BASE=/u01
ORACLE_HOME=$ORACLE_BASE/oracle
ORACLE_SID=prod
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
NLS_LANG="simplified chinese"_china.AL32UTF8
export NLS_LANG
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
export NLS_TIMESTAMP_FORMAT='yyyy-mm-dd HH24:MI:SSXFF'
export NLS_TIMESTAMP_TZ_FORMAT='yyyy-mm-dd HH24:MI:SSXFF  TZR'

使用yum工具安装需要的包,按照联机文档要求去检查

rpm -qa binutils
rpm -qa compat-libstdc
rpm -qa elfutils-libelf
rpm -qa elfutils-libelf-devel
rpm -qa elfutils-libelf-devel-static
rpm -qa glibc-common
rpm -qa glibc-devel
rpm -qa glibc-headers
rpm -qa gcc*
rpm -qa kernel-headers
rpm -qa ksh
rpm -qa libaio-devel
rpm -qa libgcc
rpm -qa libgomp
rpm -qa libstdc++
rpm -qa libstdc++-devel
rpm -qa make
rpm -qa sysstat

上传Oracle安装介质

[root@test ~]# mkdir /soft

[root@test soft]# ll
total 2487320
-rw-r--r-- 1 root root 1395582860 Mar 10 12:36 oracle.p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r-- 1 root root 1151304589 Mar 10 12:36 oracle.p13390677_112040_Linux-x86-64_2of7.zip
-rw-r--r-- 1 root root 121910 Mar 10 12:36 rlwrap-0.43-2.el7.x86_64.rpm
[root@test soft]# unzip oracle.p13390677_112040_Linux-x86-64_1of7.zip 
[root@test soft]# unzip oracle.p13390677_112040_Linux-x86-64_2of7.zip
[root@test soft]# rpm -ivh rlwrap-0.43-2.el7.x86_64.rpm 
[root@test soft]# ll -a
total 2487320
drwxr-xr-x   3 root root        164 Mar 10 12:37 .
dr-xr-xr-x. 19 root root        247 Mar 10 12:25 ..
drwxr-xr-x   7 root root        136 Aug 27  2013 database
-rw-r--r--   1 root root 1395582860 Mar 10 12:36 oracle.p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--   1 root root 1151304589 Mar 10 12:36 oracle.p13390677_112040_Linux-x86-64_2of7.zip
-rw-r--r--   1 root root     121910 Mar 10 12:36 rlwrap-0.43-2.el7.x86_64.rpm

安装Oracle软件

将运行模式改为图像化界面

[root@test database]# su - oracle
上一次登录:三 3月 11 14:06:47 CST 2020pts/1 上
[oracle@test ~]$ vncserver

./runInstaller -jreLoc /etc/alternatives/jre_1.8.0

如图取消订阅,接下来会有提示框,点yes

取消升级,下一步

选择只安装database

安装单实例


第一个企业版安装,下一步

显示的路径应该与配置好的环境变量一样不能直接建在oracle下

我在这里不可以next,必须安装pdksh,但是pdksh又有依赖,所以我强制安装

pdksh-5.2.14-30.x86_64

[root@test ~]# rpm -ivh pdksh-5.2.14-30.x86_64.rpm 
警告:pdksh-5.2.14-30.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 73307de6: NOKEY
错误:依赖检测失败:
pdksh 与 (已安裝) ksh-20120801-140.el7_7.x86_64 冲突
[root@test ~]# rpm -e ksh-20120801
[root@test ~]# rpm -i --force --nodeps pdksh-5.2.14-30.x86_64.rpm 
警告:pdksh-5.2.14-30.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 73307de6: NOKEY
[root@test ~]#

按顺序用root用户执行两个脚本,点ok

赞(0)
MySQL学习笔记 » Centos7安装Oracle11.2.0.4